[Mono-list] Addresses marked as ??? in Valgrind stack trace

Kerrick Staley mail at kerrickstaley.com
Tue Oct 9 16:40:56 UTC 2012


On Thu, Oct 4, 2012 at 1:40 PM, Tom Hughes <tom at compton.nu> wrote:
> The "mono_jit_runtime_invoke" is a big clue - those will be run time
> generated code that the JIT has created so they won't be in the symbol table.

Ah, that makes a lot more sense than my theory.

On Thu, Oct 4, 2012 at 1:50 PM, Philippe Waroquiers
<philippe.waroquiers at skynet.be> wrote:
> If that is effectively the case, have you given
> the argument --smc-check=all (or =all-non-file) ?
> One of these two is for sure mandatory in a JITted env (on x86/amd64
> at least).

Yes, I'm passing this argument.

> Otherwise, you might always try using gdb/vgdb to connect to the process
> under Valgrind when the error is raised : gdb might maybe help
> to see what is going on.

You mean I should use --db-attach=yes (as Greg suggested)?

On Thu, Oct 4, 2012 at 5:38 PM, Gregory Junker <gjunker at dayark.com> wrote:
> Well, for starters, you can look at what line 5791 in mini.c is doing:
>
> https://github.com/mono/mono/blob/master/mono/mini/mini.c

Not everyone runs master :)

https://github.com/mono/mono/blob/mono-2-10-9/mono/mini/mini.c#L5791

It looks like the line is calling runtime_invoke, which means it's
running JIT code (as others suggested).

> One thing you can do with Valgrind is have it break to debugger on errors,
> by supplying the --attach-db=yes option. If you still can't get function
> names in GDB, you may be able to get module names (the addresses look to be
> in different modules than the Mono runtime), and from there you might have
> to get your hands dirty with nm or objdump.

OK, I'll try seeing what I can turn up with gdb. Initial results
aren't promising; when I try the disassemble command at the site of
the error, it tells me "No function contains program counter for
selected frame".

On Fri, Oct 5, 2012 at 1:11 PM, Rodrigo Kumpera <kumpera at gmail.com> wrote:
> Mono features a JIT that dynamically generates code and those unknown frames
> are precisely that.
> Look at the man page to see how to enable valgrind integration to show
> actual names instead.

Per the manpage, I tried setting MONO_XDEBUG=true and passing
--debug=gdb to Mono; neither caused the ???'s to be replaced with
useful information. Mono generated an xdb.il and an xdb.s file when I
did this, but it doesn't seem like GDB can use these files. I'm going
to see if I can get anywhere with the --aot flag (enabling
ahead-of-time compilation).

I also noticed this blog post describing Valgrind integration for Mono:

http://tirania.org/blog/archive/2007/Jun-29.html

but it doesn't appear that that patch ever made it into Mono:

https://github.com/search?q=repo%3Amono%2Fmono+JitEntry&type=Code

- Kerrick


More information about the Mono-list mailing list