Re: GDB BoF notes - GNU Cauldron 2023

Lancelot SIX via Gdb
2023-09-29T09:24:45Z

> > - Revisiting defaults
> >
> > - Can we turn history saving on by default? Maybe default to
> > history on home dir by default, too (~/.gdb_history). That would
> > align us with bash. Some in the room have had this enabled in
> > their gdbinits for so long they no longer remembered this wasn't
> > on by default. Others weren't even aware you can turn this on.
>
> One issue I find with the bash approach is that you end up mixing history
> between multiple unrelated sessions. Bash can't solve this but GDB possibly
> could.
>
> My suggestion would be to use an approach similar to vim's swap files. As an
> example, editing the maintainers file, I have the file ~/.local/state/nvim/swap/%home%blarsen%Documents%binutils-gdb%gdb%MAINTAINERS.swp;
> This way you can have histories specific to any binary you're debugging
> without mixing sessions.
>

Hi,

With such approach, I am not really sure how to name/identify a session.
Is that based on the name of the binary you're debugging? If so what
happens if you use `file another_bin`? Either you switch to another
"session", but really you never left GDB so that would seem odd to me,
or you end up having history about another_bin in your first apparently
unrelated session.

Similarly, when dealing with multiple inferiors, would running `inferior
N` switch from session to session?

I can see cases where such behavior could be helpful, but there seems
to be a lot of edge cases where it could become strange.

My feeling for now is that the best way to achieve this is to save the
gdb history in the current directory, with the "risk" of having plenty
of history files left all-over the place (as you mentioned already).

I feel that having the default somewhere under $HOME / $XDG_STATE_HOME
(as suggested by Tom) seems an "easier" default.

Best,
Lancelot.

> That said, either option is an improvement to the current state, so I'm all
> for it!
>
> Another solution that was brought up, seeing as the biggest concern was
> having many "gdb_history"s lost across the filesystem, was to make the
> history not hidden. I'm not a big fan of this approach, but figured it was
> worth bringing up.
>
> >
> > - Can we disable pagination by default? Surprisingly, no one in the
> > room expressed that they like pagination on. Sevearl people
> > mentioned that they have it off by default, and then use either
> > the terminal scroll function, or:
> >
> > "(gdb) pipe GDB_COMMAND | less"
> >
> > when necessary.
> >
> The one use-case mentioned for pagination was that you can't scroll on the
> tui. It is possible to have "pagination auto" behave differently. As someone
> who doesn't use the TUI, I don't have a stake on this decision, again just
> figured I should share.
>
> --
> Cheers,
> Guinevere Larsen
> She/Her/Hers
>