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]

"set record instruction-history" ?


Hi Markus,

I'm going through all "uinteger" commands in the tree, and
finding several cases of commands that actually shouldn't
be "uinteger", but "zuinteger".

"record instruction-history"'s implementation looks odd enough that
I don't understand what's going on.  The docs don't mention anything
about 0 being special or meaning "unlimited", but I take it that's
the intent?

What's the intent of:

  /* The "record instruction-history" command.  */

  static void
  cmd_record_insn_history (char *arg, int from_tty)
  {
    int flags, size;

    require_record_target ();

    flags = get_insn_history_modifiers (&arg);

    /* We use a signed size to also indicate the direction.  Make sure that
       unlimited remains unlimited.  */
    size = (int) record_insn_history_size;
    if (size < 0)
      size = INT_MAX;

these last three lines here, though?

One can't set this option to negative values:

  (gdb) set record instruction-history-size -2
  integer -2 out of range

The fact that it maps all negatives to INT_MAX is odd,
and needing to set the option to high-enough unsigned 32-bit
integers that trigger that bit of code looks quite
non-user-friendly, even if it didn't always map to INT_MAX:

  (gdb) set record instruction-history-size 0xffffff00
  (gdb) show record instruction-history-size
  Number of instructions to print in "record instruction-history" is 4294967040.

(and exposes 32-bitness to the user, that I'd rather not)

-- 
Pedro Alves


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