[all-commits] [llvm/llvm-project] dc25ab: [lldb]Make `list` command work with headers when ...

Vy Nguyen via All-commits all-commits at lists.llvm.org
Mon May 19 08:04:24 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: dc25ab389c2d441ba378d4db56a4a61e3eedb889
      https://github.com/llvm/llvm-project/commit/dc25ab389c2d441ba378d4db56a4a61e3eedb889
  Author: Vy Nguyen <vyng at google.com>
  Date:   2025-05-19 (Mon, 19 May 2025)

  Changed paths:
    M lldb/source/Commands/CommandObjectSource.cpp
    A lldb/test/Shell/Commands/list-header.test

  Log Message:
  -----------
  [lldb]Make `list` command work with  headers when possible. (#139002)

Given this simple test case:

```
// foo.h
extern int* ptr;
inline void g(int x) {
  *ptr = x; // should raise a SIGILL
}
//--------------
// foo.cc
#include "foo.h"
int* ptr;

//--------------
// main.cc

#include "foo.h"

int main() {
  g(123); // Call the inlined function and crash
  return 0;
}

$ clang -g main.cc foo.cc -o main.out
$ lldb main.out
```

When you run `main.out` under lldb, it'd stop inside `void g(int)`
because of the crash.
The stack trace would show that it had crashed in `foo.h`, but if you do
`list foo.h:2`, lldb would complain that it could not find the source
file, which is confusing.

This patch make `list` work with headers.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list