RE: "xbreak" command in GDB ?

Pierre Muller
2002-01-25T09:20:46Z

At 09:29 25/01/2002 , Sarnath K - CTD, Chennai. a Ã©crit:
> >Simply try
> >./gdb ./gdb
> >break main
> >xbreak main
> >disas main
>
> GDB never exits via the leaving point
>of main() function, I suppose.
>It exits via "quit_command" function.
>I vaguely remember this ( when I was
>browsing GDB source code.) So this test
>might not reflect things correctly.
>Correct me if I am wrong

I didn't want to say that you should run the progream after.
Simply comparing the address of the xbreak with
the position of the ret instruction
in the function disassembly is enough to
show that you are right in saying that this
command is buggy for i386 at least.

Looking into source it apears that this is
related to function
find_pc_sect_partial_function

because xbreak uses the returned endaddr value.

function description says that
/* Finds the "function" (text symbol) that is smaller than PC but
greatest of all of the potential text symbols in SECTION. Sets
*NAME and/or *ADDRESS conditionally if that pointer is non-null.
If ENDADDR is non-null, then set *ENDADDR to be the end of the
function (exclusive), but passing ENDADDR as non-null means that
the function might cause symbols to be read. This function either
succeeds or fails (not halfway succeeds). If it succeeds, it sets
*NAME, *ADDRESS, and *ENDADDR to real information and returns 1.
If it fails, it sets *NAME, *ADDRESS, and *ENDADDR to zero and
returns 0. */

The exclusive attribute should be the reason why this works
but the endaddress is simply set by
cache_pc_function_high = BLOCK_END (SYMBOL_BLOCK_VALUE (f));
(cache_pc_function_high is copied into endaddr at function end)

But I don't think that BLOCK_END should
exclude any instruction, so its probably here that we should
decrement but there is no code for
function_epilogue in i386-tdep.c

Pierre Muller
Institut Charles Sadron
6,rue Boussingault
F 67083 STRASBOURG CEDEX (France)
mailto:muller@ics.u-strasbg.fr
Phone : (33)-3-88-41-40-07 Fax : (33)-3-88-41-40-99