308 questions
0
votes
0
answers
40
views
Why DW_AT_language is C11 for -std=c17 (and higher)?
For -std=c17 (and higher) DW_AT_language is C11:
$ echo "int x;" | gcc -c -xc - -fPIC -o x.o -g -std=c17
$ gcc -shared -o x.so x.o
$ readelf x.so -w | grep -P '(DW_AT_language\s*:|DWARF ...
4
votes
1
answer
879
views
How do I make this, presumed, very basic DWARF example work, using dwarf.exp?
I need some help, trying to put this very basic DWARF example to work.
I found this link: Dwarf hello world assembly example or tutoral?, where the only answer says "...there is a simple "...
2
votes
1
answer
109
views
How to put source information in the debug symbols without embedding the full sources on Linux?
MSVC has a very useful flag /SOURCELINK. This allows you to tell where in your versioning system the sources are stored, such that they can be downloaded.
For example: (Also holds for C++)
{
"...
0
votes
0
answers
42
views
How to get the location list value in DWARF 5 when DW_AT_GNU_locviews is present
I have a DIE that looks like this (output from llvm-dwarfdump):
DW_AT_Location [DW_FORM_sec_offset] (0x00000e65)
[0x000000001c1ef510, 0x00000000mc1ef530]
[0x000000001c1ef5d1, 0x00000000mc1ef5d5]
...
0
votes
0
answers
78
views
How to resolve ELF relative addresses?
I'm trying to implement my own debugger, and I've implemented a way of parsing DWARF4 information contained in the executable.When printing out the line entry table generated by the Line Number ...
1
vote
1
answer
70
views
DWARF call stack unwinding with function calls to assembly files
I am working on some low-level project. This project has many c files which has function calls to .s files. Now how to get the stack unwinding for this kind of situation, as dwarf cfi frames won't be ...
3
votes
0
answers
109
views
Detecting if a C++ class is abstract purely on DWARF information
Context
I'm creating an DWARF parser, this parser must be able to detect which classes are abstract classes. The parser is created to parse the output of a certain code-base. I have a working method ...
1
vote
1
answer
73
views
How to get Rust debuginfo to include full filepaths?
Even when building with the default development profile (cargo build), the generated debuginfo often only includes the last segment of paths to source files. This then affects the output of perf, ...
2
votes
2
answers
236
views
How to extract the arguments of current function in C?
I'm trying to implement a function that retrieves the call stack unwinding from the caller.
Take the following program as an example:
// test.c
void func2(int a, double b, int* c)
{
...
1
vote
1
answer
124
views
Symbol not Detectable by Objdump
I have a shared library /opt/evince-3.28.4/lib/evince/4/backends/libpdfdocument.so. In GDB, I can easily detect a function at offset 0xa830 of this library, as shown below:
(gdb) disas 0xa830
Dump of ...
0
votes
1
answer
187
views
Issue with DWARF DIE's and tracking variables
My compiler is writing DWARF DIE's and I am currently coming across an issue with tracking variables.
For example, the abbreviation would look something like:
DW_AT_name DW_FORM_string
...
1
vote
0
answers
157
views
What's wrong in my generated debug info in LLVM IR
Generated by compiler
I'm adding debug info to a go compiller (github.com/goplus/llgo) that used LLVM as backend, it passed in most cases, excludes a few simple cases likes below:
func ...
0
votes
1
answer
408
views
how /sys/kernel/btf/vmlinux is exported from vmlinux image?
I want to understand when Linux with BPF BTF enabled, what is the process of extracting BTF from kernel image vmlinux binary that has BTF info encoded and mount in /sys/kernel/btf/vmlinux, I get that ...
1
vote
0
answers
46
views
Function unwind data neither in __unwind_info nor in __eh_frame
iOS binary, release build, ARM64. I am looking at a function that does some floating point work.
The binary has both an __unwind_info section and an __eh_frame section. The IP (PC) for the function ...
1
vote
1
answer
78
views
The DIEs in the DWARF information suggests an overlap between two fields
Consider the following C code:
struct all_t {
unsigned a:13;
char b;
};
struct all_t all;
int main(int argc, char* argv[]) {
all.b = 3;
all.a = 0xf;
printf("%d\n", ...
0
votes
1
answer
58
views
How to parse from a eabi .out file?
I have a .out eabi binary file and I'm trying to parse out all the symbol names, addresses, types, and byte sizes.
I found some information about this using readelf, but its not super clear to me ...
0
votes
0
answers
438
views
How to "manually" map from WASM to source code with DWARF file
I am using Emscripten to compile C++ source code into WASM modules. I am compiling with several debug settings and am able to get the module to print out the line number in the WASM where the error ...
1
vote
1
answer
480
views
Why does breakpad minidump-2-core need debug symbols to generate core files?
The test code below produces a breakpad minidump, and GDB cannot display the stack from the dmp converted to core using minidump-2-core.
Why does minidump-2-core need debug symbols in order to ...
0
votes
1
answer
40
views
dwarf generated file is treating 3 letters variables differently
I am using a python script which runs OBJDUMP to extract dwarf information from an elf file, this is part of the code:
# Run objdump to extract DWARF information from the ELF file
ps = ...
1
vote
1
answer
995
views
How to compile the Linux kernel with -O0 for more detailed debug?
I'm hacking the Linux kernel v5.15 and try to debug it with gdb line by line. I've opened the dwarf debug info through make menuconfig. However, it seems that some line will still be skipped. I find ...
1
vote
1
answer
379
views
Display source code with disassembly when path has changed
We have some static libraries for a know arch (e.g. powerpc) in which we need to display source code with disassembly to perform some asm review activities.
However, the binaries were cross-compiled ...
1
vote
0
answers
3k
views
BFD: Dwarf Error: found dwarf version '5', this reader only handles version 2, 3 and 4 information
I'm trying to update a complex project to use newer toolchain.
Previous toolchain: GCC 4.9.2; C++11; CMake 3.10.1; Binutils 2.23.52; GDB 8.0.1
Newer toolchain: GCC 13.1; C++20; CMake 3.26.3; Binutils ...
1
vote
1
answer
91
views
Two seemingly different functions with same name exist in the C program (using DWARF info), why?
I have been going through the assembly code of the sort program in the GNU Coreutils and found something I can't figure out and explain in a technological sense of why this is happening.
It all ...
1
vote
1
answer
251
views
gdb print and examine commands give incorrect results for a float variable
I'm going through a book on x64 assembly. The book described a little on how to use gdb I was able to examine integers however print wouldn't work.
examine would work for integers if I included the ...
3
votes
0
answers
52
views
Source code in memory rather than file for GDB
I'm writing a JIT that compiles c fragments using libtcc to an ELF object (output type TCC_OUTPUT_OBJ) with dwarf-5 debug info, loads the resulting ELF object manually (mapping, relocating and linking ...
3
votes
1
answer
204
views
Handling DWARF-5 relocations in a custom ELF loader
I'm building a custom ELF object loader which resolves the library dependencies (DT_NEEDED) and recursively loads those, performs relocations and symbol resolution, calls preinit, etc. ld.so is ...
1
vote
1
answer
1k
views
Issue in parsing dwarf .debug_info section in an elf file
I am trying to implement a dwarf parser in c++ without using any external dependencies. As mentioned in dwarf5 standard, debug info first 4 bytes or 12 bytes denotes the unit length
Basically this:
...
0
votes
1
answer
292
views
DWARF line number data for simple AVR program (produced by GCC) doesn't seem right
Consider the following AVR program:
#define F_CPU 500000ul
#include <avr/io.h>
#include <util/delay.h>
// Not used, but it has significance. I suspect its presence is causing some ...
1
vote
1
answer
605
views
How to find the function DIE (Debugging Information Entry) using libdw, given an eip (instruction pointer)?
Libdw, part of elfutils, is more recent than libdwarf.
Unfortunately there is virtually no available documentation, nor examples.
I just finished writing a program that, given an instruction pointer ...
1
vote
0
answers
91
views
Is it possible to encode DWARF debug information into wat (wasm textual format)?
I'm developing a compiler that compiles to WebAssembly Text format (.wat) and want to include debug info. Is it feasible to include DWARF debug information within the .wat file, or is it more ...
0
votes
1
answer
576
views
No source available for "Reset_Handler() at 0x8984" while debugging an ARM TrustZone Project in Renesas e2 Studio and embOS Library
Summary
I have a C++ ARM TrustZone project which is running on a R7FA4M2 controller and the embOS-MPU RTOS should be used. When I try do debug this project, the debugger does not find the source files ...
1
vote
1
answer
214
views
DWARF register numbers on MIPS
What is the canonical mapping between DWARF register numbers and MIPS32 CPU registers, please? The first 32 ones are the general purpose registers, but what about beyond that (e. g. lo/hi)?
A link to ...
0
votes
0
answers
890
views
Understanding objdump DWARF information regarding struct and its member variables
I think I have the correct understanding of my question, but as I'm going purely with documentation and intuition, I was hoping someone with more expertise than me could verify or correct my ...
0
votes
0
answers
150
views
.eh_frame FDE - where can the field "initial location" / address range be found/resolved?
When reading about sections like .eh_frame and .debug_frame in the DWARF standard it says that in Frame Description Entries (FDE) there is a field that's called:
address_range (target address)
The ...
1
vote
1
answer
131
views
GDB opaque type resolution strategy for C executables
I am wondering how GDB resolves opaque types for C executables for instance.
in a .so
// foo.h
struct bar;
// foo.c
#include "foo.h"
struct bar {
...
}
in my program
#include "foo.h&...
2
votes
1
answer
1k
views
How to properly use the libdwarf information to get the local variable location
Preface: I apologize for the lengthy preparation for my question, the reason for this is to make sure this post is self-contained and wanted to include all of the necessary information that I found.
...
0
votes
1
answer
124
views
Is there a way to extract the uuid from a dSYM on linux?
Is there a way to extract the uuid from a dSYM on linux? And specifically on CentOS if it's possible.
I tried to use dwarfdump, mediainfo, exiftool, llvm-dwarfdump, and I Couldn't extract it.
...
3
votes
1
answer
2k
views
.eh_frame vs .debug_frame section?
The .debug_frame section seems to contain stack unwinding information and is defined by the dwarf standard.
The .eh_frame section seems to basically contain the same information with some subtle ...
0
votes
1
answer
628
views
What should I do to enable DWARF on a new backend in LLVM?
I am learning LLVM and trying to write a backend for a specific target architecture.
When I compile a hello-world with clang -g, the result of llvm-dwarfdump --verify is as follows.
I traced the ...
1
vote
1
answer
258
views
How does C++ inline assembly work with stack unwinding and exception handling?
An elf file contains multiple sections (.eh_frame, .eh_frame_shr) to store precise information about how stack unwdinging has to be done. This is also the basis for throwing exceptions (....
0
votes
1
answer
293
views
DWARF output differs between compiler versions
I compile an ELF file including debug info and then read the debug-info back and parse it to get a list of all variables (global variables and class variables) in the RAM. This already works with the ...
0
votes
3
answers
636
views
Where is the location information in a dwarf file for a var declared as extern?
I am wondering how the location information of a variable is presented in a dwarf-file (a file with debug symbols), when the variable is declared as extern.
A very simple example to illustrate my ...
2
votes
0
answers
171
views
How to make gcc emit basic_block markers in DWARF output?
(Probably unneeded context:)
I want to combine information obtained within a gcc plugin with the addresses of the actual basic blocks. Because the final addresses are not known within the plugin ...
1
vote
1
answer
1k
views
gdb doesn't support DWARF 5 macro sections?
#include <stdio.h>
#define A "hello world\n"
void main()
{
printf(A);
}
$ gcc -gdwarf-4 -g3 a.c \
&& gdb -ex 'set confirm off' \
-ex 'break main' \
-ex 'run' ...
0
votes
0
answers
858
views
how to build linux kernel with `allyesconfig` and debug information
I want to build a linux kernel with as many C source files as possible for testing, so I use make allyesconfig at first. Meanwhile I need debug info, so I tried some ways to add it:
make menuconfig ...
1
vote
2
answers
652
views
How to find structure member memory address from dwarf debug information?
I'm trying to find structure member memory address(Non Virtual Memory, embedded) from dwarf.
And there's two things i don't understand.
First, In below dwarf Info1 DW_AT_location value = [3, 192, 63, ...
0
votes
0
answers
77
views
why are multiple line numbers mapped to the same starting address in .debug_line?
It's ./drivers/net/virtio_net.c in linux kernel 6.0.0 and compiled to virtio_net.o with optimization -O2 and debuginfo(dwarf4). The readelf --debug-dump=decodedline drivers/net/virtio_net.o shows:
...
1
vote
1
answer
11k
views
gcc 11 is not debugging. It shows "as: unrecognized option '--gdwarf-5'"
I installed gcc 11 using homebrew on my machine (linux 20.04). And It is not running on vscode as it shows
as: unrecognized option '--gdwarf-5'
I'm not sure if it's a path problem or not. Cause when ...
1
vote
1
answer
56
views
Specify MIPS floating-pointer registers in CFI directives
I'm trying to generate a call-frame info about saved FP register on MIPS:
.text
.cfi_startproc
addiu $sp, $sp, -4
.cfi_adjust_cfa_offset 4
swc1 $f24, 4($sp)
.cfi_rel_offset $f24, 0
....
0
votes
0
answers
146
views
how dwarf format caculate provious sp pointer
this is example is from dwarf document.
How Can I caculate provious sp(r7) pointer,I mean It didnot save sp somewhere since sp is a callee-save register.
The architectural ABI committee specifies that ...