[Bug tools/28873] Implement eu-readelf -D

2023-01-16 Thread dichen at redhat dot com via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28873

--- Comment #5 from Di Chen  ---
Created attachment 14600
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14600&action=edit
readelf: display dynamic symtab without section headers

```
# failed to print symtab of a binary which has section headers removed.
$ ./src/readelf -s ~/test/a.out

# it works with "-D" for a binary which has section headers removed.
$ ./src/readelf -Ds ~/test/a.out 
0:   0 NOTYPE  LOCAL  DEFAULTUNDEF 
1:   0 FUNCGLOBAL DEFAULTUNDEF
__libc_start_main@GLIBC_2.34 (2)
2:   0 NOTYPE  WEAK   DEFAULTUNDEF __gmon_start__
```

It works well for binaries which has SYMTAB section right after STRTAB section.
```
$ readelf -Dd ~/test/a.out 

Dynamic section at offset 0x2e60 contains 20 entries:
  TagType Name/Value
 0x0001 (NEEDED) Shared library: [libc.so.6]
 0x000c (INIT)   0x401000
 0x000d (FINI)   0x401124
 0x0019 (INIT_ARRAY) 0x403e50
 0x001b (INIT_ARRAYSZ)   8 (bytes)
 0x001a (FINI_ARRAY) 0x403e58
 0x001c (FINI_ARRAYSZ)   8 (bytes)
 0x6ef5 (GNU_HASH)   0x4003c0
 0x0005 (STRTAB) 0x400428
 0x0006 (SYMTAB) 0x4003e0
 0x000a (STRSZ)  55 (bytes)
 0x000b (SYMENT) 24 (bytes)
 0x0015 (DEBUG)  0x0
 0x0007 (RELA)   0x400488
 0x0008 (RELASZ) 48 (bytes)
 0x0009 (RELAENT)24 (bytes)
 0x6ffe (VERNEED)0x400468
 0x6fff (VERNEEDNUM) 1
 0x6ff0 (VERSYM) 0x400460
 0x (NULL)   0x0
```
Because I use offset difference between SYMTAB and STRTAB to get the symbol
table entry number.
```
  size_t syments = ((offs[i_strtab] - offs[i_symtab]) /
gelf_fsize(ebl->elf, ELF_T_SYM, 1, EV_CURRENT));
```

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug tools/28873] Implement eu-readelf -D

2023-01-16 Thread dichen at redhat dot com via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28873

--- Comment #6 from Di Chen  ---
[Follow the last comment]

For a binary with SYMTAB STRTAB having different order, like upside down, or
having other section in between. eg.

```
$ readelf -Dd /usr/local/go/bin/go

Dynamic section at offset 0x9e5220 contains 19 entries:
  TagType Name/Value
 0x0004 (HASH)   0xb3c3c0
 0x0006 (SYMTAB) 0xb3c880
 0x000b (SYMENT) 24 (bytes)
 0x0005 (STRTAB) 0xb3c660
 0x000a (STRSZ)  531 (bytes)
 0x0007 (RELA)   0xb3bfd8
 0x0008 (RELASZ) 24 (bytes)
 0x0009 (RELAENT)24 (bytes)
 0x0003 (PLTGOT) 0xde5100
 0x0015 (DEBUG)  0x0
 0x0001 (NEEDED) Shared library: [libpthread.so.0]
 0x0001 (NEEDED) Shared library: [libc.so.6]
 0x6ffe (VERNEED)0xb3c360
 0x6fff (VERNEEDNUM) 2
 0x6ff0 (VERSYM) 0xb3c300
 0x0014 (PLTREL) RELA
 0x0002 (PLTRELSZ)   768 (bytes)
 0x0017 (JMPREL) 0xb3bff0
 0x (NULL)   0x0

```

It will mess up the syments (symbol table entry number) calculation.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug debuginfod/27918] add control file for triggered traversal

2021-06-08 Thread dichen at redhat dot com via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=27918

Di Chen  changed:

   What|Removed |Added

 CC||dichen at redhat dot com
   Assignee|unassigned at sourceware dot org   |dichen at redhat dot com

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug debuginfod/27918] add control file for triggered traversal

2021-06-08 Thread dichen at redhat dot com via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=27918

Di Chen  changed:

   What|Removed |Added

   Assignee|dichen at redhat dot com   |unassigned at 
sourceware dot org

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug debuginfod/27917] protect against federation loops

2021-06-08 Thread dichen at redhat dot com via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=27917

Di Chen  changed:

   What|Removed |Added

   Assignee|unassigned at sourceware dot org   |dichen at redhat dot com
 CC||dichen at redhat dot com

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug debuginfod/27917] protect against federation loops

2021-08-25 Thread dichen at redhat dot com via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=27917

--- Comment #2 from Di Chen  ---
Created attachment 13623
  --> https://sourceware.org/bugzilla/attachment.cgi?id=13623&action=edit
Submit a Patch for Bug 27917

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug debuginfod/28242] extend server http-response metrics with result code

2021-09-10 Thread dichen at redhat dot com via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28242

Di Chen  changed:

   What|Removed |Added

 CC||dichen at redhat dot com
   Assignee|unassigned at sourceware dot org   |dichen at redhat dot com

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug debuginfod/28242] extend server http-response metrics with result code

2021-09-20 Thread dichen at redhat dot com via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28242

--- Comment #1 from Di Chen  ---
Specifically, this task aims to add another label to all the http_responses_*
metrics.
And they are expecting to be like this:
http_responses_duration_milliseconds_count{code="200", type="debuginfo"} 91300.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug debuginfod/28242] extend server http-response metrics with artifact-type content

2021-09-21 Thread dichen at redhat dot com via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28242

Di Chen  changed:

   What|Removed |Added

Summary|extend server http-response |extend server http-response
   |metrics with result code|metrics with artifact-type
   ||content

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug libdw/28579] libdwfl api for accessing registers for a thread frame (full register unwinding)

2021-11-11 Thread dichen at redhat dot com via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28579

Di Chen  changed:

   What|Removed |Added

 CC||dichen at redhat dot com
   Assignee|unassigned at sourceware dot org   |dichen at redhat dot com

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug libdw/28579] libdwfl api for accessing registers for a thread frame (full register unwinding)

2021-11-11 Thread dichen at redhat dot com via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28579

Di Chen  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug tools/28873] New: Implement eu-readelf -D

2022-02-08 Thread dichen at redhat dot com via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28873

Bug ID: 28873
   Summary: Implement eu-readelf -D
   Product: elfutils
   Version: unspecified
Status: NEW
  Severity: normal
  Priority: P2
 Component: tools
  Assignee: unassigned at sourceware dot org
  Reporter: dichen at redhat dot com
CC: elfutils-devel at sourceware dot org
  Target Milestone: ---

Currently, eu-readelf is using section headers (in readelf.c:handle_symtab(),
it calls gelf_getshdr() for fetching section headers and get related info like
section size, type, etc) to find the symbol information and print them.

This task will add new options to eu-readelf (-D and --use-dynamic).

And this task aims for printing the symbols by lookup through the program
headers
and the dynamic table. PT_DYNAMIC->DT_* for DT_{GNU_,}HASH, DT_SYMTAB,
DT_STRSZ,
DT_VERNEED, DT_VERSYM(for version information), etc.

previous discussion: https://bugzilla.redhat.com/show_bug.cgi?id=444621

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug tools/28873] Implement eu-readelf -D

2022-02-08 Thread dichen at redhat dot com via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28873

Di Chen  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug tools/28873] Implement eu-readelf -D

2022-02-08 Thread dichen at redhat dot com via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28873

Di Chen  changed:

   What|Removed |Added

   Assignee|unassigned at sourceware dot org   |dichen at redhat dot com

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug tools/28928] New: Wrong dynamic section entry number

2022-02-28 Thread dichen at redhat dot com via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28928

Bug ID: 28928
   Summary: Wrong dynamic section entry number
   Product: elfutils
   Version: unspecified
Status: NEW
  Severity: normal
  Priority: P2
 Component: tools
  Assignee: unassigned at sourceware dot org
  Reporter: dichen at redhat dot com
CC: elfutils-devel at sourceware dot org
  Target Milestone: ---

when using `$ eu-readelf -d {file}` to get the number of dynamic section
entris,
It wrongly counts the padding DT_NULLs as dynamic section entries.
However, DT_NULL Marks end of dynamic section. They should not be counted as
dynamic section entries.

```
$ eu-readelf -d /usr/local/bin/eu-readelf 

Dynamic segment contains 31 entries:
 Addr: 0x00474e00  Offset: 0x073e00  Link to section: [ 7] '.dynstr'
  Type  Value
  NEEDEDShared library: [libdw.so.1]
  NEEDEDShared library: [libelf.so.1]
  NEEDEDShared library: [libc.so.6]
  INIT  0x00404000
  FINI  0x0043d4a8
  INIT_ARRAY0x00474df0
  INIT_ARRAYSZ  8 (bytes)
  FINI_ARRAY0x00474df8
  FINI_ARRAYSZ  8 (bytes)
  GNU_HASH  0x004003a0
  STRTAB0x004016b0
  SYMTAB0x004003f0
  STRSZ 3086 (bytes)
  SYMENT24 (bytes)
  DEBUG 
  PLTGOT0x00475000
  PLTRELSZ  4560 (bytes)
  PLTRELRELA
  JMPREL0x004026a0
  RELA  0x00402610
  RELASZ144 (bytes)
  RELAENT   24 (bytes)
  VERNEED   0x00402450
  VERNEEDNUM3
  VERSYM0x004022be
  NULL  
  NULL  
  NULL  
  NULL  
  NULL  
  NULL  

```

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug tools/28928] Wrong dynamic section entry number

2022-02-28 Thread dichen at redhat dot com via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28928

Di Chen  changed:

   What|Removed |Added

   Assignee|unassigned at sourceware dot org   |dichen at redhat dot com
 Status|NEW |ASSIGNED

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug tools/28928] Wrong dynamic section entry number

2022-03-30 Thread dichen at redhat dot com via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28928

Di Chen  changed:

   What|Removed |Added

 CC||dichen at redhat dot com

--- Comment #1 from Di Chen  ---
Created attachment 14042
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14042&action=edit
[PATCH] readelf: Don't consider padding DT_NULL as dynamic section

when using `$ eu-readelf -d {FILE}` to get the number of dynamic
section entris, it wrongly counts the padding DT_NULLs as dynamic
section entries. However, DT_NULL Marks end of dynamic section.
They should not be considered as dynamic section entries.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug tools/28928] Wrong dynamic section entry number

2022-03-30 Thread dichen at redhat dot com via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28928

Di Chen  changed:

   What|Removed |Added

 Blocks||28873


Referenced Bugs:

https://sourceware.org/bugzilla/show_bug.cgi?id=28873
[Bug 28873] Implement eu-readelf -D
-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug tools/28873] Implement eu-readelf -D

2022-03-30 Thread dichen at redhat dot com via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28873

Di Chen  changed:

   What|Removed |Added

 Depends on||28928


Referenced Bugs:

https://sourceware.org/bugzilla/show_bug.cgi?id=28928
[Bug 28928] Wrong dynamic section entry number
-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug tools/28873] Implement eu-readelf -D

2022-03-31 Thread dichen at redhat dot com via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28873

--- Comment #1 from Di Chen  ---
This Bug depends on Bug 28928 because when calling 
`$ eu-readelf -d --use-dynamic {FILE}`
eu-readelf will need the number of dynamic section entris which involves with
Bug 28928

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug tools/28928] Wrong dynamic section entry number

2022-04-15 Thread dichen at redhat dot com via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28928

--- Comment #3 from Di Chen  ---
Thanks Mark, attachment 14064 looks good to me. You are right, we should let
patch for "-d --use-dynamic" (part of Bug 28873) take care of using
phdr(PT_DYNAMIC) to get the section data.
Because I was considering "-d --use-dynamic", so I mixed this fix with dynamic
phdr -> section data, I agree with using section data directly for this fix.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug libdw/28579] libdwfl api for accessing registers for a thread frame (full register unwinding)

2022-07-03 Thread dichen at redhat dot com via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28579

--- Comment #1 from Di Chen  ---
Created attachment 14193
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14193&action=edit
Submit a Patch for Bug 28579

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug libdw/28579] libdwfl api for accessing registers for a thread frame (full register unwinding)

2022-07-19 Thread dichen at redhat dot com via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28579

--- Comment #3 from Di Chen  ---
Thank you Mark,

I have re-pushed a patch[1] for

1). add dwfl_frame_reg to ELFUTILS_0.188
2). add invalid regno check for dwfl_frame_reg
3). add INTDECL (dwfl_frame_reg)
4). Replace Dwarf_Word with Dwarf_Addr for *val

[1] https://sourceware.org/pipermail/elfutils-devel/2022q3/005206.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug tools/28873] Implement eu-readelf -D

2022-08-08 Thread dichen at redhat dot com via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28873

--- Comment #2 from Di Chen  ---
commit 369c021c6eedae3665c1dbbaa4fc43afbbb698f4
Author: Di Chen 
Date:   Thu Apr 28 19:55:33 2022 +0800

readelf: Support --dynamic with --use-dynamic

Currently, eu-readelf is using section headers to dump the dynamic
segment information (print_dynamic -> handle_dynamic).

This patch adds new options to eu-readelf (-D, --use-dynamic)
for (-d, --dynamic).

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

Signed-off-by: Di Chen 

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug tools/28873] Implement eu-readelf -D

2022-08-08 Thread dichen at redhat dot com via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28873

--- Comment #3 from Di Chen  ---
Finished the first part of the whole task, now eu-readelf can dump the dynamic
segment information from dynamic program header, i.e.

```
$ ./src/readelf -Dd ~/test/eu-readelf-no-shdr 

Dynamic segment contains 26 entries:
 Addr: 0x00474e00  Offset: 0x073e00
  Type  Value
  NEEDEDShared library: [libdw.so.1]
  NEEDEDShared library: [libelf.so.1]
  NEEDEDShared library: [libc.so.6]
  INIT  0x00404000
  FINI  0x0043d4a8
  INIT_ARRAY0x00474df0
  INIT_ARRAYSZ  8 (bytes)
  FINI_ARRAY0x00474df8
  FINI_ARRAYSZ  8 (bytes)
  GNU_HASH  0x004003a0
  STRTAB0x004016b0
  SYMTAB0x004003f0
  STRSZ 3086 (bytes)
  SYMENT24 (bytes)
  DEBUG 
  PLTGOT0x00475000
  PLTRELSZ  4560 (bytes)
  PLTRELRELA
  JMPREL0x004026a0
  RELA  0x00402610
  RELASZ144 (bytes)
  RELAENT   24 (bytes)
  VERNEED   0x00402450
  VERNEEDNUM3
  VERSYM0x004022be
  NULL  

```

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug tools/28873] Implement eu-readelf -D

2022-08-08 Thread dichen at redhat dot com via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28873

--- Comment #4 from Di Chen  ---
Update:

I am working on the second part of the task, make eu-readelf can dump symbol
information from dynamic program header, like $ eu-readelf -Ds {FILE}

-- 
You are receiving this mail because:
You are on the CC list for the bug.