Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Re: fail to get ra and bp
@ 2006-10-12  7:14 ligang
  2006-10-12 12:54 ` Daniel Jacobowitz
  0 siblings, 1 reply; 5+ messages in thread
From: ligang @ 2006-10-12  7:14 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: bjgnu, gdb

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


^ permalink raw reply	[flat|nested] 5+ messages in thread
* fail to get ra and bp
@ 2006-10-12  5:21 ligang
  2006-10-12  5:39 ` Joel Brobecker
  0 siblings, 1 reply; 5+ messages in thread
From: ligang @ 2006-10-12  5:21 UTC (permalink / raw)
  To: gdb; +Cc: bjgnu

Hi all,


I am porting GDB to a new target.

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.

It seems MIPS also fail to do this. 
Does it need to change ABI? Anyone has any thought?
 
Thanks.
Ligang


^ permalink raw reply	[flat|nested] 5+ messages in thread
* fail to get ra and bp
@ 2006-10-12  4:33 bjgnu
  0 siblings, 0 replies; 5+ messages in thread
From: bjgnu @ 2006-10-12  4:33 UTC (permalink / raw)
  To: gdb

Hi all,

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.

It seems MIPS also fail to do this.
Anyone has any thought?
 
Thanks.
ligang


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-10-12 12:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-12  7:14 fail to get ra and bp ligang
2006-10-12 12:54 ` Daniel Jacobowitz
  -- strict thread matches above, loose matches on Subject: below --
2006-10-12  5:21 ligang
2006-10-12  5:39 ` Joel Brobecker
2006-10-12  4:33 bjgnu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox