11,668 questions
2
votes
0
answers
202
views
Trouble Using GDB to Debug amd64 Binaries in Docker on MacBook M1
Background
I'm running an x86/amd64 Debian 11 environment inside Docker on my MacBook Air with an M1 chip (Apple Silicon). I want to use gdb to debug programs compiled for amd64, but I've encountered ...
0
votes
1
answer
83
views
`gdb -tui` disables backspace left/right arrow
I'm trying to debug some embedded c code, I can connect the debugger and debug the target but when switching to the tui mode some keys stop working.
When running gdb in tui mode, either via gdb -tui ...
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 ...
-3
votes
2
answers
135
views
AVR-GCC macro behaviour
I have a simple C program:
#include <stdint.h>
#define WHEELS_PWM_CYCLES_PER_MS (5)
#define WHEELS_TIME_TO_GO_1_CM_MS (10)
int main(void)
{
for (;;) {
uint32_t x = (uint32_t)...
1
vote
0
answers
104
views
Stack frame contents, pointer to another address within stack frame
I'm trying to learn more about memory and trying to dissect a stack frame. For reference here is the source code that I'm running through gdb.
#include <stdio.h>
void test_function(int a, int b,...
3
votes
1
answer
208
views
Can't step into printf() function GDB. WSL2 Ubuntu 24.04
I'm currently running wsl2 ubuntu 24.04. I want to view the definition of the printf() function in GDB ( gdb ./main). But when I type the step command into printf(). It show this:
enter image ...
0
votes
0
answers
53
views
Getting backtrace to log within a commands block
I am in the process of debugging a C++ program. I want to log all times the program goes through a specific breakpoint and capture the stack alongside some variable values. This happens multiple times,...
2
votes
0
answers
89
views
Invert the stack with tmux, pwndbg, and splitmind?
I am using pwndbg, with tmux and splitmind. I have the layout the way I want, the only think I am trying to change is getting the stack pane to be inverted. Like what you would see when running 'stack ...
5
votes
1
answer
170
views
How does GDB actually know what symbols to load in and at what address?
I have been writing a dynamic program loader in C. More specifically, I am writing a chain loader which runs some code before loading in the normal dynamic loader (ld.so). This allows me to run some ...
6
votes
1
answer
173
views
GDB: Invalid cast when using strcmp and Logical AND operators
I am working on a c program to add conditional breakpoints or print some values. But when I use some expressions, the gdb failed with Invalid cast.
OS: Ubuntu 24.04.1 LTS
GCC: gcc (Ubuntu 13.3.0-...
1
vote
0
answers
167
views
Force GCC not to optimize frame pointers even for leaf functions
I'm trying to build a production code and still have a minimum debugging capability, specially, in case of a processor trap. Critical information for me is to find the back trace causing the crash.
I'...
0
votes
1
answer
139
views
How to have a GDB/Python script use pipes for input and output of debugging target
I want to run GDB with a Python script that also drives the debug target's input, say through a pipe. I cannot seem to get the ordering of the target execution and pipe setup lined up to avoid ...
0
votes
0
answers
34
views
gdb breakpoint considered then ignored
Here is my program:
#include <stdio.h>
int main()
{
int counter = 0;
int run = 1;
while (run)
{
printf("loop %d\n", counter++);
}
return 0;
}
I ...
3
votes
0
answers
142
views
VSCode GDB Debugging Fails with CustomAttributeFormatException When Using Rosetta
I'm trying to debug a C++ program in VS Code using GDB. GDB works fine from the command line, but when I attempt to launch the debugger in VS Code, I encounter a strange error. I'm running an x86_64 ...
1
vote
3
answers
631
views
GDB -var-create: unable to create variable object
I'm trying to debug a fortran90 application, using vscode with gdb. In one particular function:
subroutine get_hamiltonian(...)
real :: list(:)
...
end subroutine get_hamiltonian
I can not ...
0
votes
1
answer
154
views
In a release build by GCC, i.e., without -g flag, why function frame is missed in backtrace of GDB?
It's a follow up question of In a release build by GCC, i.e., without -g flag, is register info trustable?, thanks for the answer of it, I now understand that the registers designated for function ...
3
votes
1
answer
249
views
How to get an individual element from a Vec in rust-gdb?
Given a Rust Vector (potentially, a long one), I would like output a single element while debugging my program. Although indexing the vector directly is desirable, I would also appreciate an approach, ...
0
votes
0
answers
59
views
gdb: invoke custom python command without printing it
Since gdb has only one global set print elements that affects all array-like types, it has been necessary to use a very short value like set print elements 4. But in certain specific cases it can be ...
3
votes
0
answers
105
views
VSCode Debugger - C++ - Not working. Red dot turning to grey cirle
Hey does anyone have a fix for the VSCode gdb debugger running inside of the IDE at some point won't observe breakpoints and the red dots turn to little grey circles.
It might be good information that ...
0
votes
1
answer
110
views
Understanding buffer overflow output, when accessing the hidden function
Sorry if this is the wrong format. Im currently doing a CTF and have a problem where i have to overflow a buffer, to get access to a /bin/sh hidden function, where i then can get a flag.
I think i ...
0
votes
1
answer
42
views
Possible to automatically print out variables of source line on next in gdb?
Say I have a session like this in gdb:
320 mystruct.ticks++;
(gdb) n
321 mystruct.prev_state = mystruct.state;
(gdb) n
325 if( mystruct.variant == VARIANT_ONE )
(gdb) n
335 if( mystruct....
1
vote
0
answers
50
views
Matching Debug Info to opened Source File
Im working currently on a sideproject that centers around building a kind of "diy debugger" for an embedded controller im working with.
I can not attach debugger directly to it, but im able ...
1
vote
0
answers
118
views
gdb backspace deletes whole line?
I just hate it so much when small things that were working since forever suddenly break.
I use MINGW64 bash in Windows Terminal in Windows 10. When I run gdb-multiarch, inside it, suddenly Backspace ...
0
votes
1
answer
66
views
How to know the last hit break point number in GDB
Is there a way to know the last hit break point number in GDB debugging C code.
The info break/breakpoints command list all the available breakpoints but does not displays the break point at which the ...
1
vote
1
answer
63
views
GDB different function names and addresses than expected
I'm trying to capture when a child executes an abort.
The following is a MCVE that should give an idea of what I'm trying to do.
#include <iostream>
#include <cstdio>
#include <iomanip&...