From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Pedro Alves <palves@redhat.com>
Cc: mbilal <mbilal@codesourcery.com>,
gdb-patches@sourceware.org, tromey@redhat.com
Subject: Re: Fwd: [PATCH] Fix for PR gdb/15224 should "set history save on" by default
Date: Tue, 02 Apr 2013 17:10:00 -0000 [thread overview]
Message-ID: <20130402152617.GA16641@host2.jankratochvil.net> (raw)
In-Reply-To: <5159966F.1030809@redhat.com>
On Mon, 01 Apr 2013 16:15:11 +0200, Pedro Alves wrote:
> On 04/01/2013 01:29 PM, Jan Kratochvil wrote:
> >> > The history's filename is also tweakable with the GDBHISTFILE
> >> > environment variable (there's HISTSIZE too; 'GDBHISTFILE= gdb' effectively
> >> > disables history load/save). Doesn't feel quite right to tie this to .gdbinit.
> > It matters how are the existing environments set up. And by default neither
> > HISTSIZE nor GDBHISTFILE environment variables are set.
>
> Not clear to me which environments you're referring to here,
How >90% of GDB users run it.
> if you're referring to any specific environments. (HISTSIZE won't be as rare,
> because that's also the variable used by bash. We should probably
> have a GDBHISTSIZE too.)
I meant >90% of GDB users do not have GDBHISTFILE environment variables set.
> I think however, that whether to write history to file should also
> check whether we're in interactive debugging mode:
>
> /* Save the history information if it is appropriate to do so. */
> if (write_history_p && history_filename)
> write_history (history_filename);
>
> That is, e.g., this touches history:
>
> $ ls -als ~/.gdbhist
> 4 -rw-------. 1 pedro pedro 27 Apr 1 14:10 /home/pedro/.gdbhist
> $ date
> Mon Apr 1 14:37:01 WEST 2013
> $ gdb -ex "set history filename ~/.gdbhist" < /dev/null
> (gdb) quit
> $ ls -als ~/.gdbhist
> 4 -rw-------. 1 pedro pedro 27 Apr 1 14:37 /home/pedro/.gdbhist
>
> That, I'd call a bug.
I agree.
>
> Probably, it'd be best to use input_from_terminal_p, which also
> checks for --batch mode, among other things.
>
> I think that all covers cases like abrt and other crash catchers that
> spawn gdb?
Hopefully they usually use redirection from file so ISATTY should catch that
which I did not realize before.
OK, that seems as a good plan - with patching the GDB testsuite to disable
history saving. I expect it will still affect some 3rd party testsuite using
GDB but you have convinced me such cases will not be significant enough.
I tested now that "ddd" will store the history commands like "step".
But as it runs GBD with "gdb -q -fullname PROGNAME" it already happens if one
has "set history save on" in ~/.gdbinit so I would not call that a regression.
http://pkgs.fedoraproject.org/cgit/gdb.git/plain/gdb-6.5-BEA-testsuite.patch
is using:
cat gdbscript.gdb /dev/zero | gdb -nx "./$(basename "$RUNME")" > $LOG
which should get handled by existing ISATTY in GDB.
> > I see there should be also changed the default to:
> > set history filename ~/.gdb_history
> >
> > Otherwise it is a similar pain to ./.gdbinit, it is also non-standard to any
> > other normal application which use history files in $HOME, I do not find using
> > ./.gdb_history by default as acceptable.
>
> That'd be fine with me. However, we'd need a way to be able to specify
> "./.gdbinit" back. We have precedent for "$cwd", so perhaps that would
> best be addressed by making "set history filename $cwd/.gdb_history" work.
This command works for me:
unset GDBHISTFILE; gdb -ex "set history filename .gdb_history"
I do not understand why you mention $cwd, what $cwd should do differently?
I was expecting that by default
cd /tmp; (unset GDBHISTFILE; gdb -nx)
will change from
(gdb) show history filename
The filename in which to record the command history is "/tmp/.gdb_history".
to
(gdb) show history filename
The filename in which to record the command history is "/home/user/.gdb_history".
.
Jan
next prev parent reply other threads:[~2013-04-02 15:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <51558CB4.8010003@codesourcery.com>
2013-03-29 16:18 ` mbilal
2013-03-29 16:28 ` Jan Kratochvil
2013-04-01 11:34 ` Pedro Alves
2013-04-01 12:41 ` Jan Kratochvil
2013-04-01 19:44 ` Pedro Alves
2013-04-02 17:10 ` Jan Kratochvil [this message]
2013-04-03 17:14 ` Pedro Alves
2013-04-03 17:50 ` Jan Kratochvil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130402152617.GA16641@host2.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=mbilal@codesourcery.com \
--cc=palves@redhat.com \
--cc=tromey@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox