Skip to content

Instantly share code, notes, and snippets.

@kelunik
Last active Dec 17, 2019
Embed
What would you like to do?
gdb --batch --command=gdb.bt -return-child-result --args ./a.out
gcc -g test.c
set pagination off
set logging file gdb.txt
set logging on
init-if-undefined $_exitcode = -1
handle SIGTERM nostop print pass
handle SIGPIPE nostop noprint pass
run
if ($_exitcode == -1)
bt
end
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
char *buf;
buf = malloc(1<<31);
fgets(buf, 1024, stdin);
printf("%s\n", buf);
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment