Author Topic: Not hitting dylib breakpoints on Mac OS X - Need assistance  (Read 6835 times)

Offline edwin

  • Multiple posting newcomer
  • *
  • Posts: 38
Not hitting dylib breakpoints on Mac OS X - Need assistance
« on: March 30, 2011, 06:01:28 pm »
Hello,

Was wondering if someone could shed some light on a problem I have. I cannot hit breakpoints in my native dylib when debugging on Mac OS X. I searched the C::B forums but did not find a solution.

More Info:
I am using C::B SVN6336 on Mac OS X 10.6.4.

I am developing a native dylib that is called by a mono C# application via a C++/CLI managed code wrapper.

The managed Mono app is developed using MonoDevelop.
The C++/CLI bridge code is developed using Microsoft’s tool chain.
The native dylib is developed using C::B on the Mac.

Everything works fine but I need to debug from the standpoint of the Mac dylib.
In the C::B IDE, I have the workspace of the dylib opened.

Via Project->Set program’s arguments, I have specified the following:

Host application: /usr/X11/bin/xterm
Program arguments: -T Debugging –e mono MyMonoTestApp.exe

When I start debugging, an X term window gets displayed, the mono test app executes and writes to the xterm output window fine.

The break points I set inside the dylib never get hit by gdb. I see I have a symbol load problem and that is why the breakpoint is not getting set.

I am not sure how to solve this.

Here is debugger window output from C::B that is the result of running the external Mono test app from within the IDE. I then terminate it from within the IDE once I know my BPs have been missed:

Code
DYLD_LIBRARY_PATH=.:
Command-line: /usr/bin/gdb -nx -fullname  -quiet -args /usr/X11/bin/xterm
Working dir : /Development/VOIPMediaEngine/sip/Win32UA_DLL/
> set prompt >>>>>>cb_gdb:
Reading symbols for shared libraries .......... done
(gdb) >>>>>>cb_gdb:
> show version
GNU gdb 6.3.50-20050815 (Apple version gdb-1469) (Wed May  5 04:36:56 UTC 2010)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin".
>>>>>>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 disassembly-flavor intel
>>>>>>cb_gdb:
> catch throw
>>>>>>cb_gdb:
> source /Applications/AppNew/CodeBlocks.app/Contents/Resources/share/codeblocks/scripts/stl-views-1.0.3.gdb
>>>>>>cb_gdb:
> cd ../../BinaryImages/DebugMac32
>>>>>>cb_gdb:
> directory /Development/VOIPMediaEngine/sip/Win32UA_DLL/
>>>>>>cb_gdb:
> directory /Development/VOIPMediaEngine/
>>>>>>cb_gdb:
> set args  -T Debugging -e mono VoipMediaEngineConsoleTestMono.exe
>>>>>>cb_gdb:
> handle SIGXCPU SIG33 SIG35 SIGPWR nostop noprint
>>>>>>cb_gdb:
> break "/Development/VOIPMediaEngine/SubModules/PortPackage/PortPackage.cpp:273"
No symbol table is loaded.  Use the "file" command.
Breakpoint 1 ("/Development/VOIPMediaEngine/SubModules/PortPackage/PortPackage.cpp:273) pending.
>>>>>>cb_gdb:
> run
Reading symbols for shared libraries .+++++++++..........
.
.
.
....
..
...
..
...
..
.
.
..
..
... done
Catchpoint 2 (throw)
Program received signal SIGINT, Interrupt.
0x00007fff85d96dce in select$DARWIN_EXTSN ()
>>>>>>cb_gdb:
> info registers
rax            0x4 4
rbx            0x0 0
rcx            0x7fff5fbff738 140734799804216
rdx            0x10005bd00 4295343360
rsi            0x10005bd80 4295343488
rdi            0x5 5
rbp            0x7fff5fbff7b0 0x7fff5fbff7b0
rsp            0x7fff5fbff738 0x7fff5fbff738
r8             0x0 0
r9             0x0 0
r10            0x0 0
r11            0x246 582
r12            0x10083d200 4303606272
r13            0x10005bd80 4295343488
r14            0x10083d378 4303606648
r15            0x0 0
rip            0x7fff85d96dce 0x7fff85d96dce <select$DARWIN_EXTSN+10>
eflags         0x247 583
cs             0x2f 47
ss             0x0 0
ds             0x0 0
es             0x0 0
fs             0x10 16
gs             0x48 72
>>>>>>cb_gdb:
> bt 30
#0  0x00007fff85d96dce in select$DARWIN_EXTSN ()
#1  0x0000000100011589 in VTparse ()
#2  0x00000001000117b8 in VTRun ()
#3  0x000000010001e239 in main ()
>>>>>>cb_gdb:
> quit


Thanks,

edwin


« Last Edit: March 30, 2011, 07:55:16 pm by edwin »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Not hitting dylib breakpoints on Mac OS X - Need assistance
« Reply #1 on: March 30, 2011, 06:14:28 pm »
Have you read this: http://wiki.codeblocks.org/index.php?title=Debugging_with_Code::Blocks ?

p.s. please use code tags for long pastes
(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 edwin

  • Multiple posting newcomer
  • *
  • Posts: 38
Re: Not hitting dylib breakpoints on Mac OS X - Need assistance
« Reply #2 on: March 30, 2011, 07:15:33 pm »
Yes, I have read that information…

Reading that doc again sparked a thought. I am stripping the symbol information from the dylib into a separate dSYM directory using the dsymutil and strip utilities (post C::B build). I thought this may be causing grief so I temporarily disabled it.

I tried debugging again with all the symbol info in the dylib and no go. The same issue occurs.

I will keep looking…

Funny thing, when I use a native test code app and the dylib, everything is OK. I’m missing something simple…

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Not hitting dylib breakpoints on Mac OS X - Need assistance
« Reply #3 on: March 30, 2011, 07:30:03 pm »
You should try to make it work with the command line gdb.
There you can enter commands more easily, and you can debug what is going on.
If I were you I would have listed the symbols (see the manual for the commands), there is a chance C::B to use the wrong paths, when setting breakpoints.

Also check if there is newer version of gdb, unfortunately Apple had stopped to synchronize
their gdb with FSF's gdb and they lack many features.
(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 edwin

  • Multiple posting newcomer
  • *
  • Posts: 38
Re: Not hitting dylib breakpoints on Mac OS X - Need assistance
« Reply #4 on: March 30, 2011, 07:53:32 pm »
Command line gdb testing - that's a good idea. I will try that and repost when I figure it out...

If you think of anything else, that would be great.  :)

Thanks very much.