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
6
votes
3 answers

what the structure of dsym file?

What's structure of a dsym file generated when build the app. I know it contain DWARF debug info, but what's a dsym file. I want to read the DWARF info in it. Is it just a Mach-O binary file that contain only debug sections? How do I pass it to a…
leavez
  • 2,119
  • 2
  • 27
  • 36
6
votes
2 answers

Source column numbers in DWARF line table

For any element in a C/C++ source file, I would like to be able to determine the corresponding memory location within its compiled executable. Compiling with debug, and using the resulting DWARF information goes a long way towards this, but falls…
mason
  • 63
  • 4
5
votes
2 answers

in Java: programmatically determining addresses of C/C++ variables given a COFF/ELF/DWARF executable

This is a situation I run into now and then: For an embedded system which does not use virtual addressing, I have an executable file that was compiled from C or C++ code with debugging information included. It's usually in COFF or ELF/DWARF (I get…
Jason S
  • 184,598
  • 164
  • 608
  • 970
5
votes
1 answer

Can different .dwo files be combined into a single one?

Background: I have a need of the debugging information of the code in our project. The following two approaches are available: Compile using -g and afterwards use GNU binary utilities strip and objcopy to strip the debugging information into a…
Shady Atef
  • 2,121
  • 1
  • 22
  • 40
5
votes
1 answer

dSYM files for release builds

Do .dSYM resources contain any other information except DWARF information? I have created a release build of an app. Now if I run dwarfdump on it, it says the executable has no DWARF info (says it's "empty"), which is what I would expect. But if I…
341008
  • 9,862
  • 11
  • 52
  • 84
5
votes
3 answers

Missing line numbers from debug symbols for library in whole program, but not on its own

I'm seeing an odd issue when trying to use gdb to debug a test program for a package built with libtool. If I run libtool --mode=execute gdb .libs/libfoo.so and ask it to list the source of some function list Bar::Baz, I get the source code as…
Phil Miller
  • 36,389
  • 13
  • 67
  • 90
5
votes
2 answers

map memory addresses to line numbers using DWARF information

I have an application that traces program execution through memory. I tried to use readelf --debug-dump=decodedline to get memory address / line # information, but the memory addresses I see don't match up often with the ones given by that dump. I…
wickedchicken
  • 4,553
  • 5
  • 22
  • 28
5
votes
0 answers

How to use DWARF to get a stack trace when error occurs in Haskell?

GHC already support DWARF, and there are articles telling that we can use DWARF to get a stace trace when error occurs, but no one telling how, and just add -g when compiling doesn't make the generated program print out stack trace directly. I also…
luochen1990
  • 3,689
  • 1
  • 22
  • 37
5
votes
1 answer

How to make local labels in GNU GAS ELF output that GDB can break on but not count as functions?

When writing assembly manually with GNU GAS, within a function, I want to set a label such that: GDB won't treat that label as the function name I can use b mylabel to break on the label A similar question for nasm has been asked at: Break at…
Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
5
votes
0 answers

Clang link debug_info in executable on OSX

On OSX when you link a binary from multiple object files like this clang++ -g myfile.cpp -o myfile.o clang++ myfile.o -shared -o myfile.dylib it will generate a .debug_info section (etc.) in myfile.o but in myfile.dylib it just stores a reference…
Timmmm
  • 88,195
  • 71
  • 364
  • 509
5
votes
1 answer

Symbolicating addresses programmatically

I am looking for a way to symbolicate external app symbols (iOS) inside my own application (macOS), assuming I have the DSYM and system symbols. Xcode symbolicates both app addresses as well as system framework addresses (UIKit, Foundation,…
Léo Natan
  • 56,823
  • 9
  • 150
  • 195
5
votes
1 answer

What does the left-most number mean in DWARF dump from readelf?

For example: <0>: Abbrev Number: 1 (DW_TAG_compile_unit) DW_AT_producer : (indirect string, offset: 0xe): GNU C1 1 5.4.0 20160609 -masm=intel -m32 -mtune=generic -march=i686 -g -fst ack-protector-strong <10> DW_AT_language …
Amumu
  • 17,924
  • 31
  • 84
  • 131
5
votes
1 answer

In a DWARF file, what's the difference between .debug_str and .strtab?

I'm working with DWARF parser that looks for string data in the .debug_str section. In the ELF files I'm parsing, the string data is in the .strtab section. What's the difference between these two sections? Both contain strings, right?
watkipet
  • 959
  • 12
  • 23
5
votes
2 answers

How can global variables' addresses be randomized if they're hardcoded inside the ELF?

I've read in a few places that ASLR is supposed to load the .data section at random addresses each time a program is run, which means the addresses of global variables should be different. However, if I have the following code: int global_var =…
Martin
  • 940
  • 6
  • 26
5
votes
2 answers

Reverse of addr2line

given an object file and address addr2line tool can relate it to a file and line number in the source code. I'd like to have the opposite. Given a line number and an object file I want to get a list of instruction addresses which correspond to a…
mcsim
  • 1,647
  • 2
  • 16
  • 35
1 2
3
19 20