Setting Prog pointer back in the prog

Andrew Cagney ac131313@redhat.com
Wed Nov 20 12:35:00 GMT 2002


> On Wed, Nov 20, 2002 at 12:21:35PM -0500, Andrew Cagney wrote:
> 
>> >On Wed, Nov 20, 2002 at 12:07:30PM +0100, Jean-Eric Cuendet wrote:
>> >
> 
>> >>Hi,
>> >>With MsDev debugger, you can set the program pointer back in the code
>> >>(Set Next Statement).
>> >>Is it also possible with GDB?
>> >>If yes, how? Why doesn't Eclipse/Insight/DDD/... don't provide that?
>> >>If no, why? Will it be implemented in a next version? Or is it a MsDev
>> >>bug? :-)
> 
>> >
>> >
>> >Try: "set $pc = <address>".  You have to use PC values, not line
>> >numbers.
> 
>> 
>> FYI,
>> 
>> (gdb) help jump
>> Continue program being debugged at specified line or address.
>> Give as argument either LINENUM or *ADDR, where ADDR is an expression
>> for an address to start at.
> 
> 
> Learn something new every day.... thanks Andrew!

(Ha!  You've not spent enough time reading the testsuite gdb.log output. 
  Learn all sorts of things.)

BTW, on some architectures a simple:

set $pc = ...

May not do what you want.  SPARC would need both $pc and $npc set - jump 
does this.  Wonder if this is documented ...
http://sources.redhat.com/gdb/current/onlinedocs/gdb_15.html#IDX545
Almost, bug report.

Andrew




More information about the Gdb mailing list