cgdb is a lightweight curses (terminal-based) interface to the GNU Debugger (GDB). In addition to the standard gdb console, cgdb provides a split screen view that displays the source code as it executes. The keyboard interface is modeled after vim, so vim users should feel at home using cgdb.
Questions tagged [cgdb]
37 questions
17
votes
1 answer
How to scroll the gdb window within cgdb?
While using cgdb, how does one scroll through the output visible in the gdb window?

Vincent Scheib
- 17,142
- 9
- 61
- 77
12
votes
1 answer
How to use colors in GDB with TUI or CGDB?
I set a color for the GDB prompt by adding this line to ~/.gdbinit:
set prompt \033[0;32m(gdb) \033[0m
This works fine in GDB, until I open the TUI. It then discards the colors and shows the raw color codes. The same thing happens if I use…

Ashwin Nanjappa
- 76,204
- 83
- 211
- 292
12
votes
4 answers
python exception No module named gdb:
I've just compiled gdb 7.8 from source in my home directory on a server machine running linux. I had previously been using gdb 7.6, and aside from stability issues with gdb itself (the reason for the upgrade) everything worked fine.
Since the…

quant
- 21,507
- 32
- 115
- 211
12
votes
2 answers
Execute to Line in GDB
I can execute up to a specific line in GDB by placing a breakpoint there and then pressing c to continue execution.
b ; insert breakpoint
c ; run up to the breakpoint
del ; remove breakpoint
Is there a command to…
user1157123
9
votes
3 answers
How to make cgdb show assembly code?
I can't find a way for cgdb to disassemble a binary and show the assembly code with the current instruction in the code window. Is this possible and what command should I use? I'm using Mac OS X and got cgdb from the homebrew repository.

norq
- 1,404
- 2
- 18
- 35
8
votes
3 answers
SIGABRT in malloc.c, what just happened?
I wrote this innocent piece of code, and results in such an evil error:
static char * prefixed( char * pref, char *str ) {
size_t newalloc_size = sizeof(char) * (strlen(pref) + strlen(str));
char * result = (char*) malloc( newalloc_size );
…

musicmatze
- 4,124
- 7
- 33
- 48
5
votes
1 answer
gdb log file format
When I use set logging on in gdb, the output to the log file has a different format than what I see on the terminal screen. The logfile is not very readable. How can I get the log file in a readable format?
Output to screen is fine:
(gdb) p foo
$1 =…

matthiash
- 3,105
- 3
- 23
- 34
4
votes
1 answer
GDB step (in) isn't working for std::string
Using GDB (CGDB) I can step into the code of C++ standard library containers such as std::vector or std::set, but not std::string. Does anyone know why? Can I somehow enable this? I am using Ubuntu 20.04.
#include
#include
#include…

user2023370
- 10,488
- 6
- 50
- 83
4
votes
3 answers
Jump to current line being executed in cgdb
Is it possible to jump to current line being executed in the Source Window of cgdb?
It would be great to have a command or a shortcut to do this, especially after browsing files in the File Dialog mode for a long time.

tonyo
- 433
- 7
- 14
3
votes
2 answers
List all Processes & Threads under processes from Linux core dump using gdb
I am developing a scripting tool for gdb/linux core dump, where if I point script to core bump , it lists all stack traces of all threads under process i.e, what I am trying to achieve is pretty much gdb equivalent of windbg's !process 0 which…

Ganesh
- 71
- 1
- 3
3
votes
3 answers
gdb - execute current line without moving on
This has probably been asked elsewhere, but was a bit of a tricky one to google.
I am debugging some code like the following in gdb (or cgdb more specifically):
if(something) {
string a = stringMaker();
string b = stringMaker();
}
As I step…

rbennett485
- 1,907
- 15
- 24
2
votes
2 answers
Process crashed in debugger; how do I kill it
I've got a C++ application which connects over a USB serial link to a microprocessor, (similar to an Arduino). I use termios.h as my serial wrapper.
I'm debugging using cgdb on Mac OS X 10.7.3.
When I:
cgdb build/my-process
Set some breakpoints,…

simont
- 68,704
- 18
- 117
- 136
2
votes
0 answers
How do I properly enable ANSI escape sequences in cgdb?
I am using CGDB version 0.6.7 (latest available from apt) on WSL2. Colors are showing properly in the code window, but I see sequences like [34m in the lower window. See the screenshot below:
The only way I have found to get rid of these is by…

nullromo
- 2,165
- 2
- 18
- 39
2
votes
0 answers
debug docker deamon with gdb or cgdb
I have been trying to debug and step into docker daemon code using gdb or cgdb on a Ubuntu 14.04 container running on host OS (ubuntu 14.04 OS). I have used -O0 -g flags while building the debug binaries within a container.
Version of go used in…

Greg Petr
- 1,099
- 2
- 11
- 18
2
votes
1 answer
Debugging with cgdb -- want to debug only my code
I am using standard template libraries along with boost. I want to debug code using cgdb. But I just want to debug my code while doing next and step in cgdb, like right now it enters the code in other libraries whereas I want it should just return…

rkb
- 10,933
- 22
- 76
- 103