Reputation: 381
As I open emacs and enter :
M+x gdb
Run gdb (like this): gdb im=mi /home/qinchen/major/caffe/caffe_gdb/build/tools/caffe
And then input:
run train --solver=examples/mnist/lenet_solver.prototxt
But it reports : i
o.cpp Check failed: fd!=-1. file not found:examples/mnist/lenet_solver.prototxt
I guess if the error is triggered by emacs' current working directory is not in CAFFE_ROOT. Since as I debug in linux terminal in CAFFE_ROOT directory with
gdb --args build/tools/caffe train --solver=examples/mnist/lenet_solver.prototxt
I can successfully debug this demo.So can anyone help me to set emacs working directory to CAFFE_ROOT when debug in gdb to eliminate the error reported above?
Upvotes: 3
Views: 1307
Reputation: 2077
I personally find it pretty annoying copying and pasting the absolute path to my executable so I normally just run it this way:
M+x
then gdb
and run with the default command: gdb -i=mi
Better yet, if you use Projectile, you can do projectile-run-gdb
(or C-c p x g
) to run gdb with the project root as the CWD. This way you can just pass: gdb -i=mi build/tools/caffe
. This is pretty handy for me since my build
directory is normally in my project root.
If you don't use projectile, when in the gdb interface, doing pwd
tells you where you are. I just usually have to cd
once or twice to get to the working directory I'd like to be in. Then just doing file build/tools/caffe
opens the file for debugging and you're ready to go.
Pasting or editing paths/args into the mini-buffer can be infuriating for me. This way I just run it, change a directory or two, and work with a relative path as I would in the console.
Upvotes: 2
Reputation: 144
simple:
M+x gdb
gdb -i=mi -cd /home/qinchen/major/caffe/caffe_gdb --args build/tools/caffe train --solver=examples/mnist/lenet_solver.prototx
Upvotes: 2