Search code examples
emacsgdbcaffe

Change the working directory when debug in emacs gdb?


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?


Solution

  • 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