All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] contrib/plugins/uftrace_symbols.py: fix issues to extract symbol/srcline
@ 2026-04-23 21:38 Pierrick Bouvier
  2026-04-23 21:38 ` [PATCH 1/2] contrib/plugins/uftrace_symbols.py: fix symbols reading Pierrick Bouvier
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Pierrick Bouvier @ 2026-04-23 21:38 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Alex Bennée, Philippe Mathieu-Daudé,
	Matheus Tavares Bernardino

Testing this on hexagon binaries exposed issues with symbols having file but no
line information.

Pierrick Bouvier (2):
  contrib/plugins/uftrace_symbols.py: fix symbols reading
  contrib/plugins/uftrace_symbols.py: handle missing source line from
    addr2line

 contrib/plugins/uftrace_symbols.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

-- 
2.47.3



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/2] contrib/plugins/uftrace_symbols.py: fix symbols reading
  2026-04-23 21:38 [PATCH 0/2] contrib/plugins/uftrace_symbols.py: fix issues to extract symbol/srcline Pierrick Bouvier
@ 2026-04-23 21:38 ` Pierrick Bouvier
  2026-04-24  7:40   ` Manos Pitsidianakis
  2026-04-24  7:41   ` Manos Pitsidianakis
  2026-04-23 21:38 ` [PATCH 2/2] contrib/plugins/uftrace_symbols.py: handle missing source line from addr2line Pierrick Bouvier
  2026-04-24 19:46 ` [PATCH 0/2] contrib/plugins/uftrace_symbols.py: fix issues to extract symbol/srcline Pierrick Bouvier
  2 siblings, 2 replies; 9+ messages in thread
From: Pierrick Bouvier @ 2026-04-23 21:38 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Alex Bennée, Philippe Mathieu-Daudé,
	Matheus Tavares Bernardino

When running this on hexagon binary, we observe some undefined symbols
without any address or size.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 contrib/plugins/uftrace_symbols.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/contrib/plugins/uftrace_symbols.py b/contrib/plugins/uftrace_symbols.py
index 02d1221228c..895fa1a6b7a 100755
--- a/contrib/plugins/uftrace_symbols.py
+++ b/contrib/plugins/uftrace_symbols.py
@@ -36,8 +36,8 @@ def get_symbols(elf_file):
     out = out.strip().split('\n')
     for line in out:
         info = line.split(' ')
-        if len(info) == 3:
-            # missing size information
+        if len(info) < 4:
+            # missing size/address information
             continue
         addr, size, type, name = info
         # add only symbols from .text section
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/2] contrib/plugins/uftrace_symbols.py: handle missing source line from addr2line
  2026-04-23 21:38 [PATCH 0/2] contrib/plugins/uftrace_symbols.py: fix issues to extract symbol/srcline Pierrick Bouvier
  2026-04-23 21:38 ` [PATCH 1/2] contrib/plugins/uftrace_symbols.py: fix symbols reading Pierrick Bouvier
@ 2026-04-23 21:38 ` Pierrick Bouvier
  2026-04-24  7:43   ` Manos Pitsidianakis
  2026-04-24 19:46 ` [PATCH 0/2] contrib/plugins/uftrace_symbols.py: fix issues to extract symbol/srcline Pierrick Bouvier
  2 siblings, 1 reply; 9+ messages in thread
From: Pierrick Bouvier @ 2026-04-23 21:38 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Alex Bennée, Philippe Mathieu-Daudé,
	Matheus Tavares Bernardino

Some symbols have only a file information, and no line information. In
this case, addr2line reports '?'. Replace with 0 to guarantee consistent
data for consumers.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 contrib/plugins/uftrace_symbols.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/contrib/plugins/uftrace_symbols.py b/contrib/plugins/uftrace_symbols.py
index 895fa1a6b7a..a71865805c5 100755
--- a/contrib/plugins/uftrace_symbols.py
+++ b/contrib/plugins/uftrace_symbols.py
@@ -70,7 +70,10 @@ def find_symbols_locations(elf_file, symbols):
         file, line = out[i].split(':')
         # addr2line may return 'line (discriminator [0-9]+)' sometimes,
         # remove this to keep only line number.
-        line = line.split(' ')[0]
+        if line == '?':
+            line = 0
+        else:
+            line = int(line.split(' ')[0])
         s.set_loc(file, line)
 
 class BinaryFile:
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] contrib/plugins/uftrace_symbols.py: fix symbols reading
  2026-04-23 21:38 ` [PATCH 1/2] contrib/plugins/uftrace_symbols.py: fix symbols reading Pierrick Bouvier
@ 2026-04-24  7:40   ` Manos Pitsidianakis
  2026-04-24  7:41   ` Manos Pitsidianakis
  1 sibling, 0 replies; 9+ messages in thread
From: Manos Pitsidianakis @ 2026-04-24  7:40 UTC (permalink / raw)
  To: qemu-devel, Pierrick Bouvier
  Cc: Pierrick Bouvier, Alex Bennée, Philippe Mathieu-Daudé ,
	Matheus Tavares Bernardino

On Fri, 24 Apr 2026 00:38, Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com> wrote:
>When running this on hexagon binary, we observe some undefined symbols
>without any address or size.
>
>Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
>---

Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>

> contrib/plugins/uftrace_symbols.py | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/contrib/plugins/uftrace_symbols.py b/contrib/plugins/uftrace_symbols.py
>index 02d1221228c..895fa1a6b7a 100755
>--- a/contrib/plugins/uftrace_symbols.py
>+++ b/contrib/plugins/uftrace_symbols.py
>@@ -36,8 +36,8 @@ def get_symbols(elf_file):
>     out = out.strip().split('\n')
>     for line in out:
>         info = line.split(' ')
>-        if len(info) == 3:
>-            # missing size information
>+        if len(info) < 4:
>+            # missing size/address information
>             continue
>         addr, size, type, name = info
>         # add only symbols from .text section
>-- 
>2.47.3
>
>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] contrib/plugins/uftrace_symbols.py: fix symbols reading
  2026-04-23 21:38 ` [PATCH 1/2] contrib/plugins/uftrace_symbols.py: fix symbols reading Pierrick Bouvier
  2026-04-24  7:40   ` Manos Pitsidianakis
@ 2026-04-24  7:41   ` Manos Pitsidianakis
  2026-04-24 19:18     ` Pierrick Bouvier
  1 sibling, 1 reply; 9+ messages in thread
From: Manos Pitsidianakis @ 2026-04-24  7:41 UTC (permalink / raw)
  To: qemu-devel, Pierrick Bouvier
  Cc: Pierrick Bouvier, Alex Bennée, Philippe Mathieu-Daudé ,
	Matheus Tavares Bernardino

On Fri, 24 Apr 2026 00:38, Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com> wrote:
>When running this on hexagon binary, we observe some undefined symbols
>without any address or size.
>
>Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
>---
> contrib/plugins/uftrace_symbols.py | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/contrib/plugins/uftrace_symbols.py b/contrib/plugins/uftrace_symbols.py
>index 02d1221228c..895fa1a6b7a 100755
>--- a/contrib/plugins/uftrace_symbols.py
>+++ b/contrib/plugins/uftrace_symbols.py
>@@ -36,8 +36,8 @@ def get_symbols(elf_file):
>     out = out.strip().split('\n')
>     for line in out:
>         info = line.split(' ')
>-        if len(info) == 3:
>-            # missing size information
>+        if len(info) < 4:
>+            # missing size/address information

On a second thought, shouldn't this be != 4? Otherwise the unpacking 
will fail with ValueError: too many values to unpack (expected 4)

>             continue
>         addr, size, type, name = info
>         # add only symbols from .text section
>-- 
>2.47.3
>
>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] contrib/plugins/uftrace_symbols.py: handle missing source line from addr2line
  2026-04-23 21:38 ` [PATCH 2/2] contrib/plugins/uftrace_symbols.py: handle missing source line from addr2line Pierrick Bouvier
@ 2026-04-24  7:43   ` Manos Pitsidianakis
  0 siblings, 0 replies; 9+ messages in thread
From: Manos Pitsidianakis @ 2026-04-24  7:43 UTC (permalink / raw)
  To: qemu-devel, Pierrick Bouvier
  Cc: Pierrick Bouvier, Alex Bennée, Philippe Mathieu-Daudé ,
	Matheus Tavares Bernardino

On Fri, 24 Apr 2026 00:38, Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com> wrote:
>Some symbols have only a file information, and no line information. In
>this case, addr2line reports '?'. Replace with 0 to guarantee consistent
>data for consumers.
>
>Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
>---

Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>

> contrib/plugins/uftrace_symbols.py | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
>diff --git a/contrib/plugins/uftrace_symbols.py b/contrib/plugins/uftrace_symbols.py
>index 895fa1a6b7a..a71865805c5 100755
>--- a/contrib/plugins/uftrace_symbols.py
>+++ b/contrib/plugins/uftrace_symbols.py
>@@ -70,7 +70,10 @@ def find_symbols_locations(elf_file, symbols):
>         file, line = out[i].split(':')
>         # addr2line may return 'line (discriminator [0-9]+)' sometimes,
>         # remove this to keep only line number.
>-        line = line.split(' ')[0]
>+        if line == '?':
>+            line = 0
>+        else:
>+            line = int(line.split(' ')[0])
>         s.set_loc(file, line)
> 
> class BinaryFile:
>-- 
>2.47.3
>
>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] contrib/plugins/uftrace_symbols.py: fix symbols reading
  2026-04-24  7:41   ` Manos Pitsidianakis
@ 2026-04-24 19:18     ` Pierrick Bouvier
  2026-04-24 19:21       ` Pierrick Bouvier
  0 siblings, 1 reply; 9+ messages in thread
From: Pierrick Bouvier @ 2026-04-24 19:18 UTC (permalink / raw)
  To: Manos Pitsidianakis, qemu-devel
  Cc: Alex Benn é e, Philippe Mathieu-Daud é,
	Matheus Tavares Bernardino

On 4/24/2026 12:41 AM, Manos Pitsidianakis wrote:
> On Fri, 24 Apr 2026 00:38, Pierrick Bouvier 
> <pierrick.bouvier@oss.qualcomm.com> wrote:
>> When running this on hexagon binary, we observe some undefined symbols
>> without any address or size.
>>
>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
>> ---
>> contrib/plugins/uftrace_symbols.py | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/contrib/plugins/uftrace_symbols.py b/contrib/plugins/ 
>> uftrace_symbols.py
>> index 02d1221228c..895fa1a6b7a 100755
>> --- a/contrib/plugins/uftrace_symbols.py
>> +++ b/contrib/plugins/uftrace_symbols.py
>> @@ -36,8 +36,8 @@ def get_symbols(elf_file):
>>     out = out.strip().split('\n')
>>     for line in out:
>>         info = line.split(' ')
>> -        if len(info) == 3:
>> -            # missing size information
>> +        if len(info) < 4:
>> +            # missing size/address information
> 
> On a second thought, shouldn't this be != 4? Otherwise the unpacking 
> will fail with ValueError: too many values to unpack (expected 4)
>

I don't expect nm to add new columns, but you're right, it's probably 
safer! I'll change that.
  >>             continue
>>         addr, size, type, name = info
>>         # add only symbols from .text section
>> -- 
>> 2.47.3
>>
>>

Regards,
Pierrick


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] contrib/plugins/uftrace_symbols.py: fix symbols reading
  2026-04-24 19:18     ` Pierrick Bouvier
@ 2026-04-24 19:21       ` Pierrick Bouvier
  0 siblings, 0 replies; 9+ messages in thread
From: Pierrick Bouvier @ 2026-04-24 19:21 UTC (permalink / raw)
  To: Manos Pitsidianakis, qemu-devel
  Cc: Alex Benn é e, Philippe Mathieu-Daud é,
	Matheus Tavares Bernardino

On 4/24/2026 12:18 PM, Pierrick Bouvier wrote:
> On 4/24/2026 12:41 AM, Manos Pitsidianakis wrote:
>> On Fri, 24 Apr 2026 00:38, Pierrick Bouvier 
>> <pierrick.bouvier@oss.qualcomm.com> wrote:
>>> When running this on hexagon binary, we observe some undefined symbols
>>> without any address or size.
>>>
>>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
>>> ---
>>> contrib/plugins/uftrace_symbols.py | 4 ++--
>>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/contrib/plugins/uftrace_symbols.py b/contrib/plugins/ 
>>> uftrace_symbols.py
>>> index 02d1221228c..895fa1a6b7a 100755
>>> --- a/contrib/plugins/uftrace_symbols.py
>>> +++ b/contrib/plugins/uftrace_symbols.py
>>> @@ -36,8 +36,8 @@ def get_symbols(elf_file):
>>>     out = out.strip().split('\n')
>>>     for line in out:
>>>         info = line.split(' ')
>>> -        if len(info) == 3:
>>> -            # missing size information
>>> +        if len(info) < 4:
>>> +            # missing size/address information
>>
>> On a second thought, shouldn't this be != 4? Otherwise the unpacking 
>> will fail with ValueError: too many values to unpack (expected 4)
>>
> 
> I don't expect nm to add new columns, but you're right, it's probably 
> safer! I'll change that.

It seems like python has unpack operator (*_) to deal with that also, 
but I like the idea to force format to be the one we expect strictly.

>   >>             continue
>>>         addr, size, type, name = info
>>>         # add only symbols from .text section
>>> -- 
>>> 2.47.3
>>>
>>>
> 
> Regards,
> Pierrick



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/2] contrib/plugins/uftrace_symbols.py: fix issues to extract symbol/srcline
  2026-04-23 21:38 [PATCH 0/2] contrib/plugins/uftrace_symbols.py: fix issues to extract symbol/srcline Pierrick Bouvier
  2026-04-23 21:38 ` [PATCH 1/2] contrib/plugins/uftrace_symbols.py: fix symbols reading Pierrick Bouvier
  2026-04-23 21:38 ` [PATCH 2/2] contrib/plugins/uftrace_symbols.py: handle missing source line from addr2line Pierrick Bouvier
@ 2026-04-24 19:46 ` Pierrick Bouvier
  2 siblings, 0 replies; 9+ messages in thread
From: Pierrick Bouvier @ 2026-04-24 19:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: Alex Bennée, Philippe Mathieu-Daudé,
	Matheus Tavares Bernardino, Manos Pitsidianakis

On 4/23/2026 2:38 PM, Pierrick Bouvier wrote:
> Testing this on hexagon binaries exposed issues with symbols having file but no
> line information.
> 
> Pierrick Bouvier (2):
>    contrib/plugins/uftrace_symbols.py: fix symbols reading
>    contrib/plugins/uftrace_symbols.py: handle missing source line from
>      addr2line
> 
>   contrib/plugins/uftrace_symbols.py | 9 ++++++---
>   1 file changed, 6 insertions(+), 3 deletions(-)
> 

v2 sent:
https://lore.kernel.org/qemu-devel/20260424194451.1439316-1-pierrick.bouvier@oss.qualcomm.com/T/#t

Regards,
Pierrick


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-04-24 19:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-23 21:38 [PATCH 0/2] contrib/plugins/uftrace_symbols.py: fix issues to extract symbol/srcline Pierrick Bouvier
2026-04-23 21:38 ` [PATCH 1/2] contrib/plugins/uftrace_symbols.py: fix symbols reading Pierrick Bouvier
2026-04-24  7:40   ` Manos Pitsidianakis
2026-04-24  7:41   ` Manos Pitsidianakis
2026-04-24 19:18     ` Pierrick Bouvier
2026-04-24 19:21       ` Pierrick Bouvier
2026-04-23 21:38 ` [PATCH 2/2] contrib/plugins/uftrace_symbols.py: handle missing source line from addr2line Pierrick Bouvier
2026-04-24  7:43   ` Manos Pitsidianakis
2026-04-24 19:46 ` [PATCH 0/2] contrib/plugins/uftrace_symbols.py: fix issues to extract symbol/srcline Pierrick Bouvier

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.