[all-commits] [llvm/llvm-project] 9a3f0c: Fix crash in lldb-vscode when missing function name
    Zhenyu Tom Yang via All-commits 
    all-commits at lists.llvm.org
       
    Thu Aug  3 12:57:08 PDT 2023
    
    
  
  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9a3f0cd717f68ccf9e348bce2d76a2372482f4f2
      https://github.com/llvm/llvm-project/commit/9a3f0cd717f68ccf9e348bce2d76a2372482f4f2
  Author: Tom Yang <toyang at fb.com>
  Date:   2023-08-03 (Thu, 03 Aug 2023)
  Changed paths:
    M lldb/tools/lldb-vscode/JSONUtils.cpp
  Log Message:
  -----------
  Fix crash in lldb-vscode when missing function name
Summary:
In cases where the PC has no function name, lldb-vscode crashes.
`lldb::SBFrame::GetDisplayFunctionName()` returns a `nullptr`, and when we
attempt to construct an `std::string`, it raises an exception.
Test plan:
This can be observed with creating a test file (credit to @clayborg for
the example):
```
int main() {
  typedef void (*FooCallback)();
  FooCallback foo_callback = (FooCallback)0;
  foo_callback(); // Crash at zero!
  return 0;
}
```
and attempting to debug the file through VSCode.
I add a test case in D156732 which should cover this.
Differential Revision: https://reviews.llvm.org/D156970
    
    
More information about the All-commits
mailing list