[Lldb-commits] [lldb] Fix call site breakpoint patch (PR #114158)
Jorge Gorbe Moya via lldb-commits
lldb-commits at lists.llvm.org
Fri Nov 1 14:54:18 PDT 2024
slackito wrote:
Repro was pretty straightforward from the description above.
common.cc:
```c++
#include <cstdio>
#define XSTR(x) STR(x)
#define STR(x) #x
namespace NAMESPACE {
void DoSomeStuff() {
printf("%s::DoSomeStuff()\n", XSTR(NAMESPACE));
}
} // end NAMESPACE
```
main.cc:
```c++
namespace ns1 {
extern void DoSomeStuff();
} // namespace ns1
namespace ns2 {
extern void DoSomeStuff();
} // namespace ns2
namespace ns3 {
extern void DoSomeStuff();
} // namespace ns3
namespace ns4 {
extern void DoSomeStuff();
} // namespace ns4
int main(int argc, char* argv[]) {
ns1::DoSomeStuff();
ns2::DoSomeStuff();
ns3::DoSomeStuff();
ns4::DoSomeStuff();
return 0;
}
```
build.sh
```bash
#!/bin/bash
g++ -c -g -DNAMESPACE=ns1 -o ns1.o common.cc
g++ -c -g -DNAMESPACE=ns2 -o ns2.o common.cc
g++ -c -g -DNAMESPACE=ns3 -o ns3.o common.cc
g++ -c -g -DNAMESPACE=ns4 -o ns4.o common.cc
g++ -g -o main ns1.o ns2.o ns3.o ns4.o main.cc
```
with an lldb built at the revision prior to this commit:
```
$ lldb --no-lldbinit main
(lldb) target create "main"
Current executable set to '/usr/local/google/home/jgorbe/lldb-repro/main' (x86_64).
(lldb) b common.cc:9
Breakpoint 1: 4 locations.
```
at this revision (and also at HEAD as of 5 minutes ago):
```
$ lldb --no-lldbinit main
(lldb) target create "main"
Current executable set to '/usr/local/google/home/jgorbe/lldb-repro/main' (x86_64).
(lldb) b common.cc:9
Breakpoint 1: where = main`ns1::DoSomeStuff() + 4 at common.cc:9:9, address = 0x000000000000113d
```
https://github.com/llvm/llvm-project/pull/114158
More information about the lldb-commits
mailing list