This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: breakpoint instruction isn't shown in disassemble or examine(x) commands?
On Thu, 30 Sep 2004 "Eli Zaretskii" <eliz@gnu.org> wrote:
[..]
> 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 I guess that the inferior is run also by the "call" command:
=====================
$ gdb -q stack
(gdb) b f2
Breakpoint 1 at 0x8048532: file stack.c, line 10.
(gdb) b main
Breakpoint 2 at 0x80485d0: file stack.c, line 44.
(gdb) r
Starting program: /home/molter/src/stack
Breakpoint 2, main () at stack.c:44
44 int b = 78;
(gdb) call check()
*** Found breakpoint instruction at 0x8048532: 0xcc
(gdb)
=====================
where check() looks for the 0xcc byte in the code for f2().
> > 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?
I "needed" that because I am learning ;-)
thanks, your response confirms that I understood correctly.
marco
--
panic("The moon has moved again.");