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
4
votes
2 answers

Suggestions on how to write a debug format conversion tool

I'm looking to write a tool that aims to convert debug symbols of one format to another format that's compatible for use under GDB. This seems like a tedious and potentially complex project so I'm not exactly sure how to tackling it. Intially I'm…
greatwolf
  • 20,287
  • 13
  • 71
  • 105
4
votes
1 answer

implementing step over, dwarf

Im working on a source level debugger. The debug info available in elf format. How could be 'step over' implemented? The problem is at 'Point1', anyway I can wait for the next source line (reading it from the .debug_line table). Thanks if (a == 1) …
User01
  • 41
  • 2
4
votes
1 answer

Determining symbol addresses using binutils/readelf

I am working on a project where our verification test scripts need to locate symbol addresses within the build of software being tested. This might be used for setting breakpoints or reading static data from memory. What I am after is to create a…
Michael Bauer
  • 183
  • 4
  • 15
4
votes
2 answers

Dump debug_loc section from executable

How do I dump debug_loc section from an executable on Linux if default options (-g) are provided to GCC while compiling a C file? I use readelf linux utility. GCC by default produces DWARF info in DWARF4 format, so if I pass -g-dwarf2 I can see…
username_4567
  • 4,737
  • 12
  • 56
  • 92
4
votes
3 answers

DWARF info seem to be wrong for DW_AT_high_pc with gcc 4.8.2

As a newbie to DWARF, I tried the code presented in this page (code is here) but when I launch it I get: $> ./dwarf_get_func_addr tracedprog DW_TAG_subprogram: 'do_stuff' abort() in libdwarf. No error argument, no handler. zsh: abort (core dumped) …
Vincent
  • 430
  • 3
  • 13
4
votes
1 answer

Basic OS X Assembly and the Mach-O format

I am interested in programming in x86-64 assembly on the Mac OS X platform. I came across this page about creating a 248B Mach-O program, which led me to Apple's own Mach-O format reference. After that I thought I'd make that same simple C program…
Ephemera
  • 8,672
  • 8
  • 44
  • 84
4
votes
3 answers

Change sourcefiles listed in elf debug info

Basically I want to be able to change the path to the source file in debug dwarf section in a elf binary.
John Kearney
  • 322
  • 3
  • 9
3
votes
2 answers

use and meaning of DW_AT_location

I wanted to know the use of the attribute DW_AT_location for debugging. It is one of the attributes specified by dwarf for debugging, but could not really understand what exactly it represents. And also when should this attribute be emitted when we…
Maximus
  • 285
  • 5
  • 19
3
votes
1 answer

Address of element within a structure from elf executable

Is it possible to obtain the address of an element within a structure from an ELF executable not compile for debug? Example, given the following code: typedef struct { int tokyo; int paris; int london; }cities; cities places; Both nm and…
Chris
  • 538
  • 8
  • 19
3
votes
1 answer

GDB: No symbol files found in NASM assembled file

Forgive me as I'm pretty new here, but I am trying to debug the x86 assembly with gdb. ex10.asm global main extern printf section .data msg db "Testing %i...", 0x0a, 0x00 main: push ebp mov ebp, esp push 123 …
3
votes
0 answers

GCC, GDB, and is_stmt

I'm using GNU Arm Embedded Toolchain 10.3 to cross-compile for a Cortex-M0+ target, and using the accompanying GDB to debug. I want to set a breakpoint on the following line of code: if (mPendingMessageIndex == 0) { // Start a new…
Jeremy
  • 5,055
  • 1
  • 28
  • 44
3
votes
0 answers

How to make Thread.callstacksymbols output readable

I used Thread.callStackSymbol to get stack trace but it's not readable. I saw several StackOverflow answers but none of them is working. Following is the process I followed to make stack trace readable Sample stack trace : [ 0: "projectName", "hex…
Geetanshu Gulati
  • 692
  • 8
  • 13
3
votes
0 answers

Debugging NASM local labels with gdb

I have been having some issues debugging code assembled by nasm with gdb: it seems like gdb doesn't do well with nasm local labels. nasm generates a local symbol named «function».label, which seems to confuse gdb, as it loses track of which function…
Marco
  • 2,796
  • 19
  • 24
3
votes
1 answer

How to generate ELF file format for JIT code for GDB?

Background: I am generating a JIT code (which generates x86-64 code). After the end of JIT process, I have a .text section, a .data section and a .eh_frame section generated (.eh_frame is used for stack unwinding). I am able to execute this JIT code…
Saksham Jain
  • 537
  • 3
  • 14
3
votes
2 answers

Location of DW_FORM_strp values

I'm trying to understand where DW_FORM_strp attribute values are actually stored in an ELF file (can be found here: https://filebin.net/77bb8359o0ibqu67). I've found sections .debug_info, .debug_abbrev and .debug_str. I've then parsed the…
MulattoKid
  • 573
  • 6
  • 14