You need to understand the DWARF (debug info)

Try this:

Create a *SIMPLE* C file - with a simple structure
Do *not* "#include" any file - make your file 100% standalone.
(later you can get more complicated, you want a simple translation unit)

Do the following with both GCC and LLVM

Compile this file using only the "-c -S"  options. (this produces an assembly listing)

Next, add the "-g" option thus:  "-c -S -g" - look at the difference.
Try other variants of the "-g" (see the man pages)

Look over the .S file output - this should give you a good description of the dwarf info.

Add things - this will get you started.  Then - start reading about DWARF records and and then start spelunking (cave exploring) through out the code base - both in LLVM and in GDB - compare and contrast.

Find some function - in the bowels of GDB and/or LLVM and set a breakpoint - use GDB to DEBUG GDB 
or LLVM to Debug LLVM what ever combination you like.

A good example would be the "print variable" operation, then step through the code and examine the available variables and the dwarf debug data structures "in-situ" with actual data present.  Also disable the optimizer, and turn on all debugging. This means building your own version of GDB and/or LLVM 

-Duane.

-------- Original Message --------
Subject: [lldb-dev] Structure variable names
From: Jiten Thakkar via lldb-dev <lldb-dev@lists.llvm.org>
Date: Tue, June 07, 2016 9:56 am
To: lldb-dev@lists.llvm.org

Hi All,
I am working on a project as part of my graduate study which uses LLVM.
I am new to LLVM and lldb to be particular.
My goal is to get names of the parameters to functions. If the parameter is a variable in a structure, it is represented as an offset in the structure.
I want to get the names of all those parameters. I assume that debug info should provide this but so far I am unable to find any documentation regarding which would describe how to do it.
Is there a way to do this using debug info? Is this even possible?
Please let me know if any of this is confusing and I will try to describe it in detail.

Thanks,
Jiten
_______________________________________________
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
_______________________________________________
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev

Reply via email to