Skip to content

Instantly share code, notes, and snippets.

@mortymacs
Created November 15, 2022 15:56
Show Gist options
  • Save mortymacs/9c65c23f619de4dc7d54bca6d571283f to your computer and use it in GitHub Desktop.
Save mortymacs/9c65c23f619de4dc7d54bca6d571283f to your computer and use it in GitHub Desktop.
Breakpoint in C/C++
#include <iostream>
void bp(){}
void test() {
int i;
i = 100;
bp();
i = 200;
}
int main() {
std::cout << "hi" << std::endl;
test();
std::cout << "bye" << std::endl;
}
#!/bin/sh
g++ -o main main.cc -g
gdb -ex 'b bp' main
@mortymacs
Copy link
Author

Just an empty breakpoint function in order to introduce it to GDB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment