Should break set -a resolve symbols?

When I set a breakpoint at the address of main, I get just the address back:

(lldb) break set -a &main

Breakpoint 1: address = 0x00000000004004f0

When I break at main, I get the source line and the address:

(lldb) settings set target.skip-prologue false

(lldb) b main

Breakpoint 2: where = a.out`main at hello.c:3, address = 0x00000000004004f0

Should break set –a also print out symbol, source file and line?

The breakpoints by load address could resolve the address and show them when dumping, but currently do not. Feel free to add support for this if you want to. You can't cache any of the info and the info will always need to be looked up on the fly, but that is an easy lookup to do. Please do not store _any_ resolved things like a lldb_private::Address or any lldb_private::SymbolContext as when you program runs, the address in the breakpoint can change many times, and it might not resolve to anything at all.

Note that instead of:

(lldb) settings set target.skip-prologue false
(lldb) b main

you can simply do:

(lldb) b &main

The current "b" regex command will turn this into:

(lldb) breakpoint set --name 'main' --skip-prologue=0

So be sure to use the "--skip-prologue=0" option instead of toggling a global switch for individual breakpoints.


Note, this is just the 'initial' breakpoint description, if you were to do "break list" after creating the breakpoint you will see much more detailed information (and there's a -v flag for even more...) I added the distinction between normal & initial descriptions so we could keep the "break set" responses fairly terse. We originally had more verbose output when the breakpoints were originally created but hoi polloi felt it was too noisy.

I didn't put the brief "where" info in originally just because when you are setting a breakpoint on an address you generally already know why you are setting it there, whereas a symbol breakpoint could resolve to something you didn't expect. But I don't have strong feelings one way or the other about this.

You will have to make sure there aren't any test cases that rely on the format of the break output. I added functions (run_break_set...) in test/ to shield test cases from having to know about the description format, but I didn't add one for addresses so there must not have been any uses of the command-line "break set -a" at that point. Some may have crept in, however.