Hi, Alexi

Thank you for your guidence, and by referencing your last mail
and other llvm backends, I found setting
BPFMCAsmInfo::SupportsDebugInformation = true in BPFMCAsmInfo.h
and fix some unhandeled switch can make llc output debug_info,
but important information is missing in the result:

bpf:
<1><2a>: Abbrev Number: 2 (DW_TAG_subprogram)
   <2b>   DW_AT_low_pc      : 0x0
   <33>   DW_AT_high_pc     : 0x60
   <37>   Unknown AT value: 3fe7: 1
   <37>   DW_AT_frame_base  : 1 byte block: 5a         (DW_OP_reg10 (r10))
   <39>   DW_AT_name        : (indirect string, offset: 0x0): clang
                               version 3.7.0 (http://llvm.org/git/clang.git..
   <3d>   DW_AT_decl_file   : 1
   <3e>   DW_AT_decl_line   : 3
   <3f>   DW_AT_prototyped  : 1
   <3f>   DW_AT_type        : <0x65>
   <43>   DW_AT_external    : 1
   <43>   Unknown AT value: 3fe1: 1
<2><43>: Abbrev Number: 3 (DW_TAG_formal_parameter)
   <44>   DW_AT_name        : (indirect string, offset: 0x0): clang
                               version 3.7.0 (http://llvm.org/git/clang.git..
   <48>   DW_AT_decl_file   : 1
   <49>   DW_AT_decl_line   : 3
   <4a>   DW_AT_type        : <0x65>

Compares to x86 platform result:

<1><26>: Abbrev Number: 2 (DW_TAG_subprogram)
   <27>   DW_AT_low_pc      : 0x0
   <2b>   DW_AT_high_pc     : 0x16
   <2f>   Unknown AT value: 3fe7: 1
   <2f>   DW_AT_frame_base  : 1 byte block: 54         (DW_OP_reg4 (esp))
   <31>   DW_AT_name        : (indirect string, offset: 0xcf): testprog
   <35>   DW_AT_decl_file   : 1
   <36>   DW_AT_decl_line   : 3
   <37>   DW_AT_prototyped  : 1
   <37>   DW_AT_type        : <0x65>
   <3b>   DW_AT_external    : 1
   <3b>   Unknown AT value: 3fe1: 1
<2><3b>: Abbrev Number: 3 (DW_TAG_formal_parameter)
   <3c>   DW_AT_location    : 2 byte block: 91 4       (DW_OP_fbreg: 4)
   <3f>   DW_AT_name        : (indirect string, offset: 0xdc): myvar_a
   <43>   DW_AT_decl_file   : 1
   <44>   DW_AT_decl_line   : 3
   <45>   DW_AT_type        : <0x65>

The bpf result lacks of DW_AT_location, and DW_AT_name gives no
infomation.

Then I used 'llc print-after*' command to check each pass and
wanted to find by which step the debug infomation is dropped,
things looks similar until the passes between 'verify' and
'expand-isel-pseudos':

x86:
  $ llc -march=x86 --print-before-all -print-after-all
    -stop-after=expand-isel-pseudos test.ll

  # *** IR Dump Before Expand ISel Pseudo-instructions ***:
  # Machine code for function testprog: SSA
  Frame Objects:
  fi#-2: size=4, align=4, fixed, at location [SP+8]
  fi#-1: size=4, align=16, fixed, at location [SP+4]

  BB#0: derived from LLVM BB %entry
  DBG_VALUE <fi#-1>, 0, !"myvar_a", <!15>; line no:3
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  DBG_VALUE <fi#-2>, 0, !"myvar_b", <!15>; line no:3
  %vreg0<def> = MOV32rm <fi#-2>, 1, %noreg, 0, %noreg; mem:LD4[FixedStack-2]
                                                     ; GR32:%vreg0

bpf:
  $ llc -march=bpf --print-before-all -print-after-all
    -stop-after=expand-isel-pseudos test.ll

  # *** IR Dump Before Expand ISel Pseudo-instructions ***:
  # Machine code for function testprog: SSA
  Function Live Ins: %R1 in %vreg0, %R2 in %vreg1

  BB#0: derived from LLVM BB %entry
  Live Ins: %R1 %R2
  %vreg1<def> = COPY %R2; GPR:%vreg1
  %vreg0<def> = COPY %R1; GPR:%vreg0
  %vreg2<def> = LD_imm64 2147483648; GPR:%vreg2

I think maybe this missing 'DBG_VALUE' causes the problem, but
I'm stuck here and hope you can give more advice.

Thank you!

On 2015/7/17 12:27, Alexei Starovoitov wrote:
clang -O2 -emit-llvm -g a.c -S -o a.ll

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to