# What's the best front end for gdb ? Or some other debugger ?



## jianu81 (Jun 25, 2018)

I tried learning gdb but I just can't, I don't like it at all. I need something clickable, I mean I use the terminal most of the time, even for browsing files but I just don't like gdb and I'd prefer a GUI.


----------



## SirDice (Jun 25, 2018)

"Best" is subjective, what's best for me might be an utter disaster for you. That said, you may want to have a look at devel/ddd.


----------



## kpedersen (Jun 25, 2018)

Have you tried `gdb -tui`? It gives it more of an interactive interface (still in a terminal though which is a massive benefit).

Otherwise there is Insight (https://sourceware.org/insight/screenshots.php) that looks good but I have never actually used it.

And finally, if you can stand an IDE (perhaps just for debugging), then Code::Blocks (perhaps the quickest), QtCreator, Eclipse, Oracle Studio all provide GDB integration.


----------



## jianu81 (Jun 25, 2018)

kpedersen SirDice forgot to mention it is for x86 assembly.Do any of those work ?


----------



## obsigna (Jun 25, 2018)

Perhaps the GUI mode of lldb would be interesting for you. Below is a screenshot of a debugging session of an early development project of mine which runs fine on an older i5 but crashes on a new i7 because of a vector alignment issue.

Invocation: `lldb -- ./your_program [arg1 [arg2] ...]`

Then on the lldb command line you would need to set breakpoints and then type run. Once the program stopped, either because of the breakpoint, or because of a crash as shown below, you type gui on the lldb command line.


----------



## kpedersen (Jun 25, 2018)

jianu81 said:


> kpedersen SirDice forgot to mention it is for x86 assembly.Do any of those work ?



The *-tui* option in GDB should still be fine for that.

Hmm, you might need to try the others. I have seen an assembly listing in Code::Blocks before so I believe it can do it. I would assume that Insight would.

Other than that, you may want to try out Radare2. It is mostly for reverse engineering existing binaries (Kinda similar to OllyDbg and IDA Pro). I used to be its the port maintainer for FreeBSD but I didn't have time to keep it up to date. I don't know what the current state of it is these days.


----------



## jianu81 (Jun 25, 2018)

well so far Insight looks perfect.Thanks for all your help.lldb sounds like it has completely different instructions.


----------



## balanga (Jun 25, 2018)

kpedersen said:


> Have you tried `gdb -tui`? It gives it more of an interactive interface (still in a terminal though which is a massive benefit).



Thanks for pointing out the '-tui' option.... simplifies things quite a bit.

I tried running gdb under emacs but it seems too complicated. I guess I need to brush on emacs to make the most of the combination.


----------



## Deleted member 54719 (Jul 1, 2018)

So debugging core.* dumps of  c++ code compiled with -O0 and -g I get really weird results with both gdb and ddd in freeBSD.  ddd won't display the source lines at all, and gdb gave bogus backtrace information, missing  (or optimizing out) several frames and jumped from main() to a std::string::length() method that was nested three frames down.

I don't want to spend time screwing with it until I get a better understanding of the position and direction of the freeBSD project with regard to source debugging.  I've read comments such as:

1) gdb will be depricated in future releases, and
2) ddd is broken/not-supported in freeBSD? 
What's up with that?

and I'm not interested in other GUI debuggers that may have bloated GUI library or desktop environment requirements.  That's why I use ddd: it's about as close to pure X11 libXt as you can get.


----------



## kpedersen (Jul 2, 2018)

tempest766 said:


> 1) gdb will be depricated in future releases, and



GDB will be removed from FreeBSD base once Clang/LLVM / LLDB matures (and probably once 99% of ports compile with it). But no, it wont be deprecated. A simple `pkg install gdb` will be all that is needed.

I generally don't use GUI debuggers but I believe Insight (if it exists in the ports collection) is pretty much libXt only. At the very worst, libXm.

It is odd though.. I have never really found gdb to be that flaky. What version are you using? Perhaps try the latest gdb from ports. Remember, the one in base is pretty ancient (with patches) due to the less permissive licensing of GPL.

Again, depending on your version (i.e on 7.1), try compiling with *-Og*. I personally have always got away with specifying no *-O* option when *-g* is specified but your usecase may differ.
"some compiler passes that collect  information useful for debugging do not run at all, so that -Og may result in a better debugging experience." - GCC manpage.


----------



## Deleted member 54719 (Jul 2, 2018)

kpedersen - I think I can explain the gdb flakiness now.  It has to do with template code, which IMHO, has had issues in gdb as far back as I can remember.  I really need ddd fixed in fbsd.  insight is tcl/tk based so not my first preference.  Will experiment with -Og


----------



## schorsch_76 (Jul 10, 2018)

You could try cgdb .It is in the ports tree.
https://github.com/cgdb/cgdb


----------

