This is the mail archive of the gdb@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]
Other format: [Raw text]

Re: breakpoint instruction isn't shown in disassemble or examine (x)commands?


> Date: Thu, 30 Sep 2004 01:03:35 +0200
> From: Marco Molteni <molter@tin.it>
> 
> I tought of doing something like (in various incantations):
> 
> (gdb) disassemble foo
> (gdb) break foo
> (gdb) disassemble foo
> 
> and was expecting of seeing the 0xcc instruction in the output of
> the second disassemble command; instead the output is the same
> as the first disassemble. Same results with the x command.
> It seems that gdb wants to "protect" me from seing that the executable
> is changed?

This is because GDB actually inserts the breakpoint instructions only
when it is about to run the inferior program.  That is, when you type
"break foo", GDB only records that a breakpoint is to be set at the
entry to `foo'; the breakpoint instruction is written there only when
you type "run" or "continue" or some other command that runs the
inferior.  When the inferior stops for any reason, the breakpoint
instruction is removed before GDB returns to the prompt.

> So somehow I have my sanity back, but the question remains: how
> can I see the breakpoint instruction from gdb itself?

Why do you need that?  You already know what you will see there,
right?


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