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

GDB has no way of dereferencing WASM pointers #13

Closed
rianhunter opened this issue Jul 31, 2020 · 2 comments
Closed

GDB has no way of dereferencing WASM pointers #13

rianhunter opened this issue Jul 31, 2020 · 2 comments

Comments

@rianhunter
Copy link

rianhunter commented Jul 31, 2020

This issue does not pertain to correctly generating DWARF "Location Descriptions." That is possible with the current arrangement.

The issue is when dereferencing pointers on the GDB console. Say you have an "int *foo". GDB can correctly do "print foo" but it cannot do "print *foo."

Is there a way to communicate to GDB how to dereference pointer types in DWARF? I say GDB here but I suspect this also applies to LLDB.

@yurydelendik
Copy link
Owner

At this moment deferencing of points is happening at DWARF level using DW_OP_deref and other similar operations -- not different from native platforms. With multi-memory proposal, we need to resolve #10.

There are two ways GDB/LLDB can work with:

  1. directly with WebAssembly runtime; in this case deref will just work, but it is not implemented yet AFAIK, see e.g. https://reviews.llvm.org/D78801.
  2. with transformed DWARF coming from JIT/AOT compiler; it is more complicated, has limitations and might be confusing. For example, in wasmtime project, we just convert references/pointers into special structures with utility functions to unwrap them (see Utility methods for artificial debug types in the generated DWARF bytecodealliance/wasmtime#1482).

@rianhunter
Copy link
Author

Your second point is to what I was referring. Thank you for the reference, while that requires transforming debug-level pointer types that is a sufficient solution. Thank you

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