Breakpoint set at 2 locations when I set a breakpoint on LLDB

use std::net::{TcpListener};

fn main() {
    let listener = TcpListener::bind("").unwrap();
    println!("{:?}", listener);

When I set a breakpoint at line 5 which has a println macro call.
LLDB set a breakpoint at 2 locations.

(lldb) target create "target/debug/lldbtest"
Current executable set to ‘target/debug/lldbtest’ (x86_64).
(lldb) b 5
Breakpoint 1: 2 locations.

I guess it problem occurs because of {:?} and LLDB.
How can I fix it?


Are you sure there’s a problem? That message simply means that there are two locations in the machine code that correspond to the single line 5 in the source code, and LLDB set breakpoints at both of them, as it should.

Sometimes compilers will generate two alternative pieces of machine code for a single source line, perhaps to specialize the code for two different possibilities. I don’t see why that would happen in this code, but it’s not impossible.

When you run the program, does it stop where you expect it to?

What does the LLDB command breakpoint list print?


when I run the program, it stop where I expect it to.
but when I command step-over, it seems to be nothing happens cause lldb stops at second breakpoint. I know it is possible on aspect of debugger.
but human being will be confused.

I think that because of println is macro, it consists of many lines.

    (lldb) breakpoint list
    Current breakpoints:
    1: file = '/Users/JonKim/Rust/lldbtest/src/', line = 5, exact_match = 0, locations = 2
      1.1: where = lldbtest`lldbtest::main + 100 at, address = lldbtest[0x0000000100003a74], unresolved, hit count = 0 
      1.2: where = lldbtest`lldbtest::main + 126 at, address = lldbtest[0x0000000100003a8e], unresolved, hit count = 0 

If lldb shows the location of macro source code, it’s okay.
or lldb step over command must be operate based on source code.