Skip to content

Instantly share code, notes, and snippets.

@ClarkeRemy
Created January 1, 2024 14:39
Show Gist options
  • Save ClarkeRemy/e55864a69c7f95eec3fb1ba8946bbf56 to your computer and use it in GitHub Desktop.
Save ClarkeRemy/e55864a69c7f95eec3fb1ba8946bbf56 to your computer and use it in GitHub Desktop.
gdb breakpoints no line numbers
cargo build && gdb --command="my.gdb" ./target/debug/asm_learn
fn main() {
let mut b = 7;
let mut a = 0;
breakpoint!{_main01}
a = 1;
core::hint::black_box(&a);
a = 2;
println!("a : {}",a);
breakpoint!{_main02}
}
fn _main01() {}
fn _main02() {}
macro_rules! breakpoint {($FN_LABEL:ident) => {
#[cfg(debug_assertions)]
{
extern crate core;
core::hint::black_box::<()>($FN_LABEL());
}
};}
pub(crate) use breakpoint;
set width 0
set height 0
set verbose off
set debuginfod enabled off
# set logging on
break asm_learn::_main01
break asm_learn::_main02
run
# _main01
finish
info locals
continue
# _main02
finish
info locals
continue
q
y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment