Vihaan Verma
Vihaan Verma

Reputation: 13143

load breakpoint file error

I have previously saved list of breakpoints using

save breakpoints blist

now after compiling the program when I try to reload the same break points with the load command

load blist

I get this error

You can't do that when your target is `exec'

How to resolve this ?

Upvotes: 7

Views: 7324

Answers (2)

Soup  Endless
Soup Endless

Reputation: 443

I have breakpoints saved to file, say gdb.br, file content looks like:

br /project/src/file.c : 100
commands
silent
printf "\nbacktrace:\n"
bt
cont
end

This break just output backtrace and continue execution. You may also use simple breaks, like:

br /project/src/file.c : 100
br className::methodName

I have a lot of breaks there - gdb fails to add them via copy-past. Also I can't use load command on my multi-threading system. To attach with gdb and load breakpoints I use this sequence:

gdb -p 1523 -x gdb.br

Where 1523 is process pid you want to attach to. -x is primarily intedent to be used to load commands, set environment, but also could be used to load your breaks. Hope this will help.

Upvotes: 0

Employed Russian
Employed Russian

Reputation: 213799

load blist

Try source blist instead.

From "help save breakpoints":

Save current breakpoint definitions as a script.

The way to read a script is the source command. The load command means something different entirely.

Upvotes: 18

Related Questions