* back trace issue
@ 2009-04-29 7:53 nagaraju.m
2009-04-29 17:01 ` Joel Brobecker
2009-04-29 18:29 ` Anthony Berent
0 siblings, 2 replies; 5+ messages in thread
From: nagaraju.m @ 2009-04-29 7:53 UTC (permalink / raw)
To: gdb
Hi,
I am new to gdb. I am using ported gdb to a specific target.
when i am using back trace it is giving only the top most frame.
example:
int add(int x,int y)
{
int z;
z=min(x,y);
return z;
}
int min(int p,int q)
{
int r;
r=max(p,q);
return r;
}
int max(int d,int e)
{
return (d+e);
}
int main()
{
int a, b, c,i;
a = 10;
b =20;
for(i=0;i<10;i++)
c = add(a,b);
return 0;
}
suppose if the control is in max function
(gdb) bt
#0 max (d=10, e=20) at abc.c:15
#1 0x20010348 in ?? ()
can you please suggest me where to provide the information to gdb so
that "back trace" works properly.....
Thanks in advance,
Nagaraju
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: back trace issue
2009-04-29 7:53 back trace issue nagaraju.m
@ 2009-04-29 17:01 ` Joel Brobecker
[not found] ` <49FC0D86.6090809@redpinesignals.com>
2009-04-29 18:29 ` Anthony Berent
1 sibling, 1 reply; 5+ messages in thread
From: Joel Brobecker @ 2009-04-29 17:01 UTC (permalink / raw)
To: nagaraju.m; +Cc: gdb
> can you please suggest me where to provide the information to gdb so
> that "back trace" works properly.....
Typically, the [...]-tdep file for your architecture will provide
a set of routines that compute the value of a register in the caller's
frame (aka the "previous" frame) given a struct frame_info and and
its associated frame cache. Have a look at some of the -tdep.c files,
and search for "_prev_register", or "_this_id". That should give you
a few leads. I'll also mention that there is a new module in
prologue-value.[hc] that can simplify your job when doing prologue
analysis. I am mentioning it because it's relatively use a still
little used.
Also, if your target supports DWARF, you might also want to see if
the they produce CFI info, in which case a DWARF-based unwinder would
be able to compute your backtrace without requiring the prologue
analyzer. I can't remember the names of the routines but you'll need
to provide a gdbarch routine that converts a dwarf register number
into the associated GDB register number. And then hook in the dwarf
unwinder sniffers: dwarf2_append_unwinders. Again, have a look at
the various -tdep files.
--
Joel
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: back trace issue
2009-04-29 7:53 back trace issue nagaraju.m
2009-04-29 17:01 ` Joel Brobecker
@ 2009-04-29 18:29 ` Anthony Berent
1 sibling, 0 replies; 5+ messages in thread
From: Anthony Berent @ 2009-04-29 18:29 UTC (permalink / raw)
To: 'nagaraju.m', gdb
Nagaraju,
Based on my recent experience of debugging similar problems the "set debug
frame 1" command can be extremely useful in debugging this sort of problem
(although the output is not always easy to understand).
Also remember that gdb does lots of caching, so it will only work out the
stack the first time it needs it (probably before you enter the "bt"
command). To clear this out, so that you see how it is actually working out
the stack, you can use the "flushregs" command.
"info frame" will also tell you more about gdb's understanding of stack
frames than a simple backtrace.
- Anthony
-----Original Message-----
From: gdb-owner@sourceware.org [mailto:gdb-owner@sourceware.org] On Behalf
Of nagaraju.m
Sent: 29 April 2009 07:10
To: gdb@sourceware.org
Subject: back trace issue
Hi,
I am new to gdb. I am using ported gdb to a specific target.
when i am using back trace it is giving only the top most frame.
example:
int add(int x,int y)
{
int z;
z=min(x,y);
return z;
}
int min(int p,int q)
{
int r;
r=max(p,q);
return r;
}
int max(int d,int e)
{
return (d+e);
}
int main()
{
int a, b, c,i;
a = 10;
b =20;
for(i=0;i<10;i++)
c = add(a,b);
return 0;
}
suppose if the control is in max function
(gdb) bt
#0 max (d=10, e=20) at abc.c:15
#1 0x20010348 in ?? ()
can you please suggest me where to provide the information to gdb so
that "back trace" works properly.....
Thanks in advance,
Nagaraju
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: back trace issue
[not found] ` <49FC0D86.6090809@redpinesignals.com>
@ 2009-05-04 16:56 ` Joel Brobecker
0 siblings, 0 replies; 5+ messages in thread
From: Joel Brobecker @ 2009-05-04 16:56 UTC (permalink / raw)
To: nagaraju.m; +Cc: gdb
Nagaraju,
> I identified the function init_extraframe_info [..]-tdep.c file. I
> made frame_info **prev* to point to previous frame and it is
> displaying all the frame..... but it is working only when we start
> the program from main (i.e when we break at main)... suppose if we
> break at some function XYZ called by main then it is not working...
> Is there any other file where we should provide this *prev*
> information......
It's hard to help you with so little information. But the bad news
is that I'm going to be either extremely busy or even unavailable
in the next few weeks. Hopefully someone else might have some leads
for you.
In the meantime, what you can do to learn more about how things work
in GDB is, if you have access to a cheap GNU/Linux machine, or even
a Windows machine, is debug GDB with itself while GDB is computing
a backtrace. It starts at get_prev_frame... You could compare what
the working implementation does with what your implementation does,
and see where things start breaking down on your side.
--
Joel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: back trace issue
@ 2009-05-02 9:21 nagaraju.m
0 siblings, 0 replies; 5+ messages in thread
From: nagaraju.m @ 2009-05-02 9:21 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb
Hi Joel,
I identified the function init_extraframe_info [..]-tdep.c file. I
made frame_info **prev* to point to previous frame and it is displaying
all the frame.....
but it is working only when we start the program from main (i.e
when we break at main)...
suppose if we break at some function XYZ called by main then it
is not working...
Is there any other file where we should provide this *prev*
information......
Thanks,
Nagaraju
Joel Brobecker wrote:
>> can you please suggest me where to provide the information to gdb so
>> that "back trace" works properly.....
>>
>
> Typically, the [...]-tdep file for your architecture will provide
> a set of routines that compute the value of a register in the caller's
> frame (aka the "previous" frame) given a struct frame_info and and
> its associated frame cache. Have a look at some of the -tdep.c files,
> and search for "_prev_register", or "_this_id". That should give you
> a few leads. I'll also mention that there is a new module in
> prologue-value.[hc] that can simplify your job when doing prologue
> analysis. I am mentioning it because it's relatively use a still
> little used.
>
> Also, if your target supports DWARF, you might also want to see if
> the they produce CFI info, in which case a DWARF-based unwinder would
> be able to compute your backtrace without requiring the prologue
> analyzer. I can't remember the names of the routines but you'll need
> to provide a gdbarch routine that converts a dwarf register number
> into the associated GDB register number. And then hook in the dwarf
> unwinder sniffers: dwarf2_append_unwinders. Again, have a look at
> the various -tdep files.
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-05-04 16:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-29 7:53 back trace issue nagaraju.m
2009-04-29 17:01 ` Joel Brobecker
[not found] ` <49FC0D86.6090809@redpinesignals.com>
2009-05-04 16:56 ` Joel Brobecker
2009-04-29 18:29 ` Anthony Berent
2009-05-02 9:21 nagaraju.m
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox