Author Topic: [SOLVED] How to Debug a project in another folder.  (Read 5003 times)

Offline Napoleon

  • Multiple posting newcomer
  • *
  • Posts: 59
[SOLVED] How to Debug a project in another folder.
« on: April 12, 2014, 05:27:03 am »
[Ubuntu 13.10, C++ project]

I have an existing project that breaks if I place the Code::Blocks project files in its folder structure.  I don't know why, but it has something to do with the Makefile copying files into the 'build.host' folder it creates during the build.

So I set up a 'sideline' CB project in a separate folder such that they share the same parent.  I've configured the make settings to use custom commands and custom makefile.  I've also pointed all the folder names appropriately into the original project.  Having done so, I can successfully build and clean the original project.

Now I need to debug the original project as there is something it's doing that isn't right.

When I click Debug/Continue, it rebuilds, starts the debugger, but then tells me that 'No executable file specified.'

From the logs below, it is clear why I get the error.  The executable I want to debug is "/home/nap/src/mil/ganow/posix/gafsm/cldrm/clfrm" but the debugger is looking for "/home/nap/src/mil/ganow/posix/gafsm/cldrm_head/cldrm".

Where can I set the location of the executable which the debugger should use?
Another option is to get the executable into the .../cldrm_head folder somehow, but I have no idea how to do this through CB, and I cannot change the Makefile.

Any ideas please?

Cheers,
Nap


Build Log:
Code
-------------- Build: host in cldrm (compiler: LLVM Clang Compiler)---------------

Running command: bmake CFLAGS?=-g host E=
mkdir -p build.host
rm -rf build.host/build.host
cp -p ../gasmf/*.c*  ../gasmf/*.h build.host
cp -p *.c* *.h build.host
cp -p Makefile.in build.host/Makefile
cd build.host && ln -s . build.host
cd build.host && bmake host
mkdir -p build.host
bmake  .MAKE.LEVEL.ENV=MAKELEVEL CFLAGS=-g E= pre-build
touch build.host/.pre-build-cookie
linking output build.host/cldrm
env  /usr/bin/clang++  -rdynamic -o build.host/cldrm   -g  -lrt -stdlib=libstdc++ build.host/ga_util.o build.host/gagenericlistobject.o build.host/gatcpinjectionlistobject.o build.host/list.o build.host/gasimplelist.o build.host/galisttypelist_c_typestrings_generated.o build.host/cldrm_cc.o build.host/cldrm_machine.o build.host/cldrm_main.o -Wl,-R/usr/local/lib -L/usr/local/lib -lcldrm -ldl -ldispatch -lBlocksRuntime -lpthread_workqueue -lkqueue -lpthread  -L/usr/lib/x86_64-linux-gnu -Wl,-R/usr/lib/x86_64-linux-gnu -lc++ -lsupc++
mkdir -p build.host
bmake  .MAKE.LEVEL.ENV=MAKELEVEL CFLAGS=-g E= pre-build
touch build.host/.pre-build-cookie
Process terminated with status 0 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))

Debugger Log:
Code
Building to ensure sources are up-to-date
Selecting target:
host
Adding source dir: /home/nap/src/mil/ganow/posix/gafsm/cldrm_head/
Adding source dir: /home/nap/src/mil/ganow/posix/gafsm/
Adding file: /home/nap/src/mil/ganow/posix/gafsm/cldrm_head/cldrm
Changing directory to: /home/nap/src/mil/ganow/posix/gafsm/cldrm
Set variable: LD_LIBRARY_PATH=.:
Starting debugger: /usr/bin/gdb -nx -fullname  -quiet  -args /home/nap/src/mil/ganow/posix/gafsm/cldrm_head/cldrm
done
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
Debugger name and version: GNU gdb (GDB) 7.6.1-ubuntu
Starting the debuggee failed: No executable file specified.
Debugger finished with status 0
« Last Edit: April 12, 2014, 11:25:28 am by Napoleon »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: How to Debug a project in another folder.
« Reply #1 on: April 12, 2014, 10:45:14 am »
Where can I set the location of the executable which the debugger should use?
Project -> Properties -> Build targets -> Output filename
also
Project -> Properties -> Build targets -> Execution working dir might be worth setting to something appropriate.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Napoleon

  • Multiple posting newcomer
  • *
  • Posts: 59
Re: How to Debug a project in another folder.
« Reply #2 on: April 12, 2014, 11:25:04 am »
Thanks oBFusCATed
I tried those before I posted but wasn't sure I was doing it right because my choices weren't working.

After reading your response, I tried choices I hadn't earlier, and now its working!!  :)
I set the output file name to include the whole path, and I set the Execution Working Directory to the path where the output file is at (without the trailing slash).

Cheers,
Nap