This is the mail archive of the gdb@sourceware.org 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: fail to get ra and bp


gdb-owner@sourceware.org wrote on 2006-10-12 13:39:44:

> > I am porting GDB to a new target.
> 
> Would you mind telling us what this new target is? I believe this will
> greatly help us provide more accurate answers. In the meantime...

The new target is named Score ---- 32 bit core designed by Chinese IC 
company.
Both GCC for Score and Binutils for Score have entered GNU main tree just 
now.
In future, GDB for Score is willing to enter GNU official release.
 
> > The prologue has two insns ---- push ra and push bp.
> > When back tracing and printing variables, gdb will look for return 
address 
> > of this frame and frame pointer on stack.
> > Unfortunately, If compiling with -O2, the two insns are probably 
deleted. 
> > So, GDB will not get ra and bp value.
> 
> Typical problem. My recommendation, stay away from prologue analysis
> as much as you can, because as you know, higher levels of optimization
> will break the typical frame layout. What you want, is have this
> information provided by the compiler itself and dumped into the
> objects in some form.
> 
> One very popular form, at least in the GNU world, is DWARF CFI. There
> is also another popular form, which I don't really know much about.
> The information is stored in .eh_frame sections. But it essentially
> does the same: It tells you how to unwind the call stack.

Do you know which target use .eh_frame to handle call stack?
Would you please give me more info about .eh_frame or some documents 
describing it?
 
> This is what you want because this information allows you to avoid
> tricky prologue scanning and hairy heuristics to try to guess where
> things are.
> 
> Now that I think of it, if you have no choice but do prologue scanning,
> you might want to look at a framework that was recently contributed
> which should make your task easier. I think it's prologue-value.[hc].

Could I directly call the functions in prologue-value.[hc]?
 
> -- 
> Joel


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