harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Morozova, Nadezhda" <nadezhda.moroz...@intel.com>
Subject RE: Re: [drlvm] How to debug the drlvm with gdb?
Date Fri, 20 Oct 2006 09:41:14 GMT
Egor, 
You're a treasure keeper, so many useful tips :) 
As you mentioned yourself, this info should be on the website, and I
side with you on this.
We actually have some debugging tips already:
http://incubator.apache.org/harmony/subcomponents/drlvm/debugging_VM_and
_JIT.html 
However, they don't mention the launcher and all those tiny little
things you mentioned, like the format of paths, etc. the doc is also
partially outdated (mentions ij). 

Do you think we can use this doc as the basis for storing more content?

Thank you, 
Nadya Morozova
 
-----Original Message-----
From: news [mailto:news@sea.gmane.org] On Behalf Of Egor Pasko
Sent: Friday, October 20, 2006 1:34 PM
To: harmony-dev@incubator.apache.org
Subject: Re: [drlvm] How to debug the drlvm with gdb?

On the 0x208 day of Apache Harmony Tonny Lau wrote:
> Hi,
> 
> I checked out the latest drlvm, and failed to set breakpoint when I
used
> gdb. It seems the
>
"harmony/enhanced/drlvm/trunk/build/lnx_ia32_gcc_debug/deploy/jre/bin/ja
va"
> is copied from
"harmony/enhanced/classlib/trunk/deploy/jdk/jre/bin/java",
> i.e., it is not a debug version. Does anyone know how to debug it?
Thanks!

Oh! should be on the site!! some day .. some day ..

Yes, it's the launcher. It is taken from classlib (which is not built
in debug mode even if DRLVM is built in debug (=default)). If you want
to build the launcher in debug mode, change:
working_classlib/depends/build/makefile.include
(put -O0 -g instead of -O1)

pretty, huh? :)

to debug on linux you should export LD_LIBRARY_PATH for GDB:

export LD_LIBRARY_PATH=$jre/bin:$jre/bin/default
(you know what $jre is:)
(news is that tere should be no slashess at the end of each path, and no
soft links inside, surprize, surprize:)

then you can run GDB and, at least, see threads created, etc..

DRLVM is quite distributed between shared libraries, so it is not easy
to set breakpoints somewhere in libraries' code. There are 2
approaches: 
1. drop asm("int3") in your code, rebuild and catch it via an
   ordinary run from within GDB
2. stop at position when nothing interesting happend, but all
   libraries are loaded (my favourite)

for (2) I use 2 custom GDB scripts "hstart" and "hrun". "hstart" makes
the first stop on my favourite start point. "hrun" uses those
breakpoints to stop on the point with further runs in the GDB session.

To get these two, drop these lines into your ~/.gdbinit:
---------------------------------------
define hstart
break main
run
break hysl_open_shared_library
continue
finish
disable
break compile_jit_a_method
continue
disable
end

define hrun
en 1
run
en 2
continue
finish
disable
en 3
continue
disable
end
---------------------------------------

good luck! ;)

-- 
Egor Pasko, Intel Managed Runtime Division


---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Mime
View raw message