endoli / lldb.rs

Higher level LLDB bindings for Rust built on lldb-sys.
https://docs.rs/lldb/latest/lldb/
Apache License 2.0
56 stars 17 forks source link

How do you create a breakpoint? #36

Open JonathanWoollett-Light opened 4 weeks ago

JonathanWoollett-Light commented 4 weeks ago

In lldb-sys this can be done with:

use lldb_sys::*;
const BINARY: &str = env!("CARGO_BIN_EXE_testing");
SBDebuggerInitialize();
let debugger = SBDebuggerCreate2(true);
let binary_path = CString::new(BINARY)?;
let target = SBDebuggerCreateTarget2(debugger, binary_path.as_ptr());
let file = CString::new("src/main.rs")?;
let breakpoint = SBTargetBreakpointCreateByLocation(target, file.as_ptr(), 1);

so I would assume SBTargetBreakpointCreateByLocation would be a function on lldb::SBTarget but I can't see any.

waywardmonkeys commented 4 weeks ago

If I remember correctly, I didn't add that yet ... a PR would be welcome! There's a whole bunch of similar functions though, so we only need to add the ones that are actually necessary (not older API).

anatawa12 commented 3 days ago

In my program, I added BreakPoint by finding symbol with SBTarget::find_symbols and then I created breakpoint with SBTarget::breakpoint_create_by_sbaddress.