Structure variable names

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.

Thanks Greg and Duane, I will try these things and comeback if I have further questions.

-Jiten