tjfontaine / lldb-v8

v8 utility scripts for lldb
73 stars 8 forks source link

Problems loading/using the addon on OSX #1

Open thlorenz opened 9 years ago

thlorenz commented 9 years ago

Here is what I'm seeing when I try to load the python addon immediately:

➝  lldb ../../node_g simple.js
Current executable set to '../../node_g' (x86_64).
(lldb) command script import ./lldb-v8/v8.py
Traceback (most recent call last):
  File "/Users/thlorenz/dev/js/node/addons/simple/lldb-v8/v8.py", line 839, in __lldb_init_module
    v8cfg = V8Cfg(target)
  File "/Users/thlorenz/dev/js/node/addons/simple/lldb-v8/v8.py", line 99, in __init__
    raise ret
TypeError: exceptions must be old-style classes or derived from BaseException, not SBError

When I load it while stopped at a breakpoint (which works) and run jsstack:

(lldb) jsstack
Traceback (most recent call last):
  File "/Users/thlorenz/dev/js/node/addons/simple/lldb-v8/v8.py", line 788, in jsstack
    v8cfg.jsstack(result)
  File "/Users/thlorenz/dev/js/node/addons/simple/lldb-v8/v8.py", line 530, in jsstack
    self.jsstack_thread(self.process.GetThreadAtIndex(i), result)
  File "/Users/thlorenz/dev/js/node/addons/simple/lldb-v8/v8.py", line 503, in jsstack_thread
    f = self.jsstack_frame(result, thread, frame.fp)
  File "/Users/thlorenz/dev/js/node/addons/simple/lldb-v8/v8.py", line 457, in jsstack_frame
    funcname = self.jsfunc_name(func)
  File "/Users/thlorenz/dev/js/node/addons/simple/lldb-v8/v8.py", line 312, in jsfunc_name
    name = self.jstr_print(fstr)
  File "/Users/thlorenz/dev/js/node/addons/simple/lldb-v8/v8.py", line 294, in jstr_print
    typename = self.read_type(addr)
  File "/Users/thlorenz/dev/js/node/addons/simple/lldb-v8/v8.py", line 234, in read_type
    return self.types[hbyte]
KeyError: 4

Note that I'm running the latest node version in debug mode and latest lldb:

➝  ../../node_g --version
v0.13.0-pre

➝  lldb --version
lldb-320.99.0

➝  uname -a
Darwin Thorstens-MacBook-Pro.local 13.3.0 Darwin Kernel Version 13.3.0: Tue Jun  3 21:27:35 PDT 2014; root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64
tjfontaine commented 9 years ago

for right now, I've only been testing on v0.10

thlorenz commented 9 years ago

OK, good to know will try to run against that and report back with the results.

lxe commented 9 years ago

I'm getting the same TypeError: exceptions must be old-style classes or derived from BaseException, not SBError error with node v0.10.32 when attempting to load v8.py. I'm loading in a heapdump generated with node-heapdump:

(lldb) command script import ./v8.py
Traceback (most recent call last):
  File "/Users/aleksey/lldb-v8/v8.py", line 844, in __lldb_init_module
    v8cfg = V8Cfg(target)
  File "/Users/aleksey/lldb-v8/v8.py", line 240, in __init__
    ret = self.load_symbol(value[0])
  File "/Users/aleksey/lldb-v8/v8.py", line 330, in load_symbol
    raise error
TypeError: exceptions must be old-style classes or derived from BaseException, not SBError
$ lldb --version
lldb-320.4.124.10

$ ./node_g --version
v0.10.32

$ uname -mprsv
Darwin 13.4.0 Darwin Kernel Version 13.4.0: Sun Aug 17 19:50:11 PDT 2014; root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64 i386
tjfontaine commented 9 years ago

You don't want to use a heapdump file, you want to use a core file, something you would get from using --abort-on-uncaught-exception or calling process.abort() on osx they will be found in /cores/

lxe commented 9 years ago

Duh. I just figured that out. Heap dump != core dump.... Thank you!

lacombar commented 9 years ago

same error as @lxe, but while trying to debug v8's d8 process, not on a core.