User forums > Using Code::Blocks
Debugging a library
johne53:
I have a C::B workspace which builds a library (shared object). The library is then linked to several executables which are all in their (separate) workspaces. I need to debug the library which in turn, requires me to run one of the executables. This is simple enough if the library and executable are part of the same workspace but in this case, they aren't.
How do I specifiy an executable to run, so that when I press F8, the debugger can start? I assumed that "attach to process" might do the trick - but although C::B goes through the motions, I get this output from the debugger (after the symbols have been loaded):-
--- Quote ---(gdb)
>>>>>>cb_gdb:
> show version
GNU gdb 6.8.0.20080328-cvs (cygwin-special)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-cygwin".
>>>>>>cb_gdb:
> set confirm off
>>>>>>cb_gdb:
> set width 0
>>>>>>cb_gdb:
> set height 0
>>>>>>cb_gdb:
> set breakpoint pending on
>>>>>>cb_gdb:
> set print asm-demangle on
>>>>>>cb_gdb:
> set unwindonsignal on
>>>>>>cb_gdb:
> set debugevents on
>>>>>>cb_gdb:
> set disassembly-flavor att
>>>>>>cb_gdb:
--- End quote ---
and then the running application freezes (i.e. becomes unresponsive to mouse clicks etc). Is there any alternative way to specify the executable? Or is it possible to load two workspaces simultaneously, so that I can run one while watching variables and break points in the other??
[Edit...] Some further information... I just realised that after attaching to a process, I need to select Debug->Continue which brings the external process back to life (in fact, it seems to restart it). However, this only works if I haven't set any break points. If I set some break points, Debug->Continue shuts the external process down but never re-starts it. Is there a better way to do this?
Jenna:
Did you try to specify the host-application for your target in "Project -> Set program's arguments..." ?
killerbot:
while reading this often called question, maybe it could be interesting to :
- put an entry for this in the debug menu ?
- no longer store this in the project file, but in a MyProject.debug file [interesting for version control systems, so no need to checkout/checkin the cbp file]
Just a wild idea ;-)
johne53:
--- Quote from: jens on December 31, 2008, 10:31:21 am ---Did you try to specify the host-application for your target in "Project -> Set program's arguments..." ?
--- End quote ---
Apologies - I knew I'd seen a field somewhere called "Host application" but I couldn't remember where.
--- Quote from: killerbot on December 31, 2008, 10:54:23 am ---while reading this often called question, maybe it could be interesting to :
- put an entry for this in the debug menu ?
- no longer store this in the project file, but in a MyProject.debug file [interesting for version control systems, so no need to checkout/checkin the cbp file]
Just a wild idea ;-)
--- End quote ---
It might be simpler to rename the menu item called "Set programs arguments" and call it "Set debug host & arguments"
johne53:
In any case, after about 5 weeks of trying to use this feature it's only worked in a handful of cases. Typically I select the library (usually a shared object) that I wish to debug. I then select Project->Set Programs' Arguments->Host Application. I navigate to the target executable (Debug version) and I uncheck the box that says "This target provides the project's main executable" (is that right?)
I then press F8 to start the debugger. In the vast majority of cases, the debugger (gdb) starts and I get to the "run" stage. The debugger output window then shows this error:-
No executable specified, use `target exec'
Am I doing something wrong?
Navigation
[0] Message Index
[#] Next page
Go to full version