All Questions
127 questions
0
votes
0
answers
212
views
Unable to start debugging. Program path is missin or invalid. GDB failed with this message .exe : no such file or di
When I try to debug my c code I got an error that is on the title. What should I do?
my launch.json file:
{
"version": "0.2.0",
"configurations": [
{
...
1
vote
1
answer
194
views
dSYM not generated when building with make
On macOS 12.7.5 (Monterey) using gcc to compile *.c: gcc version 13.2.0, with gnu make 3.81, (I prefer command line tools over XCode), when I pass CFLAGS = -g in a makefile I get full debugging ...
0
votes
0
answers
194
views
backtrace_symbols() on aarch64 device returns empty on SIGSEGV
I was trying to get backtrace in signal handler. The simple code from manpage worked on armv7 inside a signal handler. But I was unable to run the same code on an aarch64. Compiled with the -rdynamic -...
0
votes
0
answers
63
views
C program breaking when I input text through a file. But works when I input text through command line
My program will convert C99-style comment in the input text by an equivalent ANSI C comment.
Note: The program seems to run correctly on other environments, but I have still included the code for ...
1
vote
2
answers
95
views
Is it possible to extract a function return type in C?
I am using the gcc compiler to compile a C program. The following code only prints the function name:
int main(void) {
printf("%s\n", __PRETTY_FUNCTION__); // prints "main"
...
1
vote
1
answer
2k
views
How to force all compilation units to have the same DWARF version?
I want to write a software for an ARM target system and debug it remotely. I use gcc, which builds the program correctly. Then I want to debug the program with gdb. Unfortunately I use a x86 Windows ...
0
votes
0
answers
465
views
Can't see the printf() output while debugging in VS Code
I tried running the following C program:
#include <stdio.h>
main()
{
for (int fehr = 0; fehr < 300; fehr = fehr + 20)
{
printf("%3d\t%6f\n", fehr, (5.0 / 9.0) * (fehr ...
0
votes
2
answers
720
views
Visual Studio Code - set argoments while debugging in C
This is my simple program
#include <stdio.h>
int main(int argc, char *argv[]){
printf("%d\n", argc);
for(int i=1; i<argc; i++) printf("%s\n", argv[i]);
...
0
votes
0
answers
384
views
.dSYM folder for debugging
I just set-up GNU gcc on my Mac through some re-organization of my path and builds so it's not an alias for clang anymore. Running gcc -g, I expect debugging symbols to be self-contained within the ...
-1
votes
1
answer
242
views
Segmentation fault with ncurses but no problem when -fsanitize is used for building
Update
I am getting this segmentation fault with ncurses function calls.
Program received signal SIGSEGV, Segmentation fault.
...
0
votes
0
answers
422
views
Generating annotated text description of structs with size/offset of fields for a given architecture during compilation?
Basically, I would like to obtain the information about packing of structs on a given architecture during the compilation process, formatted as a text file with the struct description (code stripped ...
-4
votes
1
answer
103
views
Is this a perhaps a GCC issue/bug
While I was solving today's AOC challenge I stumbled upon an interesting phenomenon where it appears that there is a problem with the GCC compiler or I have done something incorrect which I have yet ...
1
vote
1
answer
1k
views
Is -g the same as -g2 for gcc and clang?
GCC debug option documentation is not that comprehensive. So trying to compile a binary with different options -g, -g1, -g2, -g3 I got the following result.
When compiling with -g and -g2 binary has ...
0
votes
1
answer
395
views
GDB is not stopping at breakpoint when debugging a PIE kernel
I have a position independent kernel that gets compiled and linked like this:
gcc -Og -g -Werror -nostdlib -o kernel.o -c kernel/main.c
gcc -nostdlib -ffreestanding -e kmain -o kernel.elf ...
2
votes
2
answers
1k
views
Change on rax register during debug session with gdb does not affect code execution
I'm planning to participate to some of the Capture the flags (CTF) challenges, in the near future. For that reason, I've decided to study assembly. As of now I'm focusing on the usage of the CPU ...