public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: "lijunlong at openresty dot com" <sourceware-bugzilla@sourceware.org>
To: systemtap@sourceware.org
Subject: [Bug runtime/29984] New: systemtap can not parse DWARF-5 .debug_line
Date: Tue, 10 Jan 2023 15:20:00 +0000	[thread overview]
Message-ID: <bug-29984-6586@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=29984

            Bug ID: 29984
           Summary: systemtap can not parse DWARF-5 .debug_line
           Product: systemtap
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: runtime
          Assignee: systemtap at sourceware dot org
          Reporter: lijunlong at openresty dot com
  Target Milestone: ---

on fedora34 aarch64, the dwarf version is 5.
the tapset function print_ubacktrace_fileline failed to get the line number.

I stap translater did not generate the .debug_line to the C code.
I found it the following patch will add the .debug_line data to the c code.
But the stap runtime does not support dwarf-5 also.

>
>@@ -7305,6 +7305,12 @@ dump_line_tables_check (void *data, size_t data_len)
> 
>       version  = *((uint16_t *)ptr);
>       ptr += 2;
>+      if (version > 4)
>+        {
>+          if (ptr + 2 > (uint8_t *)data + data_len)
>+            return DWARF_CB_ABORT;
>+          ptr += 2; /* address_size(1byte) and segment_selector_size(1byte)*/
>+        }


Below is my test data of the .debug_line dump by eu-readelf.

```
DWARF section [30] '.debug_line' at offset 0x1191e:

Table at offset 0:

 Length:                         76
 DWARF version:                  5
 Prologue length:                42
 Address size:                   8
 Segment selector size:          0
 Min instruction length:         4
 Max operations per instruction: 1
 Initial value if 'is_stmt':     1
 Line base:                      -5
 Line range:                     14
 Opcode base:                    13

Opcodes:
  [ 1]  0 arguments
  [ 2]  1 argument
  [ 3]  1 argument
  [ 4]  1 argument
  [ 5]  1 argument
  [ 6]  0 arguments
  [ 7]  0 arguments
  [ 8]  0 arguments
  [ 9]  1 argument
  [10]  0 arguments
  [11]  0 arguments
  [12]  1 argument

Directory table:
      [path(line_strp)]
 0     /tmp/t_stap_lS_In4M (7)

File name table:
      [path(line_strp), directory_index(udata)]
 0     test.c (0),  0
 1     test.c (0),  0

Line number statements:
 [    36] set column to 16
 [    38] extended opcode 2:  set address to 0x4005a8 <main>
 [    43] copy
 [    44] set column to 5
 [    46] special opcode 19: address+0 = 0x4005a8 <main>, line+1 = 2
 [    47] set column to 1
 [    49] set 'is_stmt' to 0
 [    4a] special opcode 19: address+0 = 0x4005a8 <main>, line+1 = 3
 [    4b] advance address by 8 to 0x4005b0 <__libc_csu_init>
 [    4d] extended opcode 1:  end of sequence

```

-- 
You are receiving this mail because:
You are the assignee for the bug.

             reply	other threads:[~2023-01-10 15:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-10 15:20 lijunlong at openresty dot com [this message]
2023-10-25 14:38 ` [Bug runtime/29984] " wcohen at redhat dot com

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=bug-29984-6586@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=systemtap@sourceware.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).