Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [gdb]

The tag has no usage guidance.

0
votes
0answers
9 views

How to edit function from import table in process with gdb

How can I edit function from import table of process to invoke to another address. For example , my process has fopen function in import table , and has read in import table. I want to edit the ...
1
vote
0answers
22 views

How to analyze results after software-based fault injection campaign? [closed]

I am working on a software-based fault injection technique based on gdb to inject faults (bit flip) into a running program (c code). I have developed a tool to perform fault injecting at run-time. ...
0
votes
0answers
22 views

gdb-add-index to speed up binary load time in gdb

Very often I see gdb takes a long time to load large debug binary and I understand that if I put gdb-index section into binary, it should help reduce initial load time when binary is loaded into gdb. ...
0
votes
0answers
17 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 ...
0
votes
0answers
14 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?
0
votes
0answers
14 views

Find applications accessing certain memory address / trace memory access

Is there some way on Linux or Unix systems to determine if a distinct physical or virtual memory address has been accessed? I know the address or list of addresses but want to know if and what ...
0
votes
0answers
28 views

SIGSEGV on dlopen with gdb

I'm currently building a shared library. The goal is to inject this lib in a process. Unfortunaly when I inject this lib in the process I get a SIGESGV about ostream. Here is a MWE to reproduce the ...
0
votes
1answer
115 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. ...
1
vote
1answer
103 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 ...
0
votes
0answers
48 views

Debugging android kernel goldifish emulator under Mac OS Mojave

I need to debug android kernel goldfish under MacOS Mojave. So i cloned android-goldfish-3.18 and android-aosp-9.0.0_r22. I built aosp under macos while the kernel under debian. Obviously I built ...
0
votes
0answers
104 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 ...
0
votes
3answers
22 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 ...
5
votes
2answers
601 views

Safest way to force close a file descriptor

Sometimes you need to unmount a filesystem or detach a loop device but it is busy because of open file descriptors, perhaps because of a smb server process. To force the unmount, you can kill the ...
0
votes
1answer
66 views

tracking segfault upon invocation of perl script (mytop tool and similar)

on my gentoo machine, mytop 1.9.1 quits upon invocation with the following output: # mytop Useless use of private variable in void context at /usr/bin/mytop line 1001. "my" variable $data masks ...
0
votes
0answers
12 views

Thread scheduling behavior between steps of GDB compared to non-stepped execution

The GDB manual states that when using all-stop mode for debugging a multithreaded application, it is not possible to advance every thread in lock-step by exactly one statement. This makes sense since ...
4
votes
1answer
155 views

How to prevent a process from writing to the systemd journal?

I am using a third party .NET Core application (a binary distribution used by a VS Code extension) that unfortunately has diagnostic logging enabled with no apparent way to disable it (I did already ...
2
votes
2answers
78 views

How to build the GDB documentation from source?

I've downloaded the GDB source: git clone git://sourceware.org/git/binutils-gdb.git now how do I generate the documentation from source as can be downloaded from: https://sourceware.org/gdb/current/...
16
votes
2answers
3k views

What does C@t{++} mean in the gdb man page?

I was reading the manpage for gdb and I came across the line: You can use GDB to debug programs written in C, C@t{++}, Fortran and Modula-2. The C@t{++} looks like a regex but I can't seem to decode ...
4
votes
1answer
236 views

Why some libraries and other parts get repeated in the linux virtual memory with gdb?

This is the result of looking at virtual memory of a process in gdb; I have some questions regarding this: Why are some parts of the virtual memory are repeated? For example, our program (stack6) and ...
5
votes
1answer
360 views

How to produce a VLC stack trace?

I've reported a VLC bug and included the output of gdb's bt full, but the response from a project representative is that the trace is "incomplete". How can I produce a trace that would be usable to a ...
3
votes
2answers
3k views

gdb in one command

When I debug an executable program with arguments arg1 arg2 with gdb I perform the following sequence gdb file ./program run arg1 arg2 bt quit How can I do the same from one command line in shell ...
1
vote
0answers
401 views

Given a core-dump, how to get the files opened by the late process?

Answers to related questions all suggest using lsof or checking under /proc/NPID/, which is not helpful for when the process is already gone and only its core-dump remains. However, it should be ...
0
votes
1answer
211 views

Why does pstack launch gdb (and how to prevent it)?

Running pstack on a process sometimes causes gdb to attach to that process on one of my Linux servers. Why would pstack launch gdb, and how can I prevent that? Details: gdb is running as: /user/bin/...
1
vote
1answer
269 views

How to trace line by line by “gdb” C/C++ code? [closed]

I have installed gdb and added -g option to my compilation command, but when I try (gdb) s or (gdb) n it says: The program is not being run. It only works when I try (gdb) r and goes and stops ...
-1
votes
1answer
57 views

Powerline and gdb

GDB in TUI-Mode shows strange behaviour. I'm using powerline and it seems that the font is the wrong one. Exist there a solution to have a pretty command line? How can I invoke a program not using ...
0
votes
1answer
76 views

Install new development tools on old system

I run 32 bit Centos 6.9 Linux with installed development tools for it with command: yum groupinstall 'Development Tools' But it installs very old GCC and GDB. What is the best way to install newer ...
0
votes
0answers
548 views

Building newer GDB failed due C++11

I run 32 bit Centos Linux with gdb ver 7.2 on it. I need to update GDB. I got errors below while building GDB 8.1: checking whether g++ supports C++11 features by default... no checking whether g++ ...
1
vote
1answer
2k views

GDB command to print the address of starting of buffer (stack)

For gdb debugger (gdb) p &buffer This command is used to print the content of starting of buffer (stack), or print the address? If it is content, how to print the address?
4
votes
0answers
139 views

Interrupt a slow gdb command?

I unwisely asked gdb to list all defined functions. (gdb) info function Now it is excitedly slurping up CPU and memory. If I'm really quick about it, GDB will stop with Ctrl-C and give me a prompt ...
6
votes
3answers
961 views

GDB step in delays

I am making a nice presentation of ARM assembly code execution and I would need GDB to step the code every 1 second infinitely long (well until I press CTRL+C). Has anyone got solution? I don't want ...
2
votes
2answers
701 views

where does gdb put the log file?

This starts partially from why doesn't gdb like aliases Now I put the following arguments - gdb firefox-esr (gdb) set logging file my-firefox-esr-1802018.log (gdb) set pagination 0 (gdb) show ...
10
votes
4answers
1k views

why doesn't gdb like aliases [duplicate]

I made an alias ff and sourced it from ~/.zsh/aliases.zsh. The aliases run well themselves: alias ff ff='firefox --safe-mode' and it runs as expected. But when I try to run it under gdb I get: &...
3
votes
1answer
257 views

Accessing memory mapped registers in gdb

I'm trying to read (hopefully write as well) to the memory mapped hardware registers in a qemu virtual machine using gdb (remote connected). But it's just not working: (gdb) p *0x2000000 Cannot ...
4
votes
0answers
318 views

gdb hangs on “quit()”

When I want to close gdb, I frequently mistype quit() instead of quit Whenever that happens, gdb hangs indeterminately, and I end up using kill -9 gdb_pid to terminate it. I would like to ask: ...
2
votes
0answers
124 views

Is there anyway to verify validity of dlopen handle?

In my case after my program cas dlclose program is crashing and I am not getting stack trace for dlclose or any function on upper frames. I know handle value of dlclose . Is there anyway to check if ...
1
vote
1answer
1k views

How to quit an application running in gdb gracefully when the application isn't reponding.

This is somewhat related to gdb set overwrite logging on should overwrite gdb.txt correct? . Let's say I'm running a session of some application. For example purposes, let me take the example of ...
1
vote
2answers
3k views

Turning off kASLR to debug linux kernel using qemu and gdb

I'm trying to debug linux kernel using qemu and gdb. The problem is that gdb won't stop at breakpoint. I've searched about it and found that turning kASLR off may help, because kASLR confuses gdb. ...
1
vote
1answer
484 views

How do I find detached debug symbols for decompilation?

I am trying to debug a segfault without code a binary in a nonstandard path (specifically in /frs/alg/alg/bin/) and I was noticing that the decompiled code has fewer symbols than when debugging under ...
3
votes
1answer
225 views

gdb set overwrite logging on should overwrite gdb.txt correct?

I was looking at Logging Output and had been trying this particular command - set logging overwrite on AFAI understood it, that command is supposed to overwrite the contents of gdb.txt but it does ...
0
votes
1answer
337 views

Quit program run by GDB when terminate screen

I am running my program using screen and GDB. How I run my program: screen -dmS adapter "./run-adapter.sh" In run-adapter.sh gdb -ex "handle SIGPIPE nostop noprint pass" -ex run -args ./Adapter ...
4
votes
1answer
1k views

Hardware breakpoint in GDB +QEMU missing start_kernel

I am trying to debug a kernel running on QEMU with GDB. The kernel has been compiled with these options: CONFIG_DEBUG_INFO=y CONFIG_GDB_SCRIPTS=y I launch the kernel in qemu with the following ...
1
vote
1answer
42 views

Switching between shared buffers in emacs gdb mode without mouse (in text-terminal)

From the documentation link here: https://www.gnu.org/software/emacs/manual/html_node/emacs/Other-GDB-Buffers.html When gdb-many-windows is non-nil, the locals buffer shares its window with the ...
10
votes
3answers
5k views

Why does GDB need the executable as well as the core dump?

I'm debugging using core dumps, and note that gdb needs you to supply the executable as well as the core dump. Why is this? If the core dump contains all the memory that the process uses, isn't the ...
1
vote
0answers
63 views

Redirect the output to an already running program

I have a program running on terminal 1 and waiting for input from stdin. I programmed this program so it is vulnerable to buffer-overflow. I want to change it's flow to function2() within the program ...
0
votes
1answer
72 views

is there a way to know if signals are present in your application and which signals are there? [closed]

Please see what does `handle SIG33 pass nostop noprint` does when used in gdb . I am guessing from the answer shared by Stephen Kitt, that info. about signals is in the source code somewhere. If I ...
0
votes
1answer
741 views

what does `handle SIG33 pass nostop noprint` does when used in gdb

In gdb, the usual instructions for debugging given are - gdb $package set logging on set pagination 0 handle SIG33 pass nostop noprint run and of course than collecting backtraces and all. Of ...
1
vote
2answers
360 views

Can GDB decode core if it were piped?

I have huge core files, and hence set the core_pattern is set to gzip as they are written. Later if the backtrace is to be obtained, first gunzip has to be done (and it takes a very long time!) ...
2
votes
1answer
3k views

ptrace: Operation not permitted when attaching to a zombie process

I have a reproducible situation where a compiler instance goes into a zombie state when I rebuild a package, but gdb won't permit me to attach: serenity ~ # ps ax | grep defunct 11351 pts/1 Z+ ...
2
votes
1answer
2k views

gdb doesn't step into function although source is available

I have a shared library compiled with -g -O0 including: void MyClass::whatever() { ... doSomething(myImage, myPoints); ... } bool MyClass::doSomething(const Image& image, std::vector<cv:...
2
votes
1answer
852 views

Debug a setuid binary as non-root

I have a CentOS 7 system. I need to attach my GDB to an already running application, but get the (apparently usual) "ptrace: Operation not permitted." error. Running GDB as root prevents the error, ...