[Lldb-commits] [lldb] [lldb] Skip the WebAssembly function header when setting a breakpoint (PR #211289)

via lldb-commits lldb-commits at lists.llvm.org
Thu Jul 23 09:45:58 PDT 2026


================
@@ -60,6 +60,17 @@ class Architecture : public PluginInterface {
   virtual void AdjustBreakpointAddress(const Symbol &func,
                                        Address &addr) const {}
 
+  /// Return the address of the first executable instruction for the function
----------------
jimingham wrote:

The functionality is right, and this seems the right way to go.

But I don't think the description is accurate or the name correct.  Both make it sound like if I passed you an address in the middle of a function, this would return the address of the first executable instruction in the function.

That would make its application in AddLocation incorrect, it only doesn't because that isn't what this actually does.

It does:

If the address passed in is before the first executable instruction, return the first executable instruction, otherwise, return the address.

One way to make this clearer would be to have this function return an optional<Address> and if the address passed in is after the first instruction, return an empty optional.  Then you'd use it like:

```
auto func_address = GetFirstInstructionAddress(address);
if (func_address)
    // use *func_address
else
    // use address

```

but that seems unnecessary.

Better would be to come up with a name that means "GetFirstInstructionAddressIfBeforeFirstInstructionAddress" but isn't as awful.

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


More information about the lldb-commits mailing list