Translate between managaed java and unmanaged jvm

J

JR

Hello All -
When I debug .net ihave the docs and automated tool to interpret .net
managed objects from unmanaged code. So when i dump a native callstack
and see mscorwks.dll->CallMethDesc, i know that that is the native
code used to call into the .net managed code. I can then translate
mscorwks.dll->CallMethDesc to myclass->myNetFunction with one command.
This way i can debug mixed managed and unmanaged code very easily. I
assumed Java would be similiar but i have ben unabale to find tools or
documents that explain what method(s) in jvm.dll actually invoke the
managed java methods and how to get that info. For example, I have
this stack


08c3faac 7c827d0b 77e61d1e 000005ec 00000000 ntdll!KiFastSystemCallRet
08c3fab0 77e61d1e 000005ec 00000000 00000000 ntdll!
NtWaitForSingleObject+0xc
08c3fb20 77e61c8d 000005ec ffffffff 00000000 kernel32!
WaitForSingleObjectEx+0xac
08c3fb34 080a686e 000005ec ffffffff 0334b7e0 kernel32!
WaitForSingleObject+0x12
08c3fb70 080c119d 0334b660 1e20dd80 0334b660 jvm!JVM_FindSignal
+0x19be2
08c3fb90 0806aee5 0334b7e0 08c3fbc4 0334b660 jvm!
JVM_RegisterPerfMethods+0x13126
08c3fbb0 00887a7e 0334b660 08c3fbc4 00887a52 jvm+0x6aee5
08c3fbe8 00882c03 00000000 00000000 103f98f8 0x887a7e
08c3fc1c 00882c03 00000000 103f98f8 103f9558 0x882c03
08c3fc50 00882cda 103f9558 1e20de20 08c3fc60 0x882c03
08c3fd64 08070c8a 08c3fd98 08c3ff3c 0000000a 0x882cda
08c3fde4 080aab6d 0000000a 00000000 08c3fe94 jvm+0x70c8a
08c3fe20 08070b97 08070b9c 08c3ff34 08c3fe48 jvm!JVM_FindSignal
+0x1dee1
08c3fe3c 08070893 08c3ff34 0334b7dc 08c3fe94 jvm+0x70b97

i know this is executing a managed function but don't know how to get
that data. Does anyone know the tools or methods used to do this? It
looks like the jvm!JVM_FindSignal function is responsible for setting
up and calling managed java code but i am not sure.
 
A

Arne Vajhøj

When I debug .net ihave the docs and automated tool to interpret .net
managed objects from unmanaged code. So when i dump a native callstack
and see mscorwks.dll->CallMethDesc, i know that that is the native
code used to call into the .net managed code. I can then translate
mscorwks.dll->CallMethDesc to myclass->myNetFunction with one command.
This way i can debug mixed managed and unmanaged code very easily. I
assumed Java would be similiar but i have ben unabale to find tools or
documents that explain what method(s) in jvm.dll actually invoke the
managed java methods and how to get that info.

managed-unmanaged is not prioritized as high i Java as
in .NET, so I am not surprised that the tool support is
not as good.

But somewhere there must be some map for jvm.dll.

The extreme solution for you would be to get OpenJDK
and build it with the options to debug it.

Arne
 
L

Lew

JR said:
When I debug .net i [sic]have the docs and automated tool to interpret .net
managed objects from unmanaged code. So when i [sic] dump a native callstack
and see mscorwks.dll->CallMethDesc, i [sic] know that that is the native
code used to call into the .net managed code. I can then translate
mscorwks.dll->CallMethDesc to myclass->myNetFunction with one command.
This way i [sic] can debug mixed managed and unmanaged code very easily. I
assumed Java would be similiar but i [sic] have ben unabale to find tools or
documents that explain what method(s) in jvm.dll actually invoke the
managed java [sic] methods and how to get that info. For example, I have
this stack


08c3faac 7c827d0b 77e61d1e 000005ec 00000000 ntdll!KiFastSystemCallRet
08c3fab0 77e61d1e 000005ec 00000000 00000000 ntdll!
NtWaitForSingleObject+0xc
08c3fb20 77e61c8d 000005ec ffffffff 00000000 kernel32!
WaitForSingleObjectEx+0xac
08c3fb34 080a686e 000005ec ffffffff 0334b7e0 kernel32!
WaitForSingleObject+0x12
08c3fb70 080c119d 0334b660 1e20dd80 0334b660 jvm!JVM_FindSignal
+0x19be2
08c3fb90 0806aee5 0334b7e0 08c3fbc4 0334b660 jvm!
JVM_RegisterPerfMethods+0x13126
08c3fbb0 00887a7e 0334b660 08c3fbc4 00887a52 jvm+0x6aee5
08c3fbe8 00882c03 00000000 00000000 103f98f8 0x887a7e
08c3fc1c 00882c03 00000000 103f98f8 103f9558 0x882c03
08c3fc50 00882cda 103f9558 1e20de20 08c3fc60 0x882c03
08c3fd64 08070c8a 08c3fd98 08c3ff3c 0000000a 0x882cda
08c3fde4 080aab6d 0000000a 00000000 08c3fe94 jvm+0x70c8a
08c3fe20 08070b97 08070b9c 08c3ff34 08c3fe48 jvm!JVM_FindSignal
+0x1dee1
08c3fe3c 08070893 08c3ff34 0334b7dc 08c3fe94 jvm+0x70b97

i [sic] know this is executing a managed function but don't know how to get
that data. Does anyone know the tools or methods used to do this? It
looks like the jvm!JVM_FindSignal function is responsible for setting
up and calling managed java [sic] code but i [sic] am not sure.

Don't do that.

The word "managed" has no relevance in Java because the word "unmanaged" has
no meaning. Everything is "managed". There is no "managed function", just
"method".
 
J

JR

JR said:
When I debug .net i [sic]have the docs and automated tool to interpret ..net
managed objects from unmanaged code. So when i [sic] dump a native callstack
and see mscorwks.dll->CallMethDesc, i [sic] know that that is the native
code used to call into the .net managed code. I can then translate
mscorwks.dll->CallMethDesc to myclass->myNetFunction with one command.
This way i [sic] can debug mixed managed and unmanaged code very easily.. I
assumed Java would be similiar but i [sic] have ben unabale to find tools or
documents that explain what method(s) in jvm.dll actually invoke the
managed java [sic] methods and how to get that info. For example, I have
this stack
08c3faac 7c827d0b 77e61d1e 000005ec 00000000 ntdll!KiFastSystemCallRet
08c3fab0 77e61d1e 000005ec 00000000 00000000 ntdll!
NtWaitForSingleObject+0xc
08c3fb20 77e61c8d 000005ec ffffffff 00000000 kernel32!
WaitForSingleObjectEx+0xac
08c3fb34 080a686e 000005ec ffffffff 0334b7e0 kernel32!
WaitForSingleObject+0x12
08c3fb70 080c119d 0334b660 1e20dd80 0334b660 jvm!JVM_FindSignal
+0x19be2
08c3fb90 0806aee5 0334b7e0 08c3fbc4 0334b660 jvm!
JVM_RegisterPerfMethods+0x13126
08c3fbb0 00887a7e 0334b660 08c3fbc4 00887a52 jvm+0x6aee5
08c3fbe8 00882c03 00000000 00000000 103f98f8 0x887a7e
08c3fc1c 00882c03 00000000 103f98f8 103f9558 0x882c03
08c3fc50 00882cda 103f9558 1e20de20 08c3fc60 0x882c03
08c3fd64 08070c8a 08c3fd98 08c3ff3c 0000000a 0x882cda
08c3fde4 080aab6d 0000000a 00000000 08c3fe94 jvm+0x70c8a
08c3fe20 08070b97 08070b9c 08c3ff34 08c3fe48 jvm!JVM_FindSignal
+0x1dee1
08c3fe3c 08070893 08c3ff34 0334b7dc 08c3fe94 jvm+0x70b97
i [sic] know this is executing a managed function but don't know how to get
that data. Does anyone know the tools or methods used to do this? It
looks like the jvm!JVM_FindSignal function is responsible for setting
up and calling managed java [sic] code but i [sic] am not sure.

Don't do that.

The word "managed" has no relevance in Java because the word "unmanaged" has
no meaning.  Everything is "managed". There is no "managed function", just
"method".

consider it native code run by cpu vs byte code run by jvm.

You understand what im getting at though right?
 
A

Arne Vajhøj

The word "managed" has no relevance in Java because the word "unmanaged"
has no meaning. Everything is "managed". There is no "managed function",
just "method".

It is .NET terminology.

Translation to Java:

managed = Java code
unmanaged = native code

Arne
 
J

JR

It is .NET terminology.

Translation to Java:

managed = Java code
unmanaged = native code

Arne

k, so given a windows crash dump how would one determine what java
code was being run by the jvm?
 
L

Lew

It is .NET terminology.

Translation to Java:

managed = Java code
unmanaged = native code

That is instructive. I thought "unmanaged" code in .Net (with which I'm
barely passingly familiar) meant high-level code still (e.g., C#), but without
the memory-management features (GC).
 
L

Lew

JR said:
consider it native code run by cpu vs byte code run by jvm.

You understand what im [sic] getting at though right?

Now I do, thanks to your and Arne's explanations. I don't get why you need
that information.

Also, the native code run in the JVM changes during execution, at least with
the Hotspot compiler, as optimizations come and go.

Much more convenient that non-portably hacking the JVM, I'd think, would be
using the inbuilt debugging facilities of the JVM, which explicitly provide
for peering into the methods and data in use by a program.
 
A

Arne Vajhøj

That is instructive. I thought "unmanaged" code in .Net (with which I'm
barely passingly familiar) meant high-level code still (e.g., C#), but
without the memory-management features (GC).

The very short version is that:

managed code = C# code

unmanaged code = C/C++ code called via one of DllImport, COM interop or
mixed mode C++.

Arne
 
A

Arne Vajhøj

Well, C# has that, too. C# syntax tends to agglomerate features quite
fast. You can have "unmanaged" C# code, with C-like things like explicit
pointer arithmetic. But the term "unmanaged" is also used to describe
native code. Basically, in the .NET world, "managed" means "code where
types, array accesses, memory management,... is under strict control of
the VM" and "unmanaged" means "whatever is not managed".

Unmanaged code is native code. You can not produce that with
Microsofts C# compiler. C# code does not become unmanaged just
by using unsafe features.

C# managed code can somewhat work with unmanaged data though
interop classes.

Arne
 
M

Mike Schilling

Thomas said:
Well, C# has that, too. C# syntax tends to agglomerate features quite
fast. You can have "unmanaged" C# code, with C-like things like
explicit pointer arithmetic.

That's "unsafe" code. "Unmanaged" code means code that's not produced from
..NET IL.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top