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: "xbreak" command in GDB ?


Pierre Muller writes:
 > 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 
 > 


Yes, this command was introduced with the infimous HP merge. xbreak
and txbreak never worked as advertized. If you look at the HP sources
(available at the www.hp.com) you'll notice that they added some very
very very platform specific hacks to make the command work.

Similarly for another command 'bx' available in xdb mode only.

None of these commands are documented or tested.

Michael, what should we do? 

Elena


 > 
 > 
 > 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


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