[Lldb-commits] [PATCH] D156732: Display PC instead of <unknown> for stack trace in vscode

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Aug 1 12:35:07 PDT 2023


clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Adding a test case for this is a good idea. In order to get the PC somewhere bad, you can probably make a function pointer that points to data, then try to branch there. The PC will end up somewhere with no function name and should allow us to reproduce this.

Here is a small program that will reproduce this:

  int main() {
    typedef void (*FooCallback)();
    FooCallback foo_callback = (FooCallback)0;
    foo_callback(); // Crash at zero!
    return 0;
  }

This will crash at 0x00000000 as we tried to call a function there. It makes the "<unknown>" show up in the VS code GUI



================
Comment at: lldb/tools/lldb-vscode/JSONUtils.cpp:768
+    // hex string.
+    frame_name.clear();
+    llvm::raw_string_ostream os(frame_name);
----------------
yinghuitan wrote:
> I do not think this is needed? 
remove this, the "frame_name" is already empty from the initializer on line 761


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156732/new/

https://reviews.llvm.org/D156732



More information about the lldb-commits mailing list