[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 12:26:24 PDT 2024


slackito wrote:

Hi,

I'm having some problems with one of our tests, that also reproduce after [#114337](https://github.com/llvm/llvm-project/pull/114337).

I don't have a repro yet but I'll describe what I know of the problem so far in case it rings a bell.

The test in question has a common source file with the following structure:
```
#if defined(PROTO_V2)
#include "test_proto_v2.pb.h"
namespace proto_v2 {
#elif defined(PROTO_V3)
#include "test_proto_v3.proto.h"
namespace proto_v3 {
#elif...
// some more cases
#endif

void DoSomeStuff() {
  // common logic goes here
}

}  // end whatever namespace got selected
```

This file gets compiled multiple times with `-DPROTO_V2`, `-DPROTO_V3` and so on, and all of them get linked into a binary. Each version goes into a different namespace so there are no duplicate definitions of anything, it's just a little hack to avoid having four separate files with mostly the same code.

Before this commit, running `b common.cc:123` results in a breakpoint with N locations. After this commit, only one of them gets selected.

I'll do my best to share a repro case later today.

https://github.com/llvm/llvm-project/pull/114158


More information about the lldb-commits mailing list