This is the mail archive of the gdb-patches@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]

Re: RFC: Don't kill the program after "file"


Daniel Jacobowitz <drow@false.org> writes:

> The "file" command currently prompts if a program is running:
>
> (gdb) file /bin/cat
> A program is being debugged already.  Kill it? (y or n) 
>
> I've encountered a couple problems with this:
>
> 1. If you say "no", it aborts the "file" command.  So there is no way
> to deliberately change the file.
> 2. If you say yes, it doesn't just do the equivalent of "kill", but
> "kill" and "disconnect".  For target extended-remote, this means you
> come unexpectedly disconnected from your target.
>
> This patch completely removes the prompt.  Instead, we simply allow it.
> It's occasionally useful, even during native debugging (at least I know
> I've attached to a running program with the wrong file specified
> before).  It's more useful during remote debugging, where I've seen
> users frequently confused that "target remote; file" doesn't work even
> though "file; target remote" does.
>
> I talked with Jim about this.  He wasn't entirely happy with discarding
> the prompt for native debugging, where it traditionally makes sense; we
> didn't quite make it to an agreement on what ought to happen.  He
> suggested adding a "process-oriented" flag to target vectors.  For a
> process oriented target (i.e. one which can handle "run" and "kill" and
> so forth) it makes sense to offer to kill at this point; for
> board oriented targets it makes less sense.  Another thing which just
> occured to me would be to make the file command succeed if you say "n"
> at the query.

I think something like that is workable.  What if we simply left the
killing to the 'kill' and 'run' commands, and let the prompt say:

    A program is being debugged already.
    Are you sure you want to change the file?  (y or n)

Saying 'y' would not kill the program.

This would mean that 'exec-file; run' when a program is running would
ask the user two questions: one to confirm the file change, and then
another to confirm the kill before restarting.


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