From csosz77@gmail.com  Thu May 12 16:09:05 2016
From: csosz77@gmail.com (Attila Csosz)
Date: Thu, 12 May 2016 18:09:05 +0200
Subject: [Dwarf-Discuss] Is the .text section continious in the ELF file?
Message-ID: <CAMYm8FrmxJd5Zc7dGSCBOyi6uBXzJDdYa1UO2rzqGWZdO+dWaw@mail.gmail.com>

Hi,

Is the .text section continious in the ELF file?
So may there holes in the .text section?
I'd like implement a code coverage profiler but when the .text section is
not continous
I have the collect probably all subprograms with high_pc and low_pc.

Thanks
 Attila
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dwarfstd.org/private.cgi/dwarf-discuss-dwarfstd.org/attachments/20160512/dda3bbab/attachment.htm>


From ane.echeverria@ikusi.com  Mon May 16 07:43:07 2016
From: ane.echeverria@ikusi.com (Ane)
Date: Mon, 16 May 2016 07:43:07 +0000 (UTC)
Subject: [Dwarf-Discuss] Read an .axf file on windows with LibDwarf
Message-ID: <loom.20160516T093627-465@post.gmane.org>

Hello,

I've seen a lot of webpages to have an idea of what the libdwarf library 
can do, but I can't find the way to compile it in windows. The reason to 
do this, is that I want to read and understand an .axf file in my C# 
program that I'm developing in Visual Studio 10 in Windows (I can use VS15 
too). I don't need to debug anything, I only want read an .axf file, so if 
there is a way to do this, please I want to know it, and how to do it.

Thank you,
Ane.



From davea42@earthlink.net  Mon May 16 16:14:46 2016
From: davea42@earthlink.net (DavidA)
Date: Mon, 16 May 2016 09:14:46 -0700
Subject: [Dwarf-Discuss] Read an .axf file on windows with LibDwarf
In-Reply-To: <loom.20160516T093627-465@post.gmane.org>
References: <loom.20160516T093627-465@post.gmane.org>
Message-ID: <5739F1F6.3050804@earthlink.net>

On 05/16/2016 12:43 AM, Ane wrote:
> 've seen a lot of webpages to have an idea of what the libdwarf library 
> can do, but I can't find the way to compile it in windows. The reason to 
> do this, is that I want to read and understand an .axf file in my C# 
> program that I'm developing in Visual Studio 10 in Windows (I can use VS15 
> too). I don't need to debug anything, I only want read an .axf file, so if 
> there is a way to do this, please I want to know it, and how to do it.

There is no simple way.  At least one organization has done so, but
their code is not part of the distribution.

I do not know the details of what that organization did.
I have no idea what a .axf file is.


struct Dwarf_Obj_Access_Methods_s (libdwarf.h)
is probably involved.

Sorry, I have no further information.
David Anderson

--
>From the attic came an unearthly howl. The whole scene had an eerie,
surreal quality, like when you're on vacation in another city and
"Jeopardy" comes on at 7:00 p.m. instead of 7:30. -- Roy Ashley


From ane.echeverria@ikusi.com  Tue May 17 06:47:05 2016
From: ane.echeverria@ikusi.com (Ane)
Date: Tue, 17 May 2016 06:47:05 +0000 (UTC)
Subject: [Dwarf-Discuss] Read an .axf file on windows with LibDwarf
References: <loom.20160516T093627-465@post.gmane.org>
	<5739F1F6.3050804@earthlink.net>
Message-ID: <loom.20160517T083156-705@post.gmane.org>

DavidA <davea42 at ...> writes:

> 
> On 05/16/2016 12:43 AM, Ane wrote:
> > 've seen a lot of webpages to have an idea of what the libdwarf 
library 
> > can do, but I can't find the way to compile it in windows. The 
reason to 
> > do this, is that I want to read and understand an .axf file in my C# 
> > program that I'm developing in Visual Studio 10 in Windows (I can 
use VS15 
> > too). I don't need to debug anything, I only want read an .axf file, 
so if 
> > there is a way to do this, please I want to know it, and how to do 
it.
> 
> There is no simple way.  At least one organization has done so, but
> their code is not part of the distribution.
> 
> I do not know the details of what that organization did.
> I have no idea what a .axf file is.
> 
> struct Dwarf_Obj_Access_Methods_s (libdwarf.h)
> is probably involved.
> 
> Sorry, I have no further information.
> David Anderson
> 
> --
> From the attic came an unearthly howl. The whole scene had an eerie,
> surreal quality, like when you're on vacation in another city and
> "Jeopardy" comes on at 7:00 p.m. instead of 7:30. -- Roy Ashley
> 

An .AXF file is an ARM eXecutable File which has an ELF/DWARF structure. 
I've tried a few libraries (libdwarf, libelf, examples in VC for both of 
them, libelfin in c++) and none of them can I compile correctly in 
windows (it doesn't matter if there was in VS15 / VS10 / as a makefile 
project with MinGW or normal project / just MinGW in command window ... 
).

I've just finded another library in C# "ElfSharp" and it seems to be 
good for reading my .axf file, but I'm looking for decode the DWARF 
sections. If anyone could help me, I'm all ears.

Thanks for the info anyway.

Ane.



From echristo@gmail.com  Tue May 17 07:55:15 2016
From: echristo@gmail.com (Eric Christopher)
Date: Tue, 17 May 2016 07:55:15 +0000
Subject: [Dwarf-Discuss] Read an .axf file on windows with LibDwarf
In-Reply-To: <loom.20160517T083156-705@post.gmane.org>
References: <loom.20160516T093627-465@post.gmane.org>
	<5739F1F6.3050804@earthlink.net>
	<loom.20160517T083156-705@post.gmane.org>
Message-ID: <CALehDX5tEHbVXOigcxKumeAwWEzbT-=tWB62t3=QNPz391zp=g@mail.gmail.com>

FWIW you can use cmake to compile LLVM for windows with a VS project
output. It has a support library for reading dwarf sections, but you may
need to do a little bit of work to make sure it can understand the object
file reading it if it isn't just a plain ELF file.

Feel free to follow up with me or the llvm-dev list if you have any
problems.

Thanks!

-eric

On Mon, May 16, 2016 at 11:47 PM Ane <ane.echeverria at ikusi.com> wrote:

> DavidA <davea42 at ...> writes:
>
> >
> > On 05/16/2016 12:43 AM, Ane wrote:
> > > 've seen a lot of webpages to have an idea of what the libdwarf
> library
> > > can do, but I can't find the way to compile it in windows. The
> reason to
> > > do this, is that I want to read and understand an .axf file in my C#
> > > program that I'm developing in Visual Studio 10 in Windows (I can
> use VS15
> > > too). I don't need to debug anything, I only want read an .axf file,
> so if
> > > there is a way to do this, please I want to know it, and how to do
> it.
> >
> > There is no simple way.  At least one organization has done so, but
> > their code is not part of the distribution.
> >
> > I do not know the details of what that organization did.
> > I have no idea what a .axf file is.
> >
> > struct Dwarf_Obj_Access_Methods_s (libdwarf.h)
> > is probably involved.
> >
> > Sorry, I have no further information.
> > David Anderson
> >
> > --
> > From the attic came an unearthly howl. The whole scene had an eerie,
> > surreal quality, like when you're on vacation in another city and
> > "Jeopardy" comes on at 7:00 p.m. instead of 7:30. -- Roy Ashley
> >
>
> An .AXF file is an ARM eXecutable File which has an ELF/DWARF structure.
> I've tried a few libraries (libdwarf, libelf, examples in VC for both of
> them, libelfin in c++) and none of them can I compile correctly in
> windows (it doesn't matter if there was in VS15 / VS10 / as a makefile
> project with MinGW or normal project / just MinGW in command window ...
> ).
>
> I've just finded another library in C# "ElfSharp" and it seems to be
> good for reading my .axf file, but I'm looking for decode the DWARF
> sections. If anyone could help me, I'm all ears.
>
> Thanks for the info anyway.
>
> Ane.
>
> _______________________________________________
> Dwarf-Discuss mailing list
> Dwarf-Discuss at lists.dwarfstd.org
> http://lists.dwarfstd.org/listinfo.cgi/dwarf-discuss-dwarfstd.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dwarfstd.org/private.cgi/dwarf-discuss-dwarfstd.org/attachments/20160517/e3fb22e7/attachment.htm>


From ane.echeverria@ikusi.com  Tue May 17 08:30:20 2016
From: ane.echeverria@ikusi.com (Ane)
Date: Tue, 17 May 2016 08:30:20 +0000 (UTC)
Subject: [Dwarf-Discuss] Read an .axf file on windows with LibDwarf
References: <loom.20160516T093627-465@post.gmane.org>
	<5739F1F6.3050804@earthlink.net>
	<loom.20160517T083156-705@post.gmane.org>
	<CALehDX5tEHbVXOigcxKumeAwWEzbT-=tWB62t3=QNPz391zp=g@mail.gmail.com>
Message-ID: <loom.20160517T100817-5@post.gmane.org>

Eric Christopher <echristo at ...> writes:

> 
> 
> FWIW you can use cmake to compile LLVM for windows with a VS project 
output. It has a support library for reading dwarf sections, but you may 
need to do a little bit of work to make sure it can understand the 
object file reading it if it isn't just a plain ELF file.
> Feel free to follow up with me or the llvm-dev list if you have any 
problems.
> 
> Thanks!
> 
> -eric
> 
> 
> On Mon, May 16, 2016 at 11:47 PM Ane <ane.echeverria-
2U8bCB4TNbUAvxtiuMwx3w at public.gmane.org> wrote:
> 
> DavidA <davea42 <at> ...> writes:
> >
> > On 05/16/2016 12:43 AM, Ane wrote:
> > > 've seen a lot of webpages to have an idea of what the libdwarf
> library
> > > can do, but I can't find the way to compile it in windows. The
> reason to
> > > do this, is that I want to read and understand an .axf file in my 
C#
> > > program that I'm developing in Visual Studio 10 in Windows (I can
> use VS15
> > > too). I don't need to debug anything, I only want read an .axf 
file,
> so if
> > > there is a way to do this, please I want to know it, and how to do
> it.
> >
> > There is no simple way.? At least one organization has done so, but
> > their code is not part of the distribution.
> >
> > I do not know the details of what that organization did.
> > I have no idea what a .axf file is.
> >
> > struct Dwarf_Obj_Access_Methods_s (libdwarf.h)
> > is probably involved.
> >
> > Sorry, I have no further information.
> > David Anderson
> >
> > --
> > From the attic came an unearthly howl. The whole scene had an eerie,
> > surreal quality, like when you're on vacation in another city and
> > "Jeopardy" comes on at 7:00 p.m. instead of 7:30. -- Roy Ashley
> >
> An .AXF file is an ARM eXecutable File which has an ELF/DWARF 
structure.
> I've tried a few libraries (libdwarf, libelf, examples in VC for both 
of
> them, libelfin in c++) and none of them can I compile correctly in
> windows (it doesn't matter if there was in VS15 / VS10 / as a makefile
> project with MinGW or normal project / just MinGW in command window 
...
> ).
> I've just finded another library in C# "ElfSharp" and it seems to be
> good for reading my .axf file, but I'm looking for decode the DWARF
> sections. If anyone could help me, I'm all ears.
> Thanks for the info anyway.
> Ane.
> _______________________________________________
> Dwarf-Discuss mailing listDwarf-Discuss-
94Vl1yqA2cm9tDkVm8dgcB2eb7JE58TQ at public.gmane.orghttp://lists.dwarfstd.o
rg/listinfo.cgi/dwarf-discuss-dwarfstd.org
> 
> 
> 
> 
> _______________________________________________
> Dwarf-Discuss mailing list
> Dwarf-Discuss at ...
> http://lists.dwarfstd.org/listinfo.cgi/dwarf-discuss-dwarfstd.org
> 

I think I haven't explained myself very well. I want to do everything in 
Windows 7, and as far as I understood about LLVM, is for Unix Systems. I 
don't need the compiler to go faster, I need just compiling the source 
code, or at least, find some code which has no dependency of Unix 
libraries. Maybe I didn't understand your idea of doing it, so if it is 
so, please could you explain it to me again? Did you mean this about 
LLVM http://llvm.org/docs/GettingStartedVS.html ?

Rigth now I'm looking for DWARF info in this library 
http://elfsharp.hellsgate.pl/examples.shtml , and I just read a section 
content but all of them are bytes and I need to read them as a dwarf 
info (and I'm thinking how to decode that part). If I haven't explained 
it better, please let me know.

Thanks for the help,
Ane.


From echristo@gmail.com  Tue May 17 08:39:04 2016
From: echristo@gmail.com (Eric Christopher)
Date: Tue, 17 May 2016 08:39:04 +0000
Subject: [Dwarf-Discuss] Read an .axf file on windows with LibDwarf
In-Reply-To: <loom.20160517T100817-5@post.gmane.org>
References: <loom.20160516T093627-465@post.gmane.org>
	<5739F1F6.3050804@earthlink.net>
	<loom.20160517T083156-705@post.gmane.org>
	<CALehDX5tEHbVXOigcxKumeAwWEzbT-=tWB62t3=QNPz391zp=g@mail.gmail.com>
	<loom.20160517T100817-5@post.gmane.org>
Message-ID: <CALehDX63RUu8-6x-bo6nJzr7ft0zeLmr3UrUi2AUL+pYBxQJdg@mail.gmail.com>

On Tue, May 17, 2016, 1:30 AM Ane <ane.echeverria at ikusi.com> wrote:

> Eric Christopher <echristo at ...> writes:
>
> >
> >
> > FWIW you can use cmake to compile LLVM for windows with a VS project
> output. It has a support library for reading dwarf sections, but you may
> need to do a little bit of work to make sure it can understand the
> object file reading it if it isn't just a plain ELF file.
> > Feel free to follow up with me or the llvm-dev list if you have any
> problems.
> >
> > Thanks!
> >
> > -eric
> >
> >
> > On Mon, May 16, 2016 at 11:47 PM Ane <ane.echeverria-
> 2U8bCB4TNbUAvxtiuMwx3w at public.gmane.org> wrote:
> >
> > DavidA <davea42 <at> ...> writes:
> > >
> > > On 05/16/2016 12:43 AM, Ane wrote:
> > > > 've seen a lot of webpages to have an idea of what the libdwarf
> > library
> > > > can do, but I can't find the way to compile it in windows. The
> > reason to
> > > > do this, is that I want to read and understand an .axf file in my
> C#
> > > > program that I'm developing in Visual Studio 10 in Windows (I can
> > use VS15
> > > > too). I don't need to debug anything, I only want read an .axf
> file,
> > so if
> > > > there is a way to do this, please I want to know it, and how to do
> > it.
> > >
> > > There is no simple way.  At least one organization has done so, but
> > > their code is not part of the distribution.
> > >
> > > I do not know the details of what that organization did.
> > > I have no idea what a .axf file is.
> > >
> > > struct Dwarf_Obj_Access_Methods_s (libdwarf.h)
> > > is probably involved.
> > >
> > > Sorry, I have no further information.
> > > David Anderson
> > >
> > > --
> > > From the attic came an unearthly howl. The whole scene had an eerie,
> > > surreal quality, like when you're on vacation in another city and
> > > "Jeopardy" comes on at 7:00 p.m. instead of 7:30. -- Roy Ashley
> > >
> > An .AXF file is an ARM eXecutable File which has an ELF/DWARF
> structure.
> > I've tried a few libraries (libdwarf, libelf, examples in VC for both
> of
> > them, libelfin in c++) and none of them can I compile correctly in
> > windows (it doesn't matter if there was in VS15 / VS10 / as a makefile
> > project with MinGW or normal project / just MinGW in command window
> ...
> > ).
> > I've just finded another library in C# "ElfSharp" and it seems to be
> > good for reading my .axf file, but I'm looking for decode the DWARF
> > sections. If anyone could help me, I'm all ears.
> > Thanks for the info anyway.
> > Ane.
> > _______________________________________________
> > Dwarf-Discuss mailing listDwarf-Discuss-
> 94Vl1yqA2cm9tDkVm8dgcB2eb7JE58TQ at public.gmane.orghttp://lists.dwarfstd.o
> rg/listinfo.cgi/dwarf-discuss-dwarfstd.org
> >
> >
> >
> >
> > _______________________________________________
> > Dwarf-Discuss mailing list
> > Dwarf-Discuss at ...
> > http://lists.dwarfstd.org/listinfo.cgi/dwarf-discuss-dwarfstd.org
> >
>
> I think I haven't explained myself very well. I want to do everything in
> Windows 7, and as far as I understood about LLVM, is for Unix Systems. I
>

You have misunderstood. LLVM supports both running on and targeting windows
systems.


don't need the compiler to go faster, I need just compiling the source
> code, or at least, find some code which has no dependency of Unix
> libraries. Maybe I didn't understand your idea of doing it, so if it is
> so, please could you explain it to me again? Did you mean this about
> LLVM http://llvm.org/docs/GettingStartedVS.html ?
>


That page isn't the best, that's why I suggested mailing llvm-dev with any
problems. That said, i think it should work to build for your needs.

-eric


> Rigth now I'm looking for DWARF info in this library
> http://elfsharp.hellsgate.pl/examples.shtml , and I just read a section
> content but all of them are bytes and I need to read them as a dwarf
> info (and I'm thinking how to decode that part). If I haven't explained
> it better, please let me know.
>
> Thanks for the help,
> Ane.
> _______________________________________________
> Dwarf-Discuss mailing list
> Dwarf-Discuss at lists.dwarfstd.org
> http://lists.dwarfstd.org/listinfo.cgi/dwarf-discuss-dwarfstd.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dwarfstd.org/private.cgi/dwarf-discuss-dwarfstd.org/attachments/20160517/15da4811/attachment-0001.htm>


From dwarf-discuss@tomseddon.plus.com  Tue May 17 12:38:22 2016
From: dwarf-discuss@tomseddon.plus.com (Tom Seddon)
Date: Tue, 17 May 2016 13:38:22 +0100
Subject: [Dwarf-Discuss] Read an .axf file on windows with LibDwarf
In-Reply-To: <loom.20160516T093627-465@post.gmane.org>
References: <loom.20160516T093627-465@post.gmane.org>
Message-ID: <6679a0fa-8e14-6e78-3396-8c8a6ade68cf@tomseddon.plus.com>

You could try MSYS2 or cygwin for building autotools stuff on Windows. I 
don't know how easy it would be to interact with libdwarf from .NET 
directly - possibly not very. But at a pinch maybe you could use 
dwarfdump, capture its output using the Process class, and extract the 
data of interest from C#.

I've previously had success doing this sort of thing using MSYS2's 
predecessor, MSYS. (I used it to build a set of GNU binutils that 
supported PowerPC as well as x86.) But I believe MSYS2 and cygwin work 
slightly differently from MSYS, and it's possible that could make a 
difference.

Regards,

--Tom Seddon

On 16/05/2016 08:43, Ane wrote:
> Hello,
>
> I've seen a lot of webpages to have an idea of what the libdwarf library
> can do, but I can't find the way to compile it in windows. The reason to
> do this, is that I want to read and understand an .axf file in my C#
> program that I'm developing in Visual Studio 10 in Windows (I can use VS15
> too). I don't need to debug anything, I only want read an .axf file, so if
> there is a way to do this, please I want to know it, and how to do it.
>
> Thank you,
> Ane.
>
> _______________________________________________
> Dwarf-Discuss mailing list
> Dwarf-Discuss at lists.dwarfstd.org
> http://lists.dwarfstd.org/listinfo.cgi/dwarf-discuss-dwarfstd.org
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dwarfstd.org/private.cgi/dwarf-discuss-dwarfstd.org/attachments/20160517/fc203c74/attachment.htm>


From ane.echeverria@ikusi.com  Wed May 18 12:37:48 2016
From: ane.echeverria@ikusi.com (Ane)
Date: Wed, 18 May 2016 12:37:48 +0000 (UTC)
Subject: [Dwarf-Discuss] Read an .axf file on windows with LibDwarf
References: <loom.20160516T093627-465@post.gmane.org>
	<6679a0fa-8e14-6e78-3396-8c8a6ade68cf@tomseddon.plus.com>
Message-ID: <loom.20160518T131812-343@post.gmane.org>

Tom Seddon <dwarf-discuss at ...> writes:

> 
> 
>     You could try MSYS2 or cygwin for building autotools stuff on
>     Windows. I don't know how easy it would be to interact with 
libdwarf
>     from .NET directly - possibly not very. But at a pinch maybe you
>     could use dwarfdump, capture its output using the Process class, 
and
>     extract the data of interest from C#.
>     I've previously had success doing this sort of thing using MSYS2's
>     predecessor, MSYS. (I used it to build a set of GNU binutils that
>     supported PowerPC as well as x86.) But I believe MSYS2 and cygwin
>     work slightly differently from MSYS, and it's possible that could
>     make a difference.
>     Regards,--Tom Seddon
>     On 16/05/2016 08:43, Ane wrote:
> 
>     
>       Hello,
> 
> I've seen a lot of webpages to have an idea of what the libdwarf 
library 
> can do, but I can't find the way to compile it in windows. The reason 
to 
> do this, is that I want to read and understand an .axf file in my C# 
> program that I'm developing in Visual Studio 10 in Windows (I can use 
VS15 
> too). I don't need to debug anything, I only want read an .axf file, 
so if 
> there is a way to do this, please I want to know it, and how to do it.
> 
> Thank you,
> Ane.
> 
> _______________________________________________
> Dwarf-Discuss mailing list
> Dwarf-Discuss at lists.dwarfstd.org
> http://lists.dwarfstd.org/listinfo.cgi/dwarf-discuss-dwarfstd.org


I've read on webpages that some people could compile libdwarf with 
visual studio, but I couldn't find how they do it. I've tried almost 
everything, also I tried to compile the library on visual studio with 
mingw's make but it doesn't compile correctly.
I think my last option is to read the .axf file through readelf 
(binutils) as an .exe and get the output to handle it on the C# program. 
I would like not to need more programs to do this, because the C# 
program can be developed on multiple computers. 

Otherwise, if someone knows how to get what in the following webpage is 
asked:

http://stackoverflow.com/questions/24143326/extract-detailed-symbol-
information-struct-members-from-elf-file-compiled-with

Thanks for the help,
Ane.



From francesco.zappa.nardelli@gmail.com  Mon May 23 21:10:34 2016
From: francesco.zappa.nardelli@gmail.com (Francesco Zappa Nardelli)
Date: Mon, 23 May 2016 23:10:34 +0200
Subject: [Dwarf-Discuss] doubt parsing CIE in eh_frame
Message-ID: <CALCBA_HPzpDraJj7QAT7tRrOohY7Jj5qRwri4t32otkLNUX7qw@mail.gmail.com>

Dear DWARF-discuss

I am writing a parser of eh-frame informations and I have a doubt about a
behaviour of readelf.

On a (statically linked) binary readelf reports the following eh-frame CIE
entry:

00006f38 0000000000000014 00000000 CIE
 Version:               1
 Augmentation:          "zRS"
 Code alignment factor: 1
 Data alignment factor: -8
 Return address column: 16
 Augmentation data:     1b

 DW_CFA_nop
 DW_CFA_nop
 DW_CFA_nop
 DW_CFA_nop
 DW_CFA_nop
 DW_CFA_nop

and readelf interprets this bytecode as:

00006f38 0000000000000014 00000000 CIE "zRS" cf=1 df=-8 ra=16
  LOC           CFA
0000000000000000 rax+0

My doubt is: where does the rax+0 come from?  Is rax some kind of a default
for CFA computation?  The bytecode does not provide any real instruction
here and my parser/interpreter fails with ?undefined cfa?.

Thank in advance.

-francesco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dwarfstd.org/private.cgi/dwarf-discuss-dwarfstd.org/attachments/20160523/12d0132a/attachment.htm>


From davea42@linuxmail.org  Mon May 23 23:34:01 2016
From: davea42@linuxmail.org (David Anderson)
Date: Mon, 23 May 2016 16:34:01 -0700
Subject: [Dwarf-Discuss] doubt parsing CIE in eh_frame
In-Reply-To: <CALCBA_HPzpDraJj7QAT7tRrOohY7Jj5qRwri4t32otkLNUX7qw@mail.gmail.com>
References: <CALCBA_HPzpDraJj7QAT7tRrOohY7Jj5qRwri4t32otkLNUX7qw@mail.gmail.com>
Message-ID: <57439369.3090200@linuxmail.org>

On 05/23/2016 02:10 PM, Francesco Zappa Nardelli wrote:
> Dear DWARF-discuss
>
> I am writing a parser of eh-frame informations and I have a doubt about
> a behaviour of readelf.
>
> On a (statically linked) binary readelf reports the following eh-frame
> CIE entry:
>
> 00006f38 0000000000000014 00000000 CIE
>  Version:               1
>  Augmentation:          "zRS"
>  Code alignment factor: 1
>  Data alignment factor: -8
>  Return address column: 16
>  Augmentation data:     1b
>
>  DW_CFA_nop
>  DW_CFA_nop
>  DW_CFA_nop
>  DW_CFA_nop
>  DW_CFA_nop
>  DW_CFA_nop
>
> and readelf interprets this bytecode as:
>
> 00006f38 0000000000000014 00000000 CIE "zRS" cf=1 df=-8 ra=16
>   LOC           CFA
> 0000000000000000 rax+0
>
> My doubt is: where does the rax+0 come from?  Is rax some kind of a

Register names are not specified by the DWARF std.
Nor are the DWARF numbers that identify registers.
Implementations turn the DWARF register numbers (ABI specified) into
strings (names specified by the ABI)..

Note that .eh_frame is a GNU invention so not formally part of DWARF
at all.  Though .eh_frame is mostly identical to .debug_frame.

Hope this makes sense.  Does not answer your question (sorry).

If you could produce a small object file which
has the above and that can be made public
I would love to have it in my libdwarf regression test suite :-)
Email it (or the location of the file
on the web) to libdwarf-list   'at'   linuxmail =dot= org
David Anderson


From francesco.zappa.nardelli@gmail.com  Tue May 24 07:46:58 2016
From: francesco.zappa.nardelli@gmail.com (Francesco Zappa Nardelli)
Date: Tue, 24 May 2016 09:46:58 +0200
Subject: [Dwarf-Discuss] doubt parsing CIE in eh_frame
In-Reply-To: <57439369.3090200@linuxmail.org>
References: <CALCBA_HPzpDraJj7QAT7tRrOohY7Jj5qRwri4t32otkLNUX7qw@mail.gmail.com>
	<57439369.3090200@linuxmail.org>
Message-ID: <CALCBA_Go7AdHg=urPocHuhCo9xinCK6dBUjfHVXaPxhGqoR0jg@mail.gmail.com>

Dear David and all

If you could produce a small object file..


Invoking readelf on /lib/x86_64-linux-gnu/libc.so.6 is enough to observe
this (I am on Ubuntu 14.04.3 LTS (GNU/Linux 3.13.0-68-generic x86_64)):

$ readelf -wf /lib/x86_64-linux-gnu/libc.so.6 (and search for S in the
augmentation string)

00002690 0000000000000014 00000000 CIE
  Version:               1
  Augmentation:          "zRS"
  Code alignment factor: 1
  Data alignment factor: -8
  Return address column: 16
  Augmentation data:     1b

  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop

while readelf -wF gives:

00002690 0000000000000014 00000000 CIE "zRS" cf=1 df=-8 ra=16
   LOC           CFA
0000000000000000 rax+0

Remark: objdump emits the same output.

I believe that this is the unwinding information for the longjmp call, and
the unwinding infos are computed from a structure on the stack representing
the processor state to which we want longjmp:

000026a8 000000000000007c 0000001c FDE cie=00002690
pc=0000000000036d3f..0000000000036d49
   LOC           CFA
  rax   rdx   rcx   rbx   rsi   rdi   rbp   rsp   r8    r9
  r10   r11   r12   r13   r14   r15   ra
0000000000036d3f exp
  exp   exp   exp   exp   exp   exp   exp   exp   exp   exp   exp
exp   exp   exp   exp   exp
exp

000026a8 000000000000007c 0000001c FDE cie=00002690
pc=0000000000036d3f..0000000000036d49
  DW_CFA_def_cfa_expression (DW_OP_breg7 (rsp): 160; DW_OP_deref)
  DW_CFA_expression: r8 (r8) (DW_OP_breg7 (rsp): 40)
  DW_CFA_expression: r9 (r9) (DW_OP_breg7 (rsp): 48)
  ? (and so on for all registers)?

So it makes sense to ignore whatever in the CIE here.

I am just surprised that readelf/objdump prints ?rax+0?: I would have
expected ?u? as the CFA in the CIE is never computed by the CIE bytecode.
Wonder if I am missing something...

-francesco

On Tue, May 24, 2016 at 1:34 AM, David Anderson <davea42 at linuxmail.org>
wrote:

> On 05/23/2016 02:10 PM, Francesco Zappa Nardelli wrote:
> > Dear DWARF-discuss
> >
> > I am writing a parser of eh-frame informations and I have a doubt about
> > a behaviour of readelf.
> >
> > On a (statically linked) binary readelf reports the following eh-frame
> > CIE entry:
> >
> > 00006f38 0000000000000014 00000000 CIE
> >  Version:               1
> >  Augmentation:          "zRS"
> >  Code alignment factor: 1
> >  Data alignment factor: -8
> >  Return address column: 16
> >  Augmentation data:     1b
> >
> >  DW_CFA_nop
> >  DW_CFA_nop
> >  DW_CFA_nop
> >  DW_CFA_nop
> >  DW_CFA_nop
> >  DW_CFA_nop
> >
> > and readelf interprets this bytecode as:
> >
> > 00006f38 0000000000000014 00000000 CIE "zRS" cf=1 df=-8 ra=16
> >   LOC           CFA
> > 0000000000000000 rax+0
> >
> > My doubt is: where does the rax+0 come from?  Is rax some kind of a
>
> Register names are not specified by the DWARF std.
> Nor are the DWARF numbers that identify registers.
> Implementations turn the DWARF register numbers (ABI specified) into
> strings (names specified by the ABI)..
>
> Note that .eh_frame is a GNU invention so not formally part of DWARF
> at all.  Though .eh_frame is mostly identical to .debug_frame.
>
> Hope this makes sense.  Does not answer your question (sorry).
>
> If you could produce a small object file which
> has the above and that can be made public
> I would love to have it in my libdwarf regression test suite :-)
> Email it (or the location of the file
> on the web) to libdwarf-list   'at'   linuxmail =dot= org
> David Anderson
> _______________________________________________
> Dwarf-Discuss mailing list
> Dwarf-Discuss at lists.dwarfstd.org
> http://lists.dwarfstd.org/listinfo.cgi/dwarf-discuss-dwarfstd.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dwarfstd.org/private.cgi/dwarf-discuss-dwarfstd.org/attachments/20160524/037bf75a/attachment.htm>


From jakub@redhat.com  Tue May 24 08:07:47 2016
From: jakub@redhat.com (Jakub Jelinek)
Date: Tue, 24 May 2016 10:07:47 +0200
Subject: [Dwarf-Discuss] doubt parsing CIE in eh_frame
In-Reply-To: <CALCBA_Go7AdHg=urPocHuhCo9xinCK6dBUjfHVXaPxhGqoR0jg@mail.gmail.com>
References: <CALCBA_HPzpDraJj7QAT7tRrOohY7Jj5qRwri4t32otkLNUX7qw@mail.gmail.com>
	<57439369.3090200@linuxmail.org>
	<CALCBA_Go7AdHg=urPocHuhCo9xinCK6dBUjfHVXaPxhGqoR0jg@mail.gmail.com>
Message-ID: <20160524080747.GC28550@tucnak.redhat.com>

On Tue, May 24, 2016 at 09:46:58AM +0200, Francesco Zappa Nardelli wrote:
> Dear David and all
> 
> If you could produce a small object file..
> 
> 
> Invoking readelf on /lib/x86_64-linux-gnu/libc.so.6 is enough to observe
> this (I am on Ubuntu 14.04.3 LTS (GNU/Linux 3.13.0-68-generic x86_64)):
> 
> $ readelf -wf /lib/x86_64-linux-gnu/libc.so.6 (and search for S in the
> augmentation string)

The only zRS I see in my libc.so.6 is the __restore_rt trampoline in
sigaction.c.
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/x86_64/sigaction.c;h=71ac05c4bc01c560935f3bbd4306e3aeacb6d9be;hb=HEAD

The CIE doesn't contain any (non-nop) instructions, so guess readelf -wF's
default for no instructions at all is the first register.  Does it really
matter?  The (only) FDE that refers to this CIE defines the CFA expression
as the very first thing in it, so it isn't really ever used.

Though, perhaps you might want to file a request to move the do_cfa_expr
macro into the CIE from the FDE - I think
DW_CFA_def_cfa_expression (DW_OP_breg7 (rsp): 160; DW_OP_deref)
is 6 bytes and therefore would fit exactly into the padding at the end of
the CIE.

> 00002690 0000000000000014 00000000 CIE
>   Version:               1
>   Augmentation:          "zRS"
>   Code alignment factor: 1
>   Data alignment factor: -8
>   Return address column: 16
>   Augmentation data:     1b
> 
>   DW_CFA_nop
>   DW_CFA_nop
>   DW_CFA_nop
>   DW_CFA_nop
>   DW_CFA_nop
>   DW_CFA_nop
> 
> while readelf -wF gives:
> 
> 00002690 0000000000000014 00000000 CIE "zRS" cf=1 df=-8 ra=16
>    LOC           CFA
> 0000000000000000 rax+0
> 
> Remark: objdump emits the same output.
> 
> I believe that this is the unwinding information for the longjmp call, and
> the unwinding infos are computed from a structure on the stack representing
> the processor state to which we want longjmp:
> 
> 000026a8 000000000000007c 0000001c FDE cie=00002690
> pc=0000000000036d3f..0000000000036d49
>    LOC           CFA
>   rax   rdx   rcx   rbx   rsi   rdi   rbp   rsp   r8    r9
>   r10   r11   r12   r13   r14   r15   ra
> 0000000000036d3f exp
>   exp   exp   exp   exp   exp   exp   exp   exp   exp   exp   exp
> exp   exp   exp   exp   exp
> exp
> 
> 000026a8 000000000000007c 0000001c FDE cie=00002690
> pc=0000000000036d3f..0000000000036d49
>   DW_CFA_def_cfa_expression (DW_OP_breg7 (rsp): 160; DW_OP_deref)
>   DW_CFA_expression: r8 (r8) (DW_OP_breg7 (rsp): 40)
>   DW_CFA_expression: r9 (r9) (DW_OP_breg7 (rsp): 48)
>   ? (and so on for all registers)?
> 
> So it makes sense to ignore whatever in the CIE here.
> 
> I am just surprised that readelf/objdump prints ?rax+0?: I would have
> expected ?u? as the CFA in the CIE is never computed by the CIE bytecode.
> Wonder if I am missing something...

	Jakub


From francesco.zappa.nardelli@gmail.com  Tue May 24 13:36:47 2016
From: francesco.zappa.nardelli@gmail.com (Francesco Zappa Nardelli)
Date: Tue, 24 May 2016 15:36:47 +0200
Subject: [Dwarf-Discuss] doubt parsing CIE in eh_frame
In-Reply-To: <20160524080747.GC28550@tucnak.redhat.com>
References: <CALCBA_HPzpDraJj7QAT7tRrOohY7Jj5qRwri4t32otkLNUX7qw@mail.gmail.com>
	<57439369.3090200@linuxmail.org>
	<CALCBA_Go7AdHg=urPocHuhCo9xinCK6dBUjfHVXaPxhGqoR0jg@mail.gmail.com>
	<20160524080747.GC28550@tucnak.redhat.com>
Message-ID: <CALCBA_EgNAwP43=FGSAJ51T7ewtFMaJdof-ncuJbCgZq8B_rSQ@mail.gmail.com>

Dear Jakub

The only zRS I see in my libc.so.6 is the __restore_rt trampoline in
sigaction.c.
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/x86_64/sigaction.c;h=71ac05c4bc01c560935f3bbd4306e3aeacb6d9be;hb=HEAD

The CIE doesn't contain any (non-nop) instructions, so guess readelf -wF's
default for no instructions at all is the first register.  Does it really
matter?


I do agree that it does not matter, I was just surprised by the readelf
behaviour and I wanted to be sure I was not missing something important.
Thank you all for the help, problem solved.

Though, perhaps you might want to file a request to move the do_cfa_expr
macro into the CIE from the FDE - I think
DW_CFA_def_cfa_expression (DW_OP_breg7 (rsp): 160; DW_OP_deref)
is 6 bytes and therefore would fit exactly into the padding at the end of
the CIE.


Ah, clever!

-francesco

On Tue, May 24, 2016 at 10:07 AM, Jakub Jelinek <jakub at redhat.com> wrote:

> On Tue, May 24, 2016 at 09:46:58AM +0200, Francesco Zappa Nardelli wrote:
> > Dear David and all
> >
> > If you could produce a small object file..
> >
> >
> > Invoking readelf on /lib/x86_64-linux-gnu/libc.so.6 is enough to observe
> > this (I am on Ubuntu 14.04.3 LTS (GNU/Linux 3.13.0-68-generic x86_64)):
> >
> > $ readelf -wf /lib/x86_64-linux-gnu/libc.so.6 (and search for S in the
> > augmentation string)
>
> The only zRS I see in my libc.so.6 is the __restore_rt trampoline in
> sigaction.c.
>
> https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/x86_64/sigaction.c;h=71ac05c4bc01c560935f3bbd4306e3aeacb6d9be;hb=HEAD
>
> The CIE doesn't contain any (non-nop) instructions, so guess readelf -wF's
> default for no instructions at all is the first register.  Does it really
> matter?  The (only) FDE that refers to this CIE defines the CFA expression
> as the very first thing in it, so it isn't really ever used.
>
> Though, perhaps you might want to file a request to move the do_cfa_expr
> macro into the CIE from the FDE - I think
> DW_CFA_def_cfa_expression (DW_OP_breg7 (rsp): 160; DW_OP_deref)
> is 6 bytes and therefore would fit exactly into the padding at the end of
> the CIE.
>
> > 00002690 0000000000000014 00000000 CIE
> >   Version:               1
> >   Augmentation:          "zRS"
> >   Code alignment factor: 1
> >   Data alignment factor: -8
> >   Return address column: 16
> >   Augmentation data:     1b
> >
> >   DW_CFA_nop
> >   DW_CFA_nop
> >   DW_CFA_nop
> >   DW_CFA_nop
> >   DW_CFA_nop
> >   DW_CFA_nop
> >
> > while readelf -wF gives:
> >
> > 00002690 0000000000000014 00000000 CIE "zRS" cf=1 df=-8 ra=16
> >    LOC           CFA
> > 0000000000000000 rax+0
> >
> > Remark: objdump emits the same output.
> >
> > I believe that this is the unwinding information for the longjmp call,
> and
> > the unwinding infos are computed from a structure on the stack
> representing
> > the processor state to which we want longjmp:
> >
> > 000026a8 000000000000007c 0000001c FDE cie=00002690
> > pc=0000000000036d3f..0000000000036d49
> >    LOC           CFA
> >   rax   rdx   rcx   rbx   rsi   rdi   rbp   rsp   r8    r9
> >   r10   r11   r12   r13   r14   r15   ra
> > 0000000000036d3f exp
> >   exp   exp   exp   exp   exp   exp   exp   exp   exp   exp   exp
> > exp   exp   exp   exp   exp
> > exp
> >
> > 000026a8 000000000000007c 0000001c FDE cie=00002690
> > pc=0000000000036d3f..0000000000036d49
> >   DW_CFA_def_cfa_expression (DW_OP_breg7 (rsp): 160; DW_OP_deref)
> >   DW_CFA_expression: r8 (r8) (DW_OP_breg7 (rsp): 40)
> >   DW_CFA_expression: r9 (r9) (DW_OP_breg7 (rsp): 48)
> >   ? (and so on for all registers)?
> >
> > So it makes sense to ignore whatever in the CIE here.
> >
> > I am just surprised that readelf/objdump prints ?rax+0?: I would have
> > expected ?u? as the CFA in the CIE is never computed by the CIE bytecode.
> > Wonder if I am missing something...
>
>         Jakub
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dwarfstd.org/private.cgi/dwarf-discuss-dwarfstd.org/attachments/20160524/ba0e45a0/attachment.htm>


From davea42@linuxmail.org  Tue May 24 15:45:13 2016
From: davea42@linuxmail.org (David Anderson)
Date: Tue, 24 May 2016 08:45:13 -0700
Subject: [Dwarf-Discuss] doubt parsing CIE in eh_frame
In-Reply-To: <CALCBA_Go7AdHg=urPocHuhCo9xinCK6dBUjfHVXaPxhGqoR0jg@mail.gmail.com>
References: <CALCBA_HPzpDraJj7QAT7tRrOohY7Jj5qRwri4t32otkLNUX7qw@mail.gmail.com>
	<57439369.3090200@linuxmail.org>
	<CALCBA_Go7AdHg=urPocHuhCo9xinCK6dBUjfHVXaPxhGqoR0jg@mail.gmail.com>
Message-ID: <57447709.9090907@linuxmail.org>

On 05/24/2016 12:46 AM, Francesco Zappa Nardelli wrote:
>> If you could produce a small object file..
>
> Invoking readelf on /lib/x86_64-linux-gnu/libc.so.6 is enough to
> observe this (I am on Ubuntu 14.04.3 LTS (GNU/Linux 3.13.0-68-generic
> x86_64)):
>
> $ readelf -wf /lib/x86_64-linux-gnu/libc.so.6 (and search for S in the
> augmentation string)
>
> 00002690 0000000000000014 00000000 CIE
>   Version:               1
>   Augmentation:          "zRS"
>   Code alignment factor: 1
>   Data alignment factor: -8
>   Return address column: 16
>   Augmentation data:     1b
>
>   DW_CFA_nop
>   DW_CFA_nop
>   DW_CFA_nop
>   DW_CFA_nop
>   DW_CFA_nop
>   DW_CFA_nop
>
> while readelf -wF gives:
>
> 00002690 0000000000000014 00000000 CIE "zRS" cf=1 df=-8 ra=16
>    LOC           CFA
> 0000000000000000 rax+0

rax is the x86_64 64bit reg . As a 32bit x86 reg it is named eax.

IMO this is an accidental side effect of the way dwarf.c is implemented
in binutils.  If printing eh_frame it won't print the  CFA_nop but
finishes up
with a print of the resulting cfa reg which never got set so is zero.
Zero results in printing rax+0.

So I think this is just a simple bug in readelf.


David Anderson




From davea42@linuxmail.org  Tue May 24 15:51:58 2016
From: davea42@linuxmail.org (David Anderson)
Date: Tue, 24 May 2016 08:51:58 -0700
Subject: [Dwarf-Discuss] doubt parsing CIE in eh_frame
In-Reply-To: <20160524080747.GC28550@tucnak.redhat.com>
References: <CALCBA_HPzpDraJj7QAT7tRrOohY7Jj5qRwri4t32otkLNUX7qw@mail.gmail.com>
	<57439369.3090200@linuxmail.org>
	<CALCBA_Go7AdHg=urPocHuhCo9xinCK6dBUjfHVXaPxhGqoR0jg@mail.gmail.com>
	<20160524080747.GC28550@tucnak.redhat.com>
Message-ID: <5744789E.4050900@linuxmail.org>

On 05/24/2016 01:07 AM, Jakub Jelinek wrote:
> On Tue, May 24, 2016 at 09:46:58AM +0200, Francesco Zappa Nardelli wrote:
>> Dear David and all
>>
>> If you could produce a small object file..
>>
>>
>> Invoking readelf on /lib/x86_64-linux-gnu/libc.so.6 is enough to observe
>> this (I am on Ubuntu 14.04.3 LTS (GNU/Linux 3.13.0-68-generic x86_64)):
>>
>> $ readelf -wf /lib/x86_64-linux-gnu/libc.so.6 (and search for S in the
>> augmentation string)


The bug in readelf (I think) is at the end of display_debug_frames() in
dwarf.c (binutils directory).

The frame_display_row call is a bit odd if all that exist are nops and
results in the rax output
we see.
=======================
      if (do_debug_frames_interp)
        frame_display_row (fc, &need_col_headers, &max_regs);

      start = block_end;
      eh_addr_size = saved_eh_addr_size;
    }

  printf ("\n");

  return 1;
}
============================

DavidA.


