Author Topic: Debugging native shared lib using Mono C# “driver” application  (Read 6505 times)

Offline edwin

  • Multiple posting newcomer
  • *
  • Posts: 38
Hello C::B team,

I am hoping someone here can assist with a debugging question.


I have created a Linux and OS X port of a VOIP library (using C::B). All is good. Now I need to test the shared lib’s API.

This is what I have:
1) “driver” test application (C#),
2) Managed code <--> native code wrapper (C++/CLI),
3) The shared library (native C++ code).

The test “driver” code was developed using Monodevelop C# compiler.
The “wrapper code” was developed using Microsoft C++/CLI (its all MISL code).

Both of the above are OK and have been tested for running under Mono.


What I would like to do is use C::B to debug the native shared library.

I thought I could simply specify the C# driver app as the shared lib’s executable and simply start it under the C::B debugger in the IDE but no go. Looks like the debugger does not want to start because it cannot locate debugging symbols in the C# driver app.

Here is what is logged in the debugger log window when I attempt to start a debug session:

Building to ensure sources are up-to-date
Build succeeded
Selecting target:
Debug Linux32
Adding source dir: /home/user/mycode/ShareLibCode /
Adding source dir: /home/user/mycode/
Adding file: /home/ user /111/MonoProjects/Tester/Tester/bin/Debug/Tester.exe
Starting debugger:
done
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Registered new type: CString
Setting breakpoints
Reading symbols from /home/user/111/MonoProjects/Tester/Tester/bin/Debug/Tester.exe...(no debugging symbols found)...done.
Debugger name and version: GNU gdb (GDB) 7.1-ubuntu
Child process PID: 8850
Program exited with code 01.
Debugger finished with status 0


I am probably tired and doing something dumb. If anyone would like to assist, that would be terrific.

I am also looking at the debugger support in monodevelop but I am not sure if it will do what I want (native only or mixed mode debugging).


Thank you,

edwin



Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Debugging native shared lib using Mono C# “driver” application
« Reply #1 on: August 26, 2010, 10:59:06 pm »
Enable the debugger's debug log ( Settings -> Compiler & Debugger -> Debugger -> Show Debugger's debug log )
and try again... probably a library is not found.
(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: Debugging native shared lib using Mono C# “driver” application
« Reply #2 on: August 27, 2010, 12:26:55 pm »
oBFusCATed,

Thanks for the tip. That was exactly what was occurring. The native shared lib was not being found. I will definitely use the debugger log more in the future when running into problems like this.

Now using a mono C# app, I can hit breakpoints in the native code shared library. Onward…

Thank you,

edwin



Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Debugging native shared lib using Mono C# “driver” application
« Reply #3 on: August 27, 2010, 01:02:09 pm »
Great :)

Probably the debugger should print this error to the normal log,
so users wouldn't have to dig in the debug log.
Adding to my TODO.
(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!]