swift
swift

Reputation: 131

How to get filenames and line numbers in stack traces from embedded Mono?

I'm embedding Mono into a C application, and it works fine, but debugging is more difficult than it should be because when I print a stack trace in the Mono code (for example, in response to an exception) all of the lines of the stack trace say they are located in ":0". I'd like to have filenames and line numbers appear correctly in the Mono stack traces.

I'm building the Mono components of the application with xbuild, and I'm using a debug build. mdb files are being generated, and I've placed them in the same directory as the Mono assemblies that I'm loading. When I'm initialized the Mono domain on the C side, I've tried calling mono_debug_init(MONO_DEBUG_FORMAT_MONO), and registering the domain with mono_debug_domain_create(), but it doesn't seem to have any effect. Has anyone gotten this to work?

Upvotes: 3

Views: 947

Answers (1)

SpagnumMoss
SpagnumMoss

Reputation: 104

Do you need stack traces for your c program or the mono program ?

For C: If your using gcc, have you enabled debug info '-g'. You should check that your compilers LINE and FILE defines are compatible with your current compiler.

For Mono: Did you compile with debug flags set '-debug'.

Hope this helps

/Tony

Upvotes: 1

Related Questions