binutils-gdb/gdb/record-full.h
Guinevere Larsen caa9d8df0f gdb/record: Refactor record history
This is the first step in a large refactor in how GDB keeps execution
history.  Rather than using a linked list where multiple entries can
describe a single instruction, the history will now be stored in an
std::deque, each instruction being one entry in the deque.

The choice was initially to use an std::vector, but it would become
unwieldy because it needs all the memory to be consecutive, which is
hard for 200 thousand entries. Deque was picked because it was a nice
midpoint between vector (maximum cache cohesion) and linked list
(maximum ease of finding space to store more).

Each instruction in memory will be now one record_full_instruction
entry, which for this commit just contains a vector of
record_full_entry for the effects of the instruction, and the data that
was stored in the record_full_end entry (that is, the instruction number
and the signal, if any).

This change introduced a minimal performance improvement (what's
important is that it isn't a degradation) and a  reduction in the total
memory footprint of roughly 20% if the entire history is used.

Reviewed-by: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
Reviewed-By: Christina Schimpe <christina.schimpe@intel.com>
Approved-By: Guinevere Larsen <guinevere@redhat.com>
2026-07-03 10:33:16 -03:00

53 lines
1.8 KiB
C

/* Process record and replay target for GDB, the GNU debugger.
Copyright (C) 2013-2026 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef GDB_RECORD_FULL_H
#define GDB_RECORD_FULL_H
#include "gdbsupport/scoped_restore.h"
extern bool record_full_memory_query;
/* Type to be used to return values in the gdbarch_process_record hook. */
enum record_result
{
/* Process record does not support instruction $hex at address $hex.
Process record: failed to record execution log. */
RECORD_UNSUPPORTED = -2,
/* Process record: failed to record execution log. */
RECORD_FAILURE = -1,
/* No failure. */
RECORD_SUCCESS = 0,
/* Process record: inferior program stopped. */
RECORD_UNKNOWN = 1
};
extern int record_full_arch_list_add_reg (struct regcache *regcache, int num);
extern int record_full_arch_list_add_mem (CORE_ADDR addr, int len);
/* Returns true if the process record target is open. */
extern int record_full_is_used (void);
/* Whether the inferior is being replayed, or is executing normally. */
extern bool record_full_is_replaying ();
extern scoped_restore_tmpl<int> record_full_gdb_operation_disable_set ();
#endif /* GDB_RECORD_FULL_H */