This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Function prologue - Debug info for frame related instruction
- From: "Rohit Arul Raj" <rohitarulraj at gmail dot com>
- To: gcc <gcc at gcc dot gnu dot org>
- Date: Thu, 24 May 2007 16:32:06 +0530
- Subject: Function prologue - Debug info for frame related instruction
Hi all,
I am having some issues while generating debug info for frame related
instructions in fuction_prologue (for GCC 4.1.1) for a private target.
(fr30 & cris backend also showed similiar error while dumping the
debug info).
For my target, while generating the stack frame for local variable, if
the frame size is 2 ^ 17, i have to use a scratch register. In the
scratch register, i can't move immediate values greater the 2 ^ 16.
So to allocate the stack frame, my insn were like this:
insn = emit_insn (gen_movsi ( scratch_reg, GEN_INT (frame_size & 0xffff)));
RTX_FRAME_RELATED_P (insn) = 1; ---------> (1)
insn = emit_insn (gen_hi_word (scratch_reg, scratch_reg,
GEN_INT(frame_size >> 16)));
RTX_FRAME_RELATED_P (insn) = 1; ----------> (2)
insn = emit_insn (gen_subsi3 (stack_pointer_rtx, stack_pointer_rtx,
scratch_reg));
RTX_FRAME_RELATED_P (insn) = 1; -----------> (3)
When the above mentioned code was invoked, i got the following error
"internal compiler error: in dwarf2out_frame_debug_expr, at dwarf2out.c:1714"
As a workaround, i generated a reg note (similiar to alpha & sparc)
for the DWARF code to look through
emit_insn (gen_movsi ( scratch_reg, GEN_INT (frame_size & 0xffff)));
emit_insn (gen_hi_word (scratch_reg, scratch_reg, GEN_INT(frame_size >> 16)));
insn = emit_insn (gen_subsi3 (stack_pointer_rtx, stack_pointer_rtx,
scratch_reg));
RTX_FRAME_RELATED_P (insn) = 1;
REG_NOTES (insn)
= gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR,
gen_rtx_SET (VOIDmode, stack_pointer_rtx,
gen_rtx_PLUS (Pmode, stack_pointer_rtx,
GEN_INT (- frame_size))),
REG_NOTES (insn));
If i do this, my compilation is getting through, But when i try to
dump the debug_info through readelf (fr30-elf-readelf --debug-dump
a.out), i am getting the following error
"readelf: Error: Location lists in .debug_info section aren't in
ascending order!"
This is the sample test program:
int main()
{
int temp;
char new[1<<17];
return 0;
}
1. Is the REG NOTE provided for the dwarf code proper?
2. What is the reason for readelf error?
Regards,
Rohit