How do I debug a failing cargo test in GDB?

You can get a test binary to filter the tests it runs by passing additional arguments to it; Cargo exposes this directly, too. Thus, cargo test test_extract_failure will just run that specific case. (This is convenient if you have other tests that panic and are expected to fail, so that they won’t call the rust_panic … Read more

GDB kind of doesn’t work on macOS Sierra

This is how I easily fixed the issue. [Update: based on feedback received and yet to be verified, it seems that this solution works with macOS Sierra 10.12 but not with macOS Sierra 10.12.2] See video instructions here Quit gdb Using your text editor e.g. Sublime Text, save a file called .gdbinit in your user … Read more

How do I stop execution in GDB without a breakpoint?

Just use a regular interrupt Ctrl–c will work just fine. GDB just forwards the SIGINT to the debugging process which then dies. GDB will catch the non-standard exit and break the process there, so you can still examine all the threads, their stacks and current values of variables. This works fine, though you would be … Read more

View Both Assembly and C code

You can run gdb in Text User Interface (TUI) mode: gdb -tui <your-binary> (gdb) b main (gdb) r (gdb) layout split The layout split command divides the window into two parts – one of them displaying the source code, the other one the corresponding assembly. A few others tricks: set disassembly-flavor intel – if your … Read more

Why gdb casting is not working?

I just ran in to similar issue, and, from a colleague of mine, I learnt that you need to provide the namespace that the class belongs to within a single quotes as following: (gdb) p (‘MyScope::MyClass’*) ptr;

How to print variable in gdb

It means that the type of that variable has been incompletely specified. For example: struct hatstand; struct hatstand *foo; GDB knows that foo is a pointer to a hatstand structure, but the members of that structure haven’t been defined. Hence, “incomplete type”. To print the value, you can cast it to a compatible type. For … Read more

How to interpret GDB “info frame” output?

(gdb) info frame stack level 0 Frame number in backtrace. 0 is the current executing frame, which grows downwards, in consistence with the stack. frame at 0xb75f7390 Starting memory address of this stack frame. eip = 0x804877f in base::func() (testing.cpp:16); saved eip 0x804869a eip is the register for the next instruction to execute (also called … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)