Post# 1575395941

3-Dec-2019 11:59 pm


How to debug using "gdb" :

"What's gdb?"
A linux terminal based debugger for C.

"Why not visual studio?"
Because Linux doesn't have one.

"There's dotnet core!"
It only compiles C# and F# on Linux. Not C/C++

"Well, then how do you debug?"

That's what I was telling.

After the app crashes, run :

gdb myapp

dir src/ <-- the source code of your app. if it's not current dir.

run arguments <-- this will run the program.

[ after it crashes ]

bt <-- for back track

f 4 <-- frame 4, or whichever function [called frame] you want to monitor.

list <-- will list source lines. as in visual studio.

p varname <-- print value of variable. you can also print expression and function calls, this way.

[ when done ]

quit <-- to exit.

3-Dec-2019 11:59 pm

Published
3-Dec-2019