This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[RFA] remote.c: adjust Z packet addr using BREAKPOINT_FROM_PC


This patch adjusts breakpoint addresses using BREAKPOINT_FROM_PC before
rather than after storing them in Z packets.

Elsewhere in GDB, BREAKPOINT_FROM_PC gets called before the address is
passed to the target, so I think this patch is correct.  I haven't tested
it with a target that uses both Z packets and BREAKPOINT_FROM_PC,
however.

ChangeLog:

	* remote.c (remote_insert_breakpoint, remote_remove_breakpoint):
	Call BREAKPOINT_FROM_PC before rather than after storing the
	address in the outgoing Z packet.

No regressions on i686-pc-linux-gnu.  Okay to apply?

Nicholas Duffek
<nsd@redhat.com>

[patch follows]

Index: gdb/remote.c
===================================================================
diff -up gdb/remote.c gdb/remote.c
--- gdb/remote.c	Mon Jan  8 19:35:50 2001
+++ gdb/remote.c	Mon Jan  8 19:35:26 2001
@@ -4250,12 +4250,13 @@ remote_insert_breakpoint (CORE_ADDR addr
       char *buf = alloca (PBUFSIZ);
       char *p = buf;
       
-      addr = remote_address_masked (addr);
       *(p++) = 'Z';
       *(p++) = '0';
       *(p++) = ',';
-      p += hexnumstr (p, (ULONGEST) addr);
+
+      addr = remote_address_masked (addr);
       BREAKPOINT_FROM_PC (&addr, &bp_size);
+      p += hexnumstr (p, (ULONGEST) addr);
       sprintf (p, ",%d", bp_size);
       
       putpkt (buf);
@@ -4306,8 +4307,8 @@ remote_remove_breakpoint (CORE_ADDR addr
       *(p++) = ',';
 
       addr = remote_address_masked (addr);
-      p += hexnumstr (p, (ULONGEST) addr);
       BREAKPOINT_FROM_PC (&addr, &bp_size);
+      p += hexnumstr (p, (ULONGEST) addr);
       sprintf (p, ",%d", bp_size);
       
       putpkt (buf);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]