1

I am trying to set breakpoints in a MIPS32r6 program that computes the Mandelbrot Set in Brainfsck. The program itself is written in C++, compiled with Clang, and I am debugging with LLDB.

The issue that I am having is that when in LLDB, I can set certain breakpoints, mainly on lower line numbers, with no issues. However, after Line #70 in Main.cpp, the breakpoints are coming up as 'unresolved' (even though executing breakpoint list shows them with completely reasonable addresses). That is to say, all breakpoints that I try to set after Line #70 are coming up as unresolved, and all reasonable breakpoints before Line #70 resolve without issue.

I've placed a copy of the binary that I've linked here: http://filebin.ca/2tJzo2LLBJWO/MipsTest.bin

And a copy of Main.cpp here: https://paste.ee/p/WYs8Y

I am building with the following options:

clang -mcompact-branches=always -fasynchronous-unwind-tables -funwind-tables -fexceptions -fcxx-exceptions -mips32r6 -O0 -g -glldb ...

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

At this point, I am unsure as to what might be causing this issue.

ameisen
  • 33
  • 1
  • 7

2 Answers2

1

I'd try doing target modules dump line-table Main.cpp in lldb to see what lldb thinks the line table looks like. Then look at the binary's DWARF line table with something like readelf --debug-dump=decodedline MipsTest.bin (I think that's right - I'm looking at a readelf main page on the web).

Jason Molenda
  • 14,835
  • 1
  • 59
  • 61
  • The line table as shown by `target modules dump line-table Main.cpp` looks valid, and goes up to line 248 (which is the final line of the only function in there - `main`). As shown by `readelf` is also valid, and also goes to line 248. – ameisen Aug 30 '16 at 08:09
1

Using your sample binary, I get:

(lldb) b s -l 72
Breakpoint 1: where = MipsTest.bin`main + 544 at Main.cpp:72, address = 0x000134a0

So we found an address for the breakpoint. If it is unresolved when you run, that means we weren't able to implement the breakpoint at that address (e.g. for some reason couldn't write the trap into the program memory there.)

Jim Ingham
  • 25,260
  • 2
  • 55
  • 63
  • I think we're working this through on the lldb-dev board right now (http://lists.llvm.org/pipermail/lldb-dev/2016-August/011146.html), however to follow up on here as well- I'm never seeing the debugger actually try to do anything. If I set a breakpoint at line 70, it sends Z0 to the stub (which sets a breakpoint). If I set a breakpoint as line 72... it sends absolutely nothing to the stub, so it hasn't tried to determine if it can set the trap. As per the BBS posts, the .text section of the binary appears completely reasonable. – ameisen Aug 31 '16 at 00:22