This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug gdb/17525] target-async: breakpoint commands not executed when program run from -x script


https://sourceware.org/bugzilla/show_bug.cgi?id=17525

--- Comment #1 from Joel Brobecker <brobecker at gnat dot com> ---
The script works fine when sourced from the GDB prompt, Eg:

    (gdb) source cmds.gdb
    [program runs to completion after hitting breakpoints 20 times]

It also works when the script is piped to GDB's stdin:

    % cat cmds.gdb | gdb

I think the difference is that the script is then executed as part of GDB's
global main loop, which calls bpstat_do_actions at the end of each command's
execution, whereas "-x cmds.gdb" just results in source_script being called.
The latter ends up executing the "run" command from our script, with the
associated call to bpstat_do_actions, which explains why the commands-list
gets executed once, but then that's it.

Adding bogus commands such as...

   echo
   echo
   echo
   echo

... each cause additional commands to be executed which themselves trigger
bpstat_do_actions to be executed, thus each giving us back one of the missing
iterations.

But what we need is to be able to loop-until-we're-done after having sourced
the script.

One thing thats' interesting which might indicate that I'm missing something is
the fact that after the debugger stops (too early), my prompt is not the one I
would expect (through .gdbinit). At this point, if:

 - I press ctrl-d, then my normal prompt appears;
 - I type "bogus" as a command, GDB does:

    (gdb) bogus
    Undefined command: "bogus".  Try "help".

 - I type a valid command, the command gets executed, and my program then
resumes once:

    (gdb) print 1
    $1 = 1

    Breakpoint 1, increment (i=7) at foo.c:4
    4      return i + 1;

I have clearly missed something.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]