This is the mail archive of the 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: skipping prologues wrote:
> Hi, all.
> Is there a standard way of skipping prologues?  Some *-tdep.c
> files try and skip to the first line number when that info is
> present, while others always use an ad-hock skip based on
> instruction sequences.  The first line number is of course
> dependent on the compiler knowing this convention.
> Thanks again.
> GP


The best way IMHO consists to use the skipping method provided by the
target the debugger is connected on.

The skip_prologue() primitive (*-tdep.c) calls an ad-hoc
is-in-prologue(PC) target primitive with PC argument, which returns true
or false. skip-prologue() increments PC until is-in-prologue() is FALSE.
Every is-in-prologue() call, the target find if the PC value is located
inside or outside the prologue (the application code must not be
optimized otherwise the prologue may be mixed inside the function body).
is-in-prologue() is implemented in the target side and better in the
debugger's API of the target

This method avoid to be aware of target asm code and also avoid to be
dependant of asm specifications and evolutions.

The other approach consists to analyse (debugger side) the instruction
hexadecimal code (in skip-prologue() primitive) and find if PUSH (or
other prologue insn or sequence) are the current one meaning we are
located inside the prologue. The method is heavy. The debugger
developper must also be aware of asm code and prologue specifications.

Good luck

| Christophe PLANAT                 | Embedded Systems Technology    |
| Email :  | STMicroelectronics             |
| Phone : +33 04 76 92 68 82        | 850, rue Jean-Monnet           |
| Fax   : +33 04 76 92 50 94        | BP 16 - 38921 Crolles - France |

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