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 remote/15275] gdb quit command fails if remote serial link is broken


http://sourceware.org/bugzilla/show_bug.cgi?id=15275

--- Comment #12 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> 2013-04-10 14:10:37 UTC ---
CVSROOT:    /cvs/src
Module name:    src
Changes by:    palves@sourceware.org    2013-04-10 14:10:35

Modified files:
    gdb            : ChangeLog infcmd.c top.c tracepoint.c 
                     tracepoint.h 
    gdb/cli        : cli-cmds.c 

Log message:
    make -gdb-exit call disconnect_tracing too, and don't lose history if the
target errors on "quit"

    Gareth mentions in PR gdb/15275:

    "The MI '-gdb-exit' command mi_cmd_gdb_exit() never calls
disconnect_tracing()
    and therefore exits correctly."

    It should, so to get out of tfind mode, as quit may detach instead of
    kill, and we don't want to confuse the memory/register accesses
    etc. of the detach process.  So we should push down the disconnect
    tracing bits at least to quit_force.  But we can't as is, as that
    would swallow the error thrown by answering "no" to:

    Trace is running but will stop on detach; detach anyway? (y or n)

    So to address that, we split disconnect_tracing in two.  One part that
    does the query, and another part that does the rest, and we make
    quit_force call the latter.

    Looking at quit_force, it does several things, some of which are a bit
    independent of the others.  It first kills/detaches, and then writes
    history, and then runs the final cleanups.  It seems better to me to
    do each of these things even if the previous thing throws.  E.g., as
    is, if something throws while detaching, then we skip writing history.

    Tested on x86_64 Fedora 17.

    gdb/
    2013-04-10  Pedro Alves  <palves@redhat.com>

    * cli/cli-cmds.c (quit_command): Call query_if_trace_running
    instead of disconnect_tracing.
    * infcmd.c (detach_command, disconnect_command): Call
    query_if_trace_running.  Adjust.
    * top.c: Include "tracepoint.h".
    (quit_target): Delete.  Contents moved ...
    (quit_force): ... here.  Wrap each stage of teardown in
    TRY_CATCH.  Call disconnect_tracing before detaching.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.15392&r2=1.15393
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/infcmd.c.diff?cvsroot=src&r1=1.327&r2=1.328
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/top.c.diff?cvsroot=src&r1=1.231&r2=1.232
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/tracepoint.c.diff?cvsroot=src&r1=1.298&r2=1.299
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/tracepoint.h.diff?cvsroot=src&r1=1.59&r2=1.60
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/cli/cli-cmds.c.diff?cvsroot=src&r1=1.152&r2=1.153

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- 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]