Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lldb_commands.py not working on lldb 9.0 #10

Closed
gengjiawen opened this issue Mar 14, 2020 · 10 comments
Closed

lldb_commands.py not working on lldb 9.0 #10

gengjiawen opened this issue Mar 14, 2020 · 10 comments

Comments

@gengjiawen
Copy link
Contributor

gengjiawen commented Mar 14, 2020

jlh not working. I did a little digging, looks the generated command is _v8_internal_Print_Object(*(v8::internal::Object**)(*(void*)(s)))

If you print this in lldb, you got error: cannot cast from type 'v8::Local<v8::String>' to pointer type 'void *'

image

@danbev
Copy link
Owner

danbev commented Mar 14, 2020

Thanks for reporting this! I opened https://chromium-review.googlesource.com/c/v8/v8/+/2083477 to attempt to fix this issue but perhaps this does not work everywhere. I'll need to take a closer look next week.

Would you be able to double check that the following works for you (just to rule out any stale/older version of lldb_commands.py):

$ lldb ./hello-world
(lldb) command script import ./lldb_commands.py
(lldb) br s -f hello-world.cc -l 73
Breakpoint 2: where = hello-world`main + 279 at hello-world.cc:73:34, address = 0x000000000040295f
(lldb) r
(lldb) jlh global
0x3f9e081c0121: [ObjectTemplateInfo] in OldSpace
 - map: 0x3f9e080433c5 <Map[32]>
 - tag: 1
 - serial_number: 1
 - property_list: 0x3f9e0804030d <undefined>
 - property_accessors: 0x3f9e0804030d <undefined>
 - constructor: 0x3f9e0804030d <undefined>
 - embedder_field_count: 0
 - immutable_proto: false

@gengjiawen
Copy link
Contributor Author

Still not working.

image

@danbev
Copy link
Owner

danbev commented Mar 16, 2020

I've updated the command to match the v8 pull request now. I also noticed that I had an additional semicolon after the call to GetError and I've fixed that now.

The lldb_commands.py that is shown in your output above does not match what was in this repository before this update or the in the latest v8 pull request. Which lldb_commands.py are you using?

The unknown error is actually something that should not be printed and is expected (though I admit a little odd) as commands that return void will return this.

@gengjiawen
Copy link
Contributor Author

gengjiawen commented Mar 16, 2020

The lldb_commands.py that is shown in your output above does not match what was in this repository before this update or the in the latest v8 pull request. Which lldb_commands.py are you using?

Copied from your gerrit pr.

Also my v8 is 7.9, not sure it's related.

@danbev
Copy link
Owner

danbev commented Mar 16, 2020

Copied from your gerrit pr.

Ah, I did not recognize the addition of printing the error but after reading your comment I think you might have added this.

In the screenshot above it looks like you are trying to print s which is of type v8::Local<v8::String>. Using the hello_world example in this repo I can use jlh to print the source variable:

Local<String> source = String::NewFromUtf8(isolate, js, NewStringType::kNormal).ToLocalChecked();
(lldb) jlh source
"const age = 40; doit(age);"

I'm using lldb 9.0.0 on linux and wondering if you might be using macos, and perhaps I'm not seeing the same error?

@gengjiawen

This comment has been minimized.

@gengjiawen
Copy link
Contributor Author

gengjiawen commented Mar 16, 2020

on lldb 10 with error (Node.js doesn't export related symbol ?)

Failed to evaluate command _v8_internal_Print_Object(*((v8::internal::Object**)((void*)(s).val_))) :
error: <user expression 0>:1:44: no member named 'Object' in namespace 'v8::internal'
_v8_internal_Print_Object(*((v8::internal::Object**)((void*)(s).val_)))
                             ~~~~~~~~~~~~~~^
error: <user expression 0>:1:52: expected expression
_v8_internal_Print_Object(*((v8::internal::Object**)((void*)(s).val_))```

@gengjiawen
Copy link
Contributor Author

I got it works on linux :)
Still not a clue why macOS failed.

@gengjiawen
Copy link
Contributor Author

I still don't get it failed on macOS, any suggestion how should I debug it ?

@danbev
Copy link
Owner

danbev commented Mar 18, 2020

I still don't get it failed on macOS, any suggestion how should I debug it ?

I'll see if I can reproduce this on my old mac. I did a quick test using Node.js and that worked, but I need to update my version of lldb.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants