All of lore.kernel.org
 help / color / mirror / Atom feed
From: He Kuang <hekuang@huawei.com>
To: Alexei Starovoitov <ast@plumgrid.com>,
	"Wangnan (F)" <wangnan0@huawei.com>, pi3orama <pi3orama@163.com>,
	Namhyung Kim <namhyung@kernel.org>
Cc: "rostedt@goodmis.org" <rostedt@goodmis.org>,
	"masami.hiramatsu.pt@hitachi.com"
	<masami.hiramatsu.pt@hitachi.com>,
	"acme@kernel.org" <acme@kernel.org>,
	"a.p.zijlstra@chello.nl" <a.p.zijlstra@chello.nl>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"jolsa@kernel.org" <jolsa@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH v4 3/3] bpf: Introduce function for outputing data to perf event
Date: Thu, 23 Jul 2015 19:54:36 +0800	[thread overview]
Message-ID: <55B0D5FC.6050406@huawei.com> (raw)
In-Reply-To: <55A88449.3030008@plumgrid.com>

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


  reply	other threads:[~2015-07-23 11:55 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-10 10:03 [RFC PATCH v4 0/3] Make eBPF programs output data to perf event He Kuang
2015-07-10 10:03 ` [RFC PATCH v4 1/3] tracing/events: Fix wrong sample output by storing array length instead of size He Kuang
2015-07-17 14:32   ` Steven Rostedt
2015-07-17 17:24     ` Sara Rostedt
2015-07-17 18:13     ` Steven Rostedt
2015-07-23 19:36       ` Alex Bennée
2015-07-10 10:03 ` [RFC PATCH v4 2/3] tools lib traceevent: Add function to get dynamic arrays length He Kuang
2015-07-10 10:03 ` [RFC PATCH v4 3/3] bpf: Introduce function for outputing data to perf event He Kuang
2015-07-10 22:10   ` Alexei Starovoitov
2015-07-13  4:36     ` He Kuang
2015-07-13 13:52       ` Namhyung Kim
2015-07-13 14:01         ` pi3orama
2015-07-13 14:09           ` Namhyung Kim
2015-07-13 14:29             ` pi3orama
2015-07-14  1:43               ` Alexei Starovoitov
2015-07-14 11:54                 ` He Kuang
2015-07-17  4:11                   ` Alexei Starovoitov
2015-07-17  4:14                     ` Wangnan (F)
2015-07-17  4:27                       ` Alexei Starovoitov
2015-07-23 11:54                         ` He Kuang [this message]
2015-07-23 20:49                           ` llvm bpf debug info. " Alexei Starovoitov
2015-07-24  3:20                             ` Alexei Starovoitov
2015-07-24  4:16                               ` He Kuang
2015-07-25 10:04                                 ` He Kuang
2015-07-28  2:18                                   ` Alexei Starovoitov
2015-07-29  9:38                                     ` He Kuang
2015-07-29 17:13                                       ` Alexei Starovoitov
2015-07-29 20:00                                         ` pi3orama
2015-07-29 22:20                                           ` Alexei Starovoitov
2015-07-31 10:18                                         ` Wangnan (F)
2015-07-31 10:20                                           ` [LLVM PATCH] BPF: add FRAMEADDR support Wang Nan
2015-07-31 10:21                                           ` [LLVM CLANG PATCH] BPF: add __builtin_bpf_typeid() Wang Nan
2015-07-31 10:48                                           ` llvm bpf debug info. Re: [RFC PATCH v4 3/3] bpf: Introduce function for outputing data to perf event pi3orama
2015-08-03 19:44                                           ` Alexei Starovoitov
2015-08-04  9:01                                             ` Cc llvmdev: " Wangnan (F)
2015-08-05  1:58                                               ` Wangnan (F)
2015-08-05  2:05                                                 ` Wangnan (F)
2015-08-05  6:51                                                   ` [LLVMdev] " Wangnan (F)
2015-08-05  7:11                                                     ` Alexei Starovoitov
2015-08-05  8:28                                                       ` Wangnan (F)
2015-08-06  3:22                                                         ` [llvm-dev] " Alexei Starovoitov
2015-08-06  4:35                                                           ` Wangnan (F)
2015-08-06  6:55                                                             ` Alexei Starovoitov
2015-08-12  2:34                                             ` Wangnan (F)
2015-08-12  4:57                                               ` [llvm-dev] " Alexei Starovoitov
2015-08-12  5:28                                                 ` Wangnan (F)
2015-08-12 13:15                                                   ` Brenden Blanco
2015-08-13  6:24                                                     ` Wangnan (F)
2015-08-05  8:59                                         ` [LLVMdev] Cc llvmdev: " He Kuang
2015-08-06  3:41                                           ` [llvm-dev] " Alexei Starovoitov
2015-08-06  4:31                                             ` Wangnan (F)
2015-08-06  6:50                                               ` Alexei Starovoitov
2015-07-13  8:29   ` Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55B0D5FC.6050406@huawei.com \
    --to=hekuang@huawei.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=ast@plumgrid.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=pi3orama@163.com \
    --cc=rostedt@goodmis.org \
    --cc=wangnan0@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.