11

When I use GDB command add-symbol-file to load the symbol, GDB always asks me 'y or n', like this:

gdb> add-symbol-file mydrv.ko 0xa0070000
add symbol table from file "mydrv.ko" at
        .text_addr = 0xa0070000
(y or n)

How to make it not ask and execute quietly?

  • 4
    Try set confirm off. – Mark Plotnick Aug 21 '14 at 11:43
  • @MarkPlotnick, Thanks very much. It works! – xmllmx Aug 21 '14 at 11:47
14

gdb will ask you to confirm certain commands, if the value of the confirm setting is on. From Optional Warnings and Messages:

  • set confirm off
    Disables confirmation requests. Note that running GDB with the --batch option (see -batch) also automatically disables confirmation requests.
  • set confirm on
    Enables confirmation requests (the default).
  • show confirm
    Displays state of confirmation requests.

That's a single global setting for confirm. In case you want to disable confirmation just for the add-symbol-file command, you can define two hooks, which will run before and after the command:

(gdb) define hook-add-symbol-file
set confirm off
end
(gdb) define hookpost-add-symbol-file
set confirm on
end

If you want to disable confirmation just for a single invocation of a command, precede it with the server keyword, which is part of gdb's annotation system.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.