Questions tagged [gdb]

The GNU Debugger (GDB) is a portable debugger that runs on many Unix-like systems and works for many programming languages.

Filter by
Sorted by
Tagged with
0 votes
0 answers
29 views

debugger as a tool to get to root shell

according to the answer in the reference: Can gdb debug suid root programs? Claims that: "You can only debug a setuid or setgid program if the debugger is running as root. The kernel won't let ...
user avatar
0 votes
0 answers
51 views

Debugging both kernel and userland with QEMU and gdb

I am trying to debug the kernel in order to observe all the mechanisms such as context switching or interrupts handling. When I attach r2 or gdb with QEMU, it works well for the kernel part, but it ...
user avatar
  • 27
0 votes
0 answers
14 views

gdb ptype with every inherited virtual function?

For debugging the RefPerSys open source project (symbolic AI), on Linux/x86-64 (Ubuntu 21 or Debian testing) we need to use gdb and its ptype command in a way to also print all inherited virtual ...
user avatar
0 votes
1 answer
2k views

How to Set up Environment Variables in "launch.json" Configuration When Using GDB Integration in VS Code

I have a setup in launch.json for vscode as follows: { // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information,...
user avatar
  • 145
0 votes
1 answer
94 views

calling vim with mpiexec says "Warning: Output is not to a terminal / Warning: Input is not from a terminal"

My question is a bit technical. For specific reason, I need to call vim after mpiexec. Example : mpiexec -n 1 vim mytext.txt But this gives the following warning message: Vim: Warning: Output is not ...
user avatar
2 votes
0 answers
70 views

Debug & analyze pthread_mutex_lock issues

I've being recently facing some hardcore issues with Mutex lock for Linux, notably MySQL, memcache & APCu. Example: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting ...
user avatar
  • 121
0 votes
0 answers
44 views

Can a debugged Linux program communicate with its GDB debugger?

For the RefPerSys project (on Linux/x86-64 desktop, GPLv3+ licensed, multi-threaded, source code on github; it generates some C or perhaps C++ code at runtime then compile it as some dlopen-ed plugin),...
user avatar
1 vote
1 answer
190 views

What does debug symbol actually mean on Arch linux for gdb debugging?

P.S. English is not my native language; please excuse typing errors. I've (maybe) understand the basically main idea of symbol in ELF file in dynamic link. Refering to textbooks, if I need dynamic ...
user avatar
  • 13
0 votes
0 answers
57 views

Is it possible to get each thread's `comm` from a core dump with gdb?

I wrote a C program that uses multiple threads. For convenience I set the threads comm to some individual value for each thread, and that even might change depending on the state of the thread (a bit ...
user avatar
  • 804
1 vote
1 answer
197 views

How can I get glibc/libstdc++ sources and set them up for gdb to find?

I'm debugging this program which raises an exception. This makes my debugger look for some source code, e.g. ../sysdeps/unix/sysv/linux/raise.c - and fail to find it. Now, I realize it's not necessary ...
user avatar
  • 7,311
1 vote
0 answers
101 views

Can't compile linux kernel with -Og/-O0 option for debugging purpoces

Having custom hardware running embedded Linux (OpenWrt) like a charm. CPU - is IMX6ULL (ArmV7) so it is supported by Jlink to debug over JTAG interface. Starting GDB server and step by step debugging ...
user avatar
0 votes
1 answer
62 views

How to have gdb start in vi mode by default?

I know that I can use CTRL+ALT+J in gdb to get vim keybindings but how do I get gdb to start in vi mode by default ?
user avatar
0 votes
0 answers
209 views

How to debug gtest unit tests under gdb with proot

I'm trying to debug a unit test with gdb and proot. I need proot because I'm cross-compiling with a toolchain. What I'm trying is to run LC_ALL="" PROOT_NO_SECCOMP=1 proot -R /home/yocto/sdk/...
user avatar
1 vote
1 answer
101 views

How to catch and break on a Fortran 90 runtime error in GDB?

Is it possible to have Fortran 90 break at a runtime error in GDB? I show here a MWE for a simple routine test.f90 which throws an out of bounds error: program main implicit none integer ...
user avatar
  • 13
0 votes
3 answers
180 views

GDB Disassemble: Print only raw binary data (using column and awk)

I'm trying to get only the raw binary data from the gdb disassemble output. My current output is the following: $ gdb -batch -ex "disassemble/r btif_set_adapter_property" libbluetooth_qti.so ...
user avatar
  • 103
0 votes
1 answer
123 views

Two processes mapped in the same address space

I have noticed that when I open two processes with GDB for debugging, /proc/PID/maps indicate the same address regions for the two : cat /proc/4170/maps 555555554000-555555555000 r--p 00000000 08:01 ...
user avatar
  • 1
1 vote
1 answer
116 views

How to kill an orphan Terminal process

I have a java program that executes several shell files (one by each iteration). The shell file only has one command, start cross-gdb with a path to a gdbinit file. The program works fine, but (from ...
user avatar
5 votes
2 answers
3k views

GDB Installed From homebrew on macOS Big Sur Fails to Load Symbols From elf32-i386 Binary

for the past little bit I've been slowly working on developing a hobbyist kernel, and for all that time I've been using GDB with QEMU to investigate memory locations and registers and what not. ...
user avatar
1 vote
0 answers
1k views

Ptrace: Function Not Implemented in GDB Installed on Multiarch/Qemu-User-Static Arm64v8/Alpine Docker Container

I want to debug an aarch64 ELF using GDB installed on an arm64v8/alpine docker on my x86_64 16.04 Ubuntu VirtualBox, which itself is installed on my Mac. In particular, to set up the docker I use the ...
user avatar
  • 135
0 votes
1 answer
739 views

Emulating an AARCH64 Binary calling libgps on x86_64 Ubuntu using QEMU gives "Error relocating: symbol not found" Errors

This is similar to the issue posted here and here. I want to reverse engineer a binary called gpslogger but before debugging it using GDB, I wish to simply emulate it using QEMU (qemu-aarch64) since ...
user avatar
  • 135
1 vote
0 answers
103 views

I'm having a hard time getting gdb to work on mojave

I'm running Mojave on my Macbook pro. I've installed gdb 8.3 via brew. I've codesigned it following the instructions given in https://sourceware.org/gdb/wiki/PermissionsDarwin I've also turned system ...
user avatar
4 votes
1 answer
559 views

How to debug Linux kernel with JTAG + GDB?

I've successfully established a JTAG connection and serial port connection to my development board. I've followed the below diagram (with a little bit of difference). my GDB_client is on my Linux host ...
user avatar
0 votes
0 answers
122 views

How to debug a cpp file that's part of a so file in the software?

So I have this software which has multiple .so files. For one of the so file and I made some changes to the code but I want to see the line by line execution of file present in the so file. Just to ...
user avatar
1 vote
1 answer
642 views

The memory dump of a process by using GDB inside a bash script - errors, problems

I want to dump some program's memory segment to a file. Because the working time of my program is milliseconds, I use named pipe to stop its execution and dump its memory content by gdb meanwhile. The ...
user avatar
  • 3,730
2 votes
0 answers
106 views

Fluke Etherscope stuck at loading kernel, Have JTAG Pins, and bootloader access

I had purchased two Fluke Etherscopes, these are stuck with the message 'Loading Kernel' on the screen. I was able to get a serial console, and access the bootloader using the serial port on the side ...
user avatar
  • 21
2 votes
1 answer
69 views

How to debug application which is using /dev/port using gdb

I've got a simple C++ code to work with old ISA card fd = open("/dev/port", O_RDWR); if (fd == -1) { Error() << "Error fd = -1" << msg_show; return; } and also ...
user avatar
  • 121
1 vote
0 answers
38 views

gdb list step into targets

Is there a way in gdb to get a list of functions you could step into when the current line is composed of several function calls like foo(computeParam1(), computeParam2(), computeParam3())?
user avatar
  • 111
3 votes
1 answer
764 views

How to disassembly multiple functions using Linux utility objdump?

After a program is compiled and the binary file is generated, we can use objdump to disassemble the binary file and extract the assembly code and a lot of information. However, using -j .text with ...
user avatar
2 votes
0 answers
82 views

How to debug Qt-application installed via Flatpak

I'm trying to enable debug for QOwnNotes application installed via Flatpak (following this tutorial: Debugging a Flatpak application). I have installed application itself and debug parts for its Sdk ...
user avatar
  • 3,872
1 vote
1 answer
784 views

How can we perform an arithmetic operation on a register using GDB? [closed]

I want to inject a bit-flip fault into a running program. For this purpose, I'm using gdb to insert a breakpoint into the target program and then flipping a single bit in a random-selected register. ...
user avatar
0 votes
1 answer
79 views

Red hat vs Ubuntu compile and assembly Problem(Book reference)

Can you recommend me OS mentioned in Shellcoder's Handbook because I'm having frequent issues on running ELF files mentioned there(See the errors below). I know that to overcome those error I have to ...
user avatar
0 votes
0 answers
2k views

Feed gdb stdin with multiple inputs from a file

This has been driving me crazy and it must be so simple! I've looked at many solutions but none seems to work with my application. I'm debugging a program in gdb. The program takes two inputs like ...
user avatar
  • 1
3 votes
0 answers
755 views

Reload symbol table after recompilation in gdb

Lets say I have written a simple C++ program #include <stdexcept> int main(int argc, char *argv[]) { throw std::logic_error("Error"); return 0; } This program (compiled with g++ -O0 -ggdb ...
user avatar
  • 225
0 votes
1 answer
597 views

Error in dpkg when executing apt-get upgrade ( most of the commands )

Typing apt-get upgrade returns the following error: dpkg: error processing package gdb (--configure): package is in a very bad inconsistent state; you should reinstall it before attempting ...
user avatar
0 votes
1 answer
273 views

(Ubuntu 16.04) How to prevent they greying-out of unresponsive windows?

I've got an application running on Ubuntu. Whenever it fails to respond to system events (because threads deadlocked, or busy-looping), the windows gets greyed out. I understand this is useful in most ...
user avatar
  • 101
3 votes
1 answer
1k views

How can I install i386/x86 shared libraries on freebsd?

GDB is telling me, that the program compiled with gcc -m32 (i386 program) is incompatible with my shared libraries (i386:x86-64). Output of gdb: (gdb) r Starting program: /root/format warning: `/...
user avatar
0 votes
0 answers
299 views

gdb internals and setuid bit

I understand the fact that, in the case of setuid program, ptrace doesn't work well without root privilege. Then, how does gdb work with setuid bit enabled executable and non-root privilege? To ...
user avatar
  • 111
3 votes
1 answer
114 views

How to pass zeroes in the argument to the program [duplicate]

I have this program in C. #include <stdio.h> #include <string.h> char * pwd = "pwd0"; void print_my_pwd() { printf("your pwd is: %s\n", pwd); } int check_pwd(char * uname, char * ...
user avatar
3 votes
1 answer
3k views

How can i put the gcc warning messages in a text file? [duplicate]

I wished to know if someone knew how to put the compilation warnings of GCC in a text file ? For example : I wrote (willingly) a undefined function foo(). So gcc tell me : warning: implicit ...
user avatar
0 votes
0 answers
2k views

Why gdb can't find my shared object library?

Please IGNORE my post. I must have been the 1000000th person to discover that gdb resets LD_LIBRARY_PATH. Sorry if you have wasted some of your time! For the record, the solution is not to say ...
user avatar
1 vote
1 answer
2k views

Can we get address of a variable in a C program using GDB?

Actually, I was learning about the buffer overflow attack. So, can we figure out buffer address (I am using buffer variable in my program so that while writing in the buffer, I will make changes in ...
user avatar
  • 41
2 votes
1 answer
1k views

Which gdb set commands to use when target has stripped libraries and binaries and host has corresponding tree with the ".debug" directories

I have a setup at hand where target device has only stripped libraries and binaries . Target has gdbserver. On host I am using gdb-multiarch. Host has a directory that contains respective ".debug" ...
user avatar
  • 332
0 votes
1 answer
32 views

Filter hundreds of coredumps by signal

If I had several hundred core dumps in a directory and want to filter it down to just ones generated by a specific signal without having to manually open each one in GDB one at a time, is there a way ...
user avatar
  • 103
3 votes
1 answer
601 views

Debugging a slow thumbnailer process

I am trying a debug a peculiar performance behavior in the thumbnail-generating process for eog, specifically gdk-pixbuf. The minimal files to reproduce are here: https://github.com/nbeaver/gdk-...
user avatar
0 votes
0 answers
31 views

does logging off remove contents of gdb.txt

This is in reference to an earlier question I asked here. What was not clear from that question is what does logging off do when you run that command. Is it just a 'state' of gdb or does it actually ...
user avatar
  • 10.9k
0 votes
0 answers
30 views

Does GDB keep a history of previous call stacks?

GDB had catched SIGSEGV, I accidentally continued the execution, and now it has catched SIGABRT. Can I still watch the backtrace of the previous call stack (at the moment of SIGSEGV), or is it gone?
user avatar
1 vote
1 answer
3k views

Get backtrace from core dump using gdb via shell script(non interactive)

I have core dump file and gdb. I can do gdb <executable> <core_file> (gdb)bt This will give me backtrace but I want to do this using a shell script and in non-interactive mode. ...
user avatar
  • 157
3 votes
1 answer
2k views

How to enable TUI for gdb on Debian 9?

When debugging it is often helpful to loot at assembly, but on Debian 9 when I try layout asm I get: Undefined command: "layout". Try "help". According to some internet research it seems like I ...
user avatar
  • 638
1 vote
1 answer
1k views

Qemu-user : get memory maps while debugging remotely

I am trying to get the memory map of a process I am debugging remotely (peda pull request link), the process is ran with qemu-user, for example: qemu-arm -L /usr/arm-linux-gnueabihf/ -g 1234 ./ch47 ...
user avatar
0 votes
3 answers
67 views

gdb-customize command, how to test whether a variable is set?

I'm debuging with gdb and need to define some helper commands. Basically I want my customized command to operate differently depending on the number of args given. So I have to test whether $arg* is ...
user avatar
  • 814