Re: "xbreak" command in GDB ?

Michael Snyder
2002-01-31T20:45:39Z

Pierre Muller wrote:
>
> At 08:45 25/01/2002 , Eli Zaretskii a Ã©crit:
> > > From: "Sarnath K - CTD, Chennai." <k_sarnath@ctd.hcltech.com>
> > > Date: Thu, 24 Jan 2002 14:59:18 +0530
> > >
> > > The "xbreak" command (and hence "txbreak" )
> > > in GDB Version 5.1 doesnt seem to work
> > > properly.
> >
> >What OS? What compiler?
> >
> >On my system (DJGPP, GCC 3.0.2), xbreak does seem to work.
>
> Well, not the official 5.0 DJGPP release ....
> there the position is also after the final ret instruction.
>
> I also tested with cygwin current CVS executable and
> it also inserted the breaklpoint past the last instruction.
>
> Anyhow, how is this supposed to work for
> C code that can have multiple ret instructions
> in one function?

It can't.

> Or is there a compiler switch (for GCC)
> that can force generation of a unique
> exit location?

No.

> Otherwise the best solution
> (on systems with hardware watchpoints)
> would probably be
> to insert a breakpoint at entry
> and to watch stackpointer value.

> > > A minute investigation showed that it is
> > > setting a break-point at a posn
> > > 1 past the last instrn of the "function".
> >
> >Could you send a complete short test program and a sequence of
> >commands, including the compilation command line, to reproduce that?
>
> Simply try
> /gdb ./gdb
> break main
> xbreak main
> disas main
>
> 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