Not able to set breakpoints above line #70 in lldb-mi.


I’m having an issue setting breakpoints using lldb-mi.

I am trying to run a C++ program (which is itself a brainfsck interpreter), compiled for MIPS32r6 using Clang, linked with lld, and am trying to use lldb-mi as the debugger. I am using lldb-mi as my primary use for it is as an intermediary for a visual debugger, but I get the same behavior when using it myself.

Whenever I try to set a reasonable breakpoint at or below line #70 in Main.cpp, it works – it is resolved, it sends a Z0 packet to the gdb stub, and it works. However, when I attempt to set any breakpoint above line #70, it comes up as ‘unresolved’ (though the addresses shown in the list seem reasonable) and does not submit anything to the stub as a result.

When I dumped the line table using both readelf and lldb, they were completely reasonable – almost every line until the end had an entry – there was no cut off at line #70.

At this point, I’m unsure if I’m doing something wrong, or if lldb-mi is having some difficulty with my MIPS binary.

I’m building with the following options:

clang -std=c++14 -mcompact-branches=always -fasynchronous-unwind-tables -funwind-tables -fexceptions -fcxx-exceptions -mips32r6 -O0 -g -glldb …

lld --discard-none -znorelro --eh-frame-hdr …

And the resultant binary is here: (if you wish something to analyze).

I’ve also uploaded the rather poor code for Main.cpp here:

I’ve also tested this on a second source file in the ELF (‘Recoder.cpp’) which stops working at a lower line number, but has similar behavior – there’s a hard cut-off where lldb stops working with breakpoints. The line table for that file also seems fine.

Just for example, when I set a breakpoint at or below 70 (note, I get the same behavior when not specifying -H):

break set -H -f Main.cpp -l 70







And this is what I see when I set a breakpoint after 70:

break set -H -f Main.cpp -l 72




However, the list looks as such:

break list

Current breakpoints:

1: file = ‘Main.cpp’, line = 70, exact_match = 0, locations = 1, resolved = 1, hit count = 1

1.1: where = MipsTest.bin`main + 520 at Main.cpp:70, address = 0x00013488, resolved, hit count = 1

2: file = ‘Main.cpp’, line = 72, exact_match = 0, locations = 1

2.1: where = MipsTest.bin`main + 544 at Main.cpp:72, address = MipsTest.bin[0x000134a0], unresolved, hit count = 0

Note that the address seems completely reasonable but it remains unresolved, and does not submit anything to the stub.

Thanks for any help or insight you might be able to provide,