Re: Getting started with clang debuginfo

2020-07-27 Thread Paul Floyd


> On 27 Jul 2020, at 17:39, Konstantin Belousov  wrote:
> 
> On Mon, Jul 27, 2020 at 10:37:53AM -0400, Mark Johnston wrote:
>> On Mon, Jul 27, 2020 at 11:27:40AM +0200, Paul FLOYD wrote:
>>> Hi
>>>  
>>> I'm investigating some of the remaining issues with Valgrind on FreeBSD. 
>>> One of the two remaining major issues that I'm aware of is with Valgrind 
>>> reading dwarf  debuginfo from clang compiled binaries. The problem isn't 
>>> too bad with clang 8 on FreeBSD 12.1. On 13-CURRENT with clang 10 things 
>>> are noticeably worse. For GCC built binaries I'm not aware of any issues.
>>>  
>>> I'm not familiar (yet) with the debuginfo code in Valgrind.
>>>  
>>> To get me going, does anyone have any pointers to
>>> - documentation on clang debuginfo
> Clang generates DWARF which is documented by the DWARF standard(s),
> available at http://dwarfstd.org/


The site seems to be down ATM.

From what I’ve read, DWARF is somewhat flexible and allows for vendor 
extensions. For instance I’ve already seen DW_AT_GNU_all_call_sites and 
DW_GNU_all_tail_call_sites.

> 
>>> - any info on differences wrt GCC (I have seen that GCC does have some 
>>> debuginfo extensions)
> Gcc also generates DWARF.  It is up to the compiler to interpret the standard
> and provide compliant metadata according to it.
> 
> But I would expect that the practical difference or troubles in parsing
> the compiler' output is due to different versions of the used standard.
> Both gcc and clang allow to specify which level of standard should be
> used, see the description of the -gdwarf- switch.
> 
> Different versions of the same compiler might default to different 
> version of DWARF as well.
> 

No, I don’t think that is the problem. Valgrind can read DWARF up to version 4 
(not 5). If it encounters a version it does not know about it says so directly

==1602== Command: ./leak_dwarf5
==1602== 
--1602-- WARNING: Serious error when reading debug info
--1602-- When reading debug info from 
/usr/home/paulf/scratch/vg_examples/leak_dwarf5:
--1602-- Ignoring non-Dwarf2/3/4 block in .debug_info
--1602-- WARNING: Serious error when reading debug info
--1602-- When reading debug info from 
/usr/home/paulf/scratch/vg_examples/leak_dwarf5:
--1602-- parse_CU_Header: is neither DWARF2 nor DWARF3 nor DWARF4
==1602== 

So I suspect that this is a question of dialect rather than version.

A+
Paul

___
freebsd-toolchain@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "freebsd-toolchain-unsubscr...@freebsd.org"


Re: Getting started with clang debuginfo

2020-07-27 Thread Paul Floyd


> On 27 Jul 2020, at 16:37, Mark Johnston  wrote:
> 
> On Mon, Jul 27, 2020 at 11:27:40AM +0200, Paul FLOYD wrote:
>> Hi
>>  
>> I'm investigating some of the remaining issues with Valgrind on FreeBSD. One 
>> of the two remaining major issues that I'm aware of is with Valgrind reading 
>> dwarf  debuginfo from clang compiled binaries. The problem isn't too bad 
>> with clang 8 on FreeBSD 12.1. On 13-CURRENT with clang 10 things are 
>> noticeably worse. For GCC built binaries I'm not aware of any issues.
>>  
>> I'm not familiar (yet) with the debuginfo code in Valgrind.
>>  
>> To get me going, does anyone have any pointers to
>> - documentation on clang debuginfo
>> - any info on differences wrt GCC (I have seen that GCC does have some 
>> debuginfo extensions)
>> - any tools that would be useful like ascii dumps
> 
> Are you asking about tools to dump DWARF info?  I've used dwarfdump
> (from ports) quite a bit in the past.  readelf -w is similar and
> available in the base system.

Hi Mark

Yes, I’m trying to start working out where there are differences

Clang 8 vs clang 10 vs just about any GCC

I’d already seen readelf, but I hadn’t installed dwarfdump.

I just had a look at one example, there’s a bit less info in the clang 
generated file, but otherwise it looks OK.

Next I’ll try comparing a problem clang 10 binary with a clang 8 one.

A+
Paul


___
freebsd-toolchain@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "freebsd-toolchain-unsubscr...@freebsd.org"


Re: Getting started with clang debuginfo

2020-07-27 Thread Konstantin Belousov
On Mon, Jul 27, 2020 at 10:37:53AM -0400, Mark Johnston wrote:
> On Mon, Jul 27, 2020 at 11:27:40AM +0200, Paul FLOYD wrote:
> > Hi
> >  
> > I'm investigating some of the remaining issues with Valgrind on FreeBSD. 
> > One of the two remaining major issues that I'm aware of is with Valgrind 
> > reading dwarf  debuginfo from clang compiled binaries. The problem isn't 
> > too bad with clang 8 on FreeBSD 12.1. On 13-CURRENT with clang 10 things 
> > are noticeably worse. For GCC built binaries I'm not aware of any issues.
> >  
> > I'm not familiar (yet) with the debuginfo code in Valgrind.
> >  
> > To get me going, does anyone have any pointers to
> > - documentation on clang debuginfo
Clang generates DWARF which is documented by the DWARF standard(s),
available at http://dwarfstd.org/

> > - any info on differences wrt GCC (I have seen that GCC does have some 
> > debuginfo extensions)
Gcc also generates DWARF.  It is up to the compiler to interpret the standard
and provide compliant metadata according to it.

But I would expect that the practical difference or troubles in parsing
the compiler' output is due to different versions of the used standard.
Both gcc and clang allow to specify which level of standard should be
used, see the description of the -gdwarf- switch.

Different versions of the same compiler might default to different 
version of DWARF as well.

> > - any tools that would be useful like ascii dumps
> 
> Are you asking about tools to dump DWARF info?  I've used dwarfdump
> (from ports) quite a bit in the past.  readelf -w is similar and
> available in the base system.
___
freebsd-toolchain@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "freebsd-toolchain-unsubscr...@freebsd.org"


Re: Getting started with clang debuginfo

2020-07-27 Thread Mark Johnston
On Mon, Jul 27, 2020 at 11:27:40AM +0200, Paul FLOYD wrote:
> Hi
>  
> I'm investigating some of the remaining issues with Valgrind on FreeBSD. One 
> of the two remaining major issues that I'm aware of is with Valgrind reading 
> dwarf  debuginfo from clang compiled binaries. The problem isn't too bad with 
> clang 8 on FreeBSD 12.1. On 13-CURRENT with clang 10 things are noticeably 
> worse. For GCC built binaries I'm not aware of any issues.
>  
> I'm not familiar (yet) with the debuginfo code in Valgrind.
>  
> To get me going, does anyone have any pointers to
> - documentation on clang debuginfo
> - any info on differences wrt GCC (I have seen that GCC does have some 
> debuginfo extensions)
> - any tools that would be useful like ascii dumps

Are you asking about tools to dump DWARF info?  I've used dwarfdump
(from ports) quite a bit in the past.  readelf -w is similar and
available in the base system.
___
freebsd-toolchain@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "freebsd-toolchain-unsubscr...@freebsd.org"