[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Obscure .eh_frame debug info question.



On Tue, 19 May 2009 18:24:52 +0200
Jakub Jelinek wrote:

> The GCC patch as examples in the testcase contains both older version which
> disassembled the instructions in the pad and computed virtual return address
> to the spot that branched to the pad (and pad branched to at the end)
> and the actually used version.

Maybe it sheds some light :-). I had sort of been developing the theory
that the stuff I was looking at was trying to describe a frame that
is not exactly a frame, but just some inline code (is that what a "pad" is?),
but I still haven't been able to make any actual sense of the .eh_frame
dumps from readelf (maybe readelf is broken?). For example, trying to
walkback from inside a pthread_mutex_lock call, I find this CIE/FDE
combo:

000000b8 00000014 00000000 CIE
  Version:               1
  Augmentation:          "zR"
  Code alignment factor: 1
  Data alignment factor: -8
  Return address column: 16
  Augmentation data:     1b <= encoding used by addresses in fde
                               (pc relative, signed 4 bytes)

  DW_CFA_def_cfa_sf: r7 (rsp) ofs -128
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop

00001370 0000004c 000012bc FDE cie=000000b8 pc=31906091a1..31906091bc <<==frame1
  DW_CFA_val_expression: r16 (rip) (DW_OP_breg16: 15)
  DW_CFA_advance_loc: 3 to 31906091a4
  DW_CFA_val_expression: r16 (rip) (DW_OP_breg16: 12)
  DW_CFA_advance_loc: 7 to 31906091ab
  DW_CFA_def_cfa_offset: 0
  DW_CFA_val_expression: r16 (rip) (DW_OP_breg16: 5)
  DW_CFA_advance_loc: 4 to 31906091af
  DW_CFA_def_cfa_offset: 128
  DW_CFA_val_expression: r16 (rip) (DW_OP_breg16: 6; DW_OP_const4s: -42046; DW_OP_minus; DW_OP_const4s: -43862; DW_OP_plus)
  DW_CFA_advance_loc: 8 to 31906091b7
  DW_CFA_def_cfa_offset_sf: -128
  DW_CFA_val_expression: r16 (rip) (DW_OP_breg16: -7)
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop

It appears to be defining register 16 by using register 16 as a
base register, with no initial definition of register 16 provided
in the CIE, then there is the really complex expression
for the instruction I'm actually trying to walkback through
at 31906091af - my brain just sort of shuts down when I try
to understand this stuff :-).

Perhaps I should go look at the actual pthread source code that
matches the version loaded on my system, it might make more
sense when I see it with some context around it.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]