Tirth Rami
Tirth Rami

Reputation: 273

Kill program when a certain breakpoint hits

I am using gdb to debug my program and I need to try many combinations of inputs. So to make it easier for me, is there a way to kill the debug if a certain breakpoint hits so I can run it again with a different input?

Upvotes: 3

Views: 719

Answers (1)

Employed Russian
Employed Russian

Reputation: 213526

is there a way to kill the debug if a certain breakpoint hits

You can attach commands to breakpoints. Documentation. You want something like:

break foo        # creates breakpoint 1
commands 1
  call _exit(1)  # causes inferior process to exit. 
end

Upvotes: 2

Related Questions