Questions tagged [dwarf]

DWARF is a file format for representing debugging information.

The DWARF format is used to represent information needed for source-level debugging of programs.

The DWARF format is designed to be processor architecture and operating system independent, and supports debugging of programs written in procedural languages like C, C++, FORTRAN, Ada, Java, Modula2 and Pascal.

DWARF is widely used in modern proprietary and open-source operating systems, for example, Linux, Android, BlackBerry OS 10 and others.

288 questions
1
vote
2 answers

DWARF DI with generated C code?

I can't seem to find any good documentation for the DWARF DI format to answer my question. I'm writing a language that compiles to C, is there any way that I can produce DWARF Debug Information into the C code or is it assembly only? Is it…
Jon Flow
  • 495
  • 3
  • 11
1
vote
1 answer

Instrumenting a benign instruction hangs the program

I'm working on instrumenting a piece of assembly code and I noted the following interesting phenomena: The original assembly: 64 .loc 1 22 0 is_stmt 0 discriminator 1 65 cmpl $31, -4(%rbp) #, i 66 jg .L2 #, Instrumented…
qweruiop
  • 3,156
  • 6
  • 31
  • 55
1
vote
1 answer

Nasm Dwarf Error Bad Offset

I have a simple Hello World program for Windows in pure x86 assembly code that I have compiled and linked with nasm and ld. The problem I am running into is that I can't get DWARF debugging to work. I am using gdb from Mingw64…
SeanRamey
  • 665
  • 7
  • 19
1
vote
1 answer

Getting the stack pointer content using Intel's PinTool

Using objdump utility, we are able to retrieved the relative address of a variable for example consider a simple C program: Source-code: #include void do_stuff(int my_arg){ int my_local=my_arg+2; int i; for(i=0;i
Bernard Nongpoh
  • 1,028
  • 11
  • 20
1
vote
1 answer

C++ class methods do not have an address range in DWARF info

I'm trying to parse the DWARF debug info to determine the functions from a stack trace address. If it works for my C functions (compiled with gcc), it doesn't for my C++ functions (compiled with g++) My C functions all have a in the .debug_info…
user7094
  • 215
  • 2
  • 7
1
vote
2 answers

Can't parse DWARF - Tricore CPU's DWARF info

I am struggling to parse ELF file - DWARF contents of *.elf after compilation by Tasking compiler for Infineon's Tricore CPU. I can't match the .debug_abbrev and .debug_info, to me it looks the contents are corrupted. Can you guys guide me how to…
Tickle
  • 21
  • 4
1
vote
0 answers

Why is there a confusing gap in the list of attribute form encodings in the Dwarf 4 specification

In the table of attribute form encodings table (Figure 21 page 161) in the specification for DWARF4 (here) there is a gap. The entries go Form name Value Class DW_FORM_ref_udata 0x15 reference DW_FORM_indirect 0x16 (see…
Carcophan
  • 1,508
  • 2
  • 18
  • 38
1
vote
1 answer

How to dereference a reference in DWARF

How can I get the address of my variable by reference from DWARF? For example we have the next structures: struct sub_struct { int a, b; sub_struct(int a, int b) : a(a), b(b) {} } struct main_struct { sub_struct & as_ref; int c, d; …
Serbin
  • 803
  • 12
  • 27
1
vote
0 answers

How can I compile meta node into dwarf binary with LLVM?

I'd like to know how LLVM does it. For example, I have some Meta Nodes, and use some code to compile it into binary then dump it. I can't find the part in LLC's source. Thanks in advance.
Adam
  • 1,684
  • 1
  • 19
  • 39
1
vote
2 answers

(C++ Builder) DWARF debug info in separate file?

Is there a way to instruct C++ Builder's linker to output DWARF debug information (64-bit C++ apps) in standalone file rather than inject it directly into executable? I.e. the option similar to "Place debug information in separate TDS file" (which…
Alex
  • 5,477
  • 2
  • 36
  • 56
1
vote
1 answer

Encode live range in DWARF

I want to encode live range of a variable in DWARF. How should I do it? I see in spec, page 178 of DWARF 3 pdf that DW_AT_high_pc and low_pc are not applicable to DIEs tagged with TAG_variable. Where should I encode it according to spec?
username_4567
  • 4,737
  • 12
  • 56
  • 92
1
vote
2 answers

objdump doesn't show size for ostream class

I have this code: #include int main() { std::cout << sizeof(std::cout) << std::endl; return 0; } Compile it with g++ -g main.cpp (it prints 272 on my OS) After that I execute objdump --dwarf=info a.out and see next debug info…
eXXXXXXXXXXX2
  • 1,540
  • 1
  • 18
  • 32
1
vote
1 answer

Does dwarf/dwarf2 facilitate deriving size information of a function accepting a fixed size array?

Assume a C module containing the following function definition: void foo(int (*a)[6]){...} Is it possible to extract the actual array size information '6' of parameter 'a' from the dwarf information (embedded in the resulting .o-file) obtained when…
Blue Demon
  • 293
  • 3
  • 12
1
vote
2 answers

How to decode a debug_line section?

I'm trying to figure out how a DWARF 2 debug_line section is encoded. The standard paper (http://www.dwarfstd.org/doc/dwarf-2.0.0.pdf) isn't much helpful to me and I really don't understand how something like the following: .4byte .debug_line …
Marco A.
  • 43,032
  • 26
  • 132
  • 246
1
vote
0 answers

gcc assembly. Discussion about the value in cfa, %ebp, %esp and the number in directive, like 4 in .cfi_def_register 4, 4

Question 1: when the line 8 is going to be performed, I infer both %esp and %ebp are equal to CFA - 4, and they point to the return address stored in stack. Is it right? : : | whatever | <--- CFA: the value of the…
Jay
  • 21
  • 3