Hi Claes,
Which architecture are you working with ? Which compiler ?
>
If I change the code so that stack
crawler (crawl_stack_frame()) is always used to setup ‘down´, I
get a full stack.
To get a backtrace, you have:
- the stack walker that uses the .debug_frame information
- the stack crawler which does NOT use .debug_frame
information but tries to guess how registers are saved by going
down
to the epilogue (for instance
/agent/machine/arm/tcf/stack-crawl-arm.c).
If I understand your issue, it seems that the stack walker is not
able to compute the regs down for your frame.
I would start by doing a readelf -wf or readelf -wF.
This is the dump of rules in .debug_frames.
Look at your current PC (instruction pointer). Do you see any
rules for this address ?
Are these rules valid ? They may rely on an implict dwarf rules,
not described in the CIE
(Common information entry). You can take a look in dwarfframe.c /
get_reg.
Here, you can see some architecture specific implied rules.
Are you adding a new architecture ? If so, you may miss some
implied rules.
If you're working with an existing architecture, implied rules
might be incomplete.
You may miss some description in the generated CIE.
Either fix the CIE generation or add implied rules in dwarfframe.c
> reg->rule for return address register is always zero.
You may miss a implied rule here. Take a look at get_reg, case
EM_ARM.
You'll see the default rule for return_address_register there
( if (n == rules.return_address_register) {
...)
You may also take a look here (some notes I took when working on
CFA / Stack / Runcontrol stuff):
https://dev.eclipse.org/mhonarc/lists/tcf-dev/pdfDWqjnobpcm.pdf
First, try to compute the backtrace "by hand" using the dump of
readelf -wF.
That will tell you if the generated rules are correct or not.
Hope it helps a little,
Best Regards,
Xavier.
On 08/02/2016 19:42, Lillieskold, Claes wrote:
Hi,
I’m having problem
generating a stack frame longer than one.
The problem I’m seeing
is in stack_trace.c:trace_stack() where
get_next_stack_frame() returns success,
but doesn’t set
down.has_reg_data, which leads to only one frame being
produced.
If I change the code so
that stack crawler (crawl_stack_frame()) is always used to
setup ‘down´, I get a full stack.
I’m not sure why this
happens and have been debugging
symbols.elf:get_stack_tracing_info() without
understanding why the
number of registers (info->reg_cnt) is zero for the
frame.
No exceptions are thrown
during the call to get_stack_tracing_info().
It seems that the number
of registers in the frame are copied from
dwarf_stack_trace_regs_cnt,
but this is always zero
for me, and when trying to identify where
dwarf_stack_trace_regs_cnt could
be set to non-zero, I
find the function dwarfframe.c:generate_command(), where
calling
functions that can
increase dwarf_stack_trace_regs_cnt is never called because
reg->rule for
return address register
is always zero.
reg =
get_reg(&frame_regs, rules.return_address_register);
if (reg->rule !=
0) {
Sorry about the
imprecise description, but any pointers or suggestions are
very welcome.
Thanks,
Claes
----------------------------------------------------------------------
Intel Sweden AB
Registered Office: Isafjordsgatan 30B, 164 40 Kista, Stockholm,
Sweden
Registration Number: 556189-6027
This e-mail and any attachments may contain confidential
material for
the sole use of the intended recipient(s). Any review or
distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
_______________________________________________
tcf-dev mailing list
tcf-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/tcf-dev