This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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: Preserving the argument spills for GDB


Dear all,

As I continue to work on this I have found something that is surprising.

I wrote this code :

int foo (int argc, int argv)
{
   bar (argv, argc);
   return 0;
}

On my architecture, this is transformed into the following assembly code:

mov r6 = InputReg1
mov InputReg1 = InputReg2
mov InputReg2 = tmp

However, I am of course looking at the debug information, and I was
surprised to see that :

 <2><12f>: Abbrev Number: 6 (DW_TAG_formal_parameter)
  <130>     DW_AT_name        : argc
  <135>     DW_AT_decl_file   : 1
  <136>     DW_AT_decl_line   : 4
  <137>     DW_AT_type        : <af>
  <13b>     DW_AT_location    : 0x38    (location list)
 <2><13f>: Abbrev Number: 6 (DW_TAG_formal_parameter)
  <140>     DW_AT_name        : argv
  <145>     DW_AT_decl_file   : 1
  <146>     DW_AT_decl_line   : 4
  <147>     DW_AT_type        : <af>
  <14b>     DW_AT_location    : 0x6e    (location list)

This is ok, no problems here. But if I look at the locations given for
these variables:
    00000038 00000000 0000000c (DW_OP_InputReg1)
    00000038 0000000c 0000001c (DW_OP_r6)
    00000038 <End of list>
    0000006e 00000000 00000010 (DW_OP_InputReg2)
    0000006e <End of list>

Is there any reason why the compiler does not generate the debug
information showing that the InputReg1 is now in InputReg2 and
vice-versa? It would seem to me that the debugger would need this
information but I may be mistaken.

As always, thanks for your input,
Jc


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