mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-05 15:15:42 +00:00
gdb: Replace gdb::optional with std::optional
Since GDB now requires a C++17, we don't need the internally maintained gdb::optional implementation. This patch does the following replacing: - gdb::optonal -> std::optional - gdb::in_place -> std::in_place - #include "gdbsupport/gdb_optional.h" -> #include <optional> This change has mostly been done automatically. One exception is gdbsupport/thread-pool which did not use the gdb:: prefix as it already lives in the gdb namespace. Change-Id: I19a92fa03e89637bab136c72e34fd351524f65e9
This commit is contained in:
@@ -1609,7 +1609,7 @@ static const struct target_desc *
|
|||||||
aarch64_linux_core_read_description (struct gdbarch *gdbarch,
|
aarch64_linux_core_read_description (struct gdbarch *gdbarch,
|
||||||
struct target_ops *target, bfd *abfd)
|
struct target_ops *target, bfd *abfd)
|
||||||
{
|
{
|
||||||
gdb::optional<gdb::byte_vector> auxv = target_read_auxv_raw (target);
|
std::optional<gdb::byte_vector> auxv = target_read_auxv_raw (target);
|
||||||
CORE_ADDR hwcap = linux_get_hwcap (auxv, target, gdbarch);
|
CORE_ADDR hwcap = linux_get_hwcap (auxv, target, gdbarch);
|
||||||
CORE_ADDR hwcap2 = linux_get_hwcap2 (auxv, target, gdbarch);
|
CORE_ADDR hwcap2 = linux_get_hwcap2 (auxv, target, gdbarch);
|
||||||
|
|
||||||
@@ -2427,7 +2427,7 @@ aarch64_linux_gcc_target_options (struct gdbarch *gdbarch)
|
|||||||
|
|
||||||
Return the allocation tag if successful and nullopt otherwise. */
|
Return the allocation tag if successful and nullopt otherwise. */
|
||||||
|
|
||||||
static gdb::optional<CORE_ADDR>
|
static std::optional<CORE_ADDR>
|
||||||
aarch64_mte_get_atag (CORE_ADDR address)
|
aarch64_mte_get_atag (CORE_ADDR address)
|
||||||
{
|
{
|
||||||
gdb::byte_vector tags;
|
gdb::byte_vector tags;
|
||||||
@@ -2481,7 +2481,7 @@ aarch64_linux_memtag_matches_p (struct gdbarch *gdbarch,
|
|||||||
CORE_ADDR addr = value_as_address (address);
|
CORE_ADDR addr = value_as_address (address);
|
||||||
|
|
||||||
/* Fetch the allocation tag for ADDRESS. */
|
/* Fetch the allocation tag for ADDRESS. */
|
||||||
gdb::optional<CORE_ADDR> atag
|
std::optional<CORE_ADDR> atag
|
||||||
= aarch64_mte_get_atag (gdbarch_remove_non_address_bits (gdbarch, addr));
|
= aarch64_mte_get_atag (gdbarch_remove_non_address_bits (gdbarch, addr));
|
||||||
|
|
||||||
if (!atag.has_value ())
|
if (!atag.has_value ())
|
||||||
@@ -2579,7 +2579,7 @@ aarch64_linux_get_memtag (struct gdbarch *gdbarch, struct value *address,
|
|||||||
|
|
||||||
/* Remove the top byte. */
|
/* Remove the top byte. */
|
||||||
addr = gdbarch_remove_non_address_bits (gdbarch, addr);
|
addr = gdbarch_remove_non_address_bits (gdbarch, addr);
|
||||||
gdb::optional<CORE_ADDR> atag = aarch64_mte_get_atag (addr);
|
std::optional<CORE_ADDR> atag = aarch64_mte_get_atag (addr);
|
||||||
|
|
||||||
if (!atag.has_value ())
|
if (!atag.has_value ())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@@ -2651,7 +2651,7 @@ aarch64_linux_report_signal_info (struct gdbarch *gdbarch,
|
|||||||
uiout->field_core_addr ("fault-addr", gdbarch, fault_addr);
|
uiout->field_core_addr ("fault-addr", gdbarch, fault_addr);
|
||||||
uiout->text ("\n");
|
uiout->text ("\n");
|
||||||
|
|
||||||
gdb::optional<CORE_ADDR> atag
|
std::optional<CORE_ADDR> atag
|
||||||
= aarch64_mte_get_atag (gdbarch_remove_non_address_bits (gdbarch,
|
= aarch64_mte_get_atag (gdbarch_remove_non_address_bits (gdbarch,
|
||||||
fault_addr));
|
fault_addr));
|
||||||
gdb_byte ltag = aarch64_mte_get_ltag (fault_addr);
|
gdb_byte ltag = aarch64_mte_get_ltag (fault_addr);
|
||||||
|
|||||||
@@ -3098,7 +3098,7 @@ ada_value_slice_from_ptr (struct value *array_ptr, struct type *type,
|
|||||||
type0->dyn_prop (DYN_PROP_BYTE_STRIDE),
|
type0->dyn_prop (DYN_PROP_BYTE_STRIDE),
|
||||||
type0->field (0).bitsize ());
|
type0->field (0).bitsize ());
|
||||||
int base_low = ada_discrete_type_low_bound (type0->index_type ());
|
int base_low = ada_discrete_type_low_bound (type0->index_type ());
|
||||||
gdb::optional<LONGEST> base_low_pos, low_pos;
|
std::optional<LONGEST> base_low_pos, low_pos;
|
||||||
CORE_ADDR base;
|
CORE_ADDR base;
|
||||||
|
|
||||||
low_pos = discrete_position (base_index_type, low);
|
low_pos = discrete_position (base_index_type, low);
|
||||||
@@ -3132,7 +3132,7 @@ ada_value_slice (struct value *array, int low, int high)
|
|||||||
(alloc, type->target_type (), index_type,
|
(alloc, type->target_type (), index_type,
|
||||||
type->dyn_prop (DYN_PROP_BYTE_STRIDE),
|
type->dyn_prop (DYN_PROP_BYTE_STRIDE),
|
||||||
type->field (0).bitsize ());
|
type->field (0).bitsize ());
|
||||||
gdb::optional<LONGEST> low_pos, high_pos;
|
std::optional<LONGEST> low_pos, high_pos;
|
||||||
|
|
||||||
|
|
||||||
low_pos = discrete_position (base_index_type, low);
|
low_pos = discrete_position (base_index_type, low);
|
||||||
@@ -8792,7 +8792,7 @@ pos_atr (struct value *arg)
|
|||||||
if (!discrete_type_p (type))
|
if (!discrete_type_p (type))
|
||||||
error (_("'POS only defined on discrete types"));
|
error (_("'POS only defined on discrete types"));
|
||||||
|
|
||||||
gdb::optional<LONGEST> result = discrete_position (type, value_as_long (val));
|
std::optional<LONGEST> result = discrete_position (type, value_as_long (val));
|
||||||
if (!result.has_value ())
|
if (!result.has_value ())
|
||||||
error (_("enumeration value is invalid: can't find 'POS"));
|
error (_("enumeration value is invalid: can't find 'POS"));
|
||||||
|
|
||||||
|
|||||||
@@ -713,7 +713,7 @@ processAttribute (const char *str)
|
|||||||
if (strcasecmp (str, item.name) == 0)
|
if (strcasecmp (str, item.name) == 0)
|
||||||
return item.code;
|
return item.code;
|
||||||
|
|
||||||
gdb::optional<int> found;
|
std::optional<int> found;
|
||||||
for (const auto &item : attributes)
|
for (const auto &item : attributes)
|
||||||
if (subseqMatch (str, item.name))
|
if (subseqMatch (str, item.name))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -385,7 +385,7 @@ ada_print_scalar (struct type *type, LONGEST val, struct ui_file *stream)
|
|||||||
|
|
||||||
case TYPE_CODE_ENUM:
|
case TYPE_CODE_ENUM:
|
||||||
{
|
{
|
||||||
gdb::optional<LONGEST> posn = discrete_position (type, val);
|
std::optional<LONGEST> posn = discrete_position (type, val);
|
||||||
if (posn.has_value ())
|
if (posn.has_value ())
|
||||||
fputs_styled (ada_enum_name (type->field (*posn).name ()),
|
fputs_styled (ada_enum_name (type->field (*posn).name ()),
|
||||||
variable_name_style.style (), stream);
|
variable_name_style.style (), stream);
|
||||||
@@ -827,7 +827,7 @@ ada_val_print_enum (struct value *value, struct ui_file *stream, int recurse,
|
|||||||
int offset_aligned = ada_aligned_value_addr (type, valaddr) - valaddr;
|
int offset_aligned = ada_aligned_value_addr (type, valaddr) - valaddr;
|
||||||
|
|
||||||
val = unpack_long (type, valaddr + offset_aligned);
|
val = unpack_long (type, valaddr + offset_aligned);
|
||||||
gdb::optional<LONGEST> posn = discrete_position (type, val);
|
std::optional<LONGEST> posn = discrete_position (type, val);
|
||||||
if (posn.has_value ())
|
if (posn.has_value ())
|
||||||
{
|
{
|
||||||
const char *name = ada_enum_name (type->field (*posn).name ());
|
const char *name = ada_enum_name (type->field (*posn).name ());
|
||||||
|
|||||||
@@ -528,7 +528,7 @@ amd_dbgapi_target::xfer_partial (enum target_object object, const char *annex,
|
|||||||
ULONGEST offset, ULONGEST requested_len,
|
ULONGEST offset, ULONGEST requested_len,
|
||||||
ULONGEST *xfered_len)
|
ULONGEST *xfered_len)
|
||||||
{
|
{
|
||||||
gdb::optional<scoped_restore_current_thread> maybe_restore_thread;
|
std::optional<scoped_restore_current_thread> maybe_restore_thread;
|
||||||
|
|
||||||
if (!ptid_is_gpu (inferior_ptid))
|
if (!ptid_is_gpu (inferior_ptid))
|
||||||
return beneath ()->xfer_partial (object, annex, readbuf, writebuf, offset,
|
return beneath ()->xfer_partial (object, annex, readbuf, writebuf, offset,
|
||||||
@@ -1901,7 +1901,7 @@ static void
|
|||||||
amd_dbgapi_log_message_callback (amd_dbgapi_log_level_t level,
|
amd_dbgapi_log_message_callback (amd_dbgapi_log_level_t level,
|
||||||
const char *message)
|
const char *message)
|
||||||
{
|
{
|
||||||
gdb::optional<target_terminal::scoped_restore_terminal_state> tstate;
|
std::optional<target_terminal::scoped_restore_terminal_state> tstate;
|
||||||
|
|
||||||
if (target_supports_terminal_ours ())
|
if (target_supports_terminal_ours ())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -233,7 +233,7 @@ annotate_thread_changed (void)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
annotate_thread_exited (thread_info *t,
|
annotate_thread_exited (thread_info *t,
|
||||||
gdb::optional<ULONGEST> exit_code,
|
std::optional<ULONGEST> exit_code,
|
||||||
bool /* silent */)
|
bool /* silent */)
|
||||||
{
|
{
|
||||||
if (annotation_level > 1)
|
if (annotation_level > 1)
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ arm_fbsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
|
|||||||
/* See arm-fbsd-tdep.h. */
|
/* See arm-fbsd-tdep.h. */
|
||||||
|
|
||||||
const struct target_desc *
|
const struct target_desc *
|
||||||
arm_fbsd_read_description_auxv (const gdb::optional<gdb::byte_vector> &auxv,
|
arm_fbsd_read_description_auxv (const std::optional<gdb::byte_vector> &auxv,
|
||||||
target_ops *target, gdbarch *gdbarch, bool tls)
|
target_ops *target, gdbarch *gdbarch, bool tls)
|
||||||
{
|
{
|
||||||
CORE_ADDR arm_hwcap = 0;
|
CORE_ADDR arm_hwcap = 0;
|
||||||
@@ -244,7 +244,7 @@ arm_fbsd_read_description_auxv (const gdb::optional<gdb::byte_vector> &auxv,
|
|||||||
const struct target_desc *
|
const struct target_desc *
|
||||||
arm_fbsd_read_description_auxv (bool tls)
|
arm_fbsd_read_description_auxv (bool tls)
|
||||||
{
|
{
|
||||||
const gdb::optional<gdb::byte_vector> &auxv = target_read_auxv ();
|
const std::optional<gdb::byte_vector> &auxv = target_read_auxv ();
|
||||||
return arm_fbsd_read_description_auxv (auxv,
|
return arm_fbsd_read_description_auxv (auxv,
|
||||||
current_inferior ()->top_target (),
|
current_inferior ()->top_target (),
|
||||||
current_inferior ()->arch (),
|
current_inferior ()->arch (),
|
||||||
@@ -260,7 +260,7 @@ arm_fbsd_core_read_description (struct gdbarch *gdbarch,
|
|||||||
{
|
{
|
||||||
asection *tls = bfd_get_section_by_name (abfd, ".reg-aarch-tls");
|
asection *tls = bfd_get_section_by_name (abfd, ".reg-aarch-tls");
|
||||||
|
|
||||||
gdb::optional<gdb::byte_vector> auxv = target_read_auxv_raw (target);
|
std::optional<gdb::byte_vector> auxv = target_read_auxv_raw (target);
|
||||||
return arm_fbsd_read_description_auxv (auxv, target, gdbarch, tls != nullptr);
|
return arm_fbsd_read_description_auxv (auxv, target, gdbarch, tls != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ extern const struct regset arm_fbsd_tls_regset;
|
|||||||
AUXV. */
|
AUXV. */
|
||||||
|
|
||||||
extern const struct target_desc *
|
extern const struct target_desc *
|
||||||
arm_fbsd_read_description_auxv (const gdb::optional<gdb::byte_vector> &auxv,
|
arm_fbsd_read_description_auxv (const std::optional<gdb::byte_vector> &auxv,
|
||||||
target_ops *target, gdbarch *gdbarch,
|
target_ops *target, gdbarch *gdbarch,
|
||||||
bool tls);
|
bool tls);
|
||||||
|
|
||||||
|
|||||||
@@ -732,7 +732,7 @@ arm_linux_core_read_description (struct gdbarch *gdbarch,
|
|||||||
struct target_ops *target,
|
struct target_ops *target,
|
||||||
bfd *abfd)
|
bfd *abfd)
|
||||||
{
|
{
|
||||||
gdb::optional<gdb::byte_vector> auxv = target_read_auxv_raw (target);
|
std::optional<gdb::byte_vector> auxv = target_read_auxv_raw (target);
|
||||||
CORE_ADDR arm_hwcap = linux_get_hwcap (auxv, target, gdbarch);
|
CORE_ADDR arm_hwcap = linux_get_hwcap (auxv, target, gdbarch);
|
||||||
|
|
||||||
if (arm_hwcap & HWCAP_VFP)
|
if (arm_hwcap & HWCAP_VFP)
|
||||||
|
|||||||
@@ -302,7 +302,7 @@ struct arm_prologue_cache
|
|||||||
int framereg;
|
int framereg;
|
||||||
|
|
||||||
/* True if the return address is signed, false otherwise. */
|
/* True if the return address is signed, false otherwise. */
|
||||||
gdb::optional<bool> ra_signed_state;
|
std::optional<bool> ra_signed_state;
|
||||||
|
|
||||||
/* Saved register offsets. */
|
/* Saved register offsets. */
|
||||||
trad_frame_saved_reg *saved_regs;
|
trad_frame_saved_reg *saved_regs;
|
||||||
@@ -1035,7 +1035,7 @@ thumb_analyze_prologue (struct gdbarch *gdbarch,
|
|||||||
while (start < limit)
|
while (start < limit)
|
||||||
{
|
{
|
||||||
unsigned short insn;
|
unsigned short insn;
|
||||||
gdb::optional<bool> ra_signed_state;
|
std::optional<bool> ra_signed_state;
|
||||||
|
|
||||||
insn = read_code_unsigned_integer (start, 2, byte_order_for_code);
|
insn = read_code_unsigned_integer (start, 2, byte_order_for_code);
|
||||||
|
|
||||||
|
|||||||
@@ -914,7 +914,7 @@ source_script_file (struct auto_load_pspace_info *pspace_info,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
gdb::optional<open_script> opened = find_and_open_script (file,
|
std::optional<open_script> opened = find_and_open_script (file,
|
||||||
1 /*search_path*/);
|
1 /*search_path*/);
|
||||||
|
|
||||||
if (opened)
|
if (opened)
|
||||||
|
|||||||
10
gdb/auxv.c
10
gdb/auxv.c
@@ -331,7 +331,7 @@ parse_auxv (target_ops *ops, gdbarch *gdbarch, const gdb_byte **readptr,
|
|||||||
overhead of transfering data from a remote target to the local host. */
|
overhead of transfering data from a remote target to the local host. */
|
||||||
struct auxv_info
|
struct auxv_info
|
||||||
{
|
{
|
||||||
gdb::optional<gdb::byte_vector> data;
|
std::optional<gdb::byte_vector> data;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Per-inferior data key for auxv. */
|
/* Per-inferior data key for auxv. */
|
||||||
@@ -357,7 +357,7 @@ auxv_all_objfiles_removed (program_space *pspace)
|
|||||||
|
|
||||||
/* See auxv.h. */
|
/* See auxv.h. */
|
||||||
|
|
||||||
const gdb::optional<gdb::byte_vector> &
|
const std::optional<gdb::byte_vector> &
|
||||||
target_read_auxv ()
|
target_read_auxv ()
|
||||||
{
|
{
|
||||||
inferior *inf = current_inferior ();
|
inferior *inf = current_inferior ();
|
||||||
@@ -374,7 +374,7 @@ target_read_auxv ()
|
|||||||
|
|
||||||
/* See auxv.h. */
|
/* See auxv.h. */
|
||||||
|
|
||||||
gdb::optional<gdb::byte_vector>
|
std::optional<gdb::byte_vector>
|
||||||
target_read_auxv_raw (target_ops *ops)
|
target_read_auxv_raw (target_ops *ops)
|
||||||
{
|
{
|
||||||
return target_read_alloc (ops, TARGET_OBJECT_AUXV, NULL);
|
return target_read_alloc (ops, TARGET_OBJECT_AUXV, NULL);
|
||||||
@@ -413,7 +413,7 @@ target_auxv_search (const gdb::byte_vector &auxv, target_ops *ops,
|
|||||||
int
|
int
|
||||||
target_auxv_search (CORE_ADDR match, CORE_ADDR *valp)
|
target_auxv_search (CORE_ADDR match, CORE_ADDR *valp)
|
||||||
{
|
{
|
||||||
const gdb::optional<gdb::byte_vector> &auxv = target_read_auxv ();
|
const std::optional<gdb::byte_vector> &auxv = target_read_auxv ();
|
||||||
|
|
||||||
if (!auxv.has_value ())
|
if (!auxv.has_value ())
|
||||||
return -1;
|
return -1;
|
||||||
@@ -572,7 +572,7 @@ fprint_target_auxv (struct ui_file *file)
|
|||||||
gdbarch *gdbarch = current_inferior ()->arch ();
|
gdbarch *gdbarch = current_inferior ()->arch ();
|
||||||
CORE_ADDR type, val;
|
CORE_ADDR type, val;
|
||||||
int ents = 0;
|
int ents = 0;
|
||||||
const gdb::optional<gdb::byte_vector> &auxv = target_read_auxv ();
|
const std::optional<gdb::byte_vector> &auxv = target_read_auxv ();
|
||||||
|
|
||||||
if (!auxv.has_value ())
|
if (!auxv.has_value ())
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@@ -48,11 +48,11 @@ extern int svr4_auxv_parse (struct gdbarch *gdbarch, const gdb_byte **readptr,
|
|||||||
|
|
||||||
/* Read auxv data from the current inferior's target stack. */
|
/* Read auxv data from the current inferior's target stack. */
|
||||||
|
|
||||||
extern const gdb::optional<gdb::byte_vector> &target_read_auxv ();
|
extern const std::optional<gdb::byte_vector> &target_read_auxv ();
|
||||||
|
|
||||||
/* Read auxv data from OPS. */
|
/* Read auxv data from OPS. */
|
||||||
|
|
||||||
extern gdb::optional<gdb::byte_vector> target_read_auxv_raw (target_ops *ops);
|
extern std::optional<gdb::byte_vector> target_read_auxv_raw (target_ops *ops);
|
||||||
|
|
||||||
/* Search AUXV for an entry with a_type matching MATCH.
|
/* Search AUXV for an entry with a_type matching MATCH.
|
||||||
|
|
||||||
|
|||||||
@@ -1566,7 +1566,7 @@ avr_io_reg_read_command (const char *args, int from_tty)
|
|||||||
unsigned int val;
|
unsigned int val;
|
||||||
|
|
||||||
/* Find out how many io registers the target has. */
|
/* Find out how many io registers the target has. */
|
||||||
gdb::optional<gdb::byte_vector> buf
|
std::optional<gdb::byte_vector> buf
|
||||||
= target_read_alloc (current_inferior ()->top_target (),
|
= target_read_alloc (current_inferior ()->top_target (),
|
||||||
TARGET_OBJECT_AVR, "avr.io_reg");
|
TARGET_OBJECT_AVR, "avr.io_reg");
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "progspace-and-thread.h"
|
#include "progspace-and-thread.h"
|
||||||
#include "gdbsupport/array-view.h"
|
#include "gdbsupport/array-view.h"
|
||||||
#include "gdbsupport/gdb_optional.h"
|
#include <optional>
|
||||||
#include "gdbsupport/common-utils.h"
|
#include "gdbsupport/common-utils.h"
|
||||||
|
|
||||||
/* Prototypes for local functions. */
|
/* Prototypes for local functions. */
|
||||||
@@ -2067,7 +2067,7 @@ update_watchpoint (struct watchpoint *b, bool reparse)
|
|||||||
if (b->disposition == disp_del_at_next_stop)
|
if (b->disposition == disp_del_at_next_stop)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gdb::optional<scoped_restore_selected_frame> restore_frame;
|
std::optional<scoped_restore_selected_frame> restore_frame;
|
||||||
|
|
||||||
/* Determine if the watchpoint is within scope. */
|
/* Determine if the watchpoint is within scope. */
|
||||||
if (b->exp_valid_block == NULL)
|
if (b->exp_valid_block == NULL)
|
||||||
@@ -3365,7 +3365,7 @@ remove_breakpoints (void)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
remove_threaded_breakpoints (thread_info *tp,
|
remove_threaded_breakpoints (thread_info *tp,
|
||||||
gdb::optional<ULONGEST> /* exit_code */,
|
std::optional<ULONGEST> /* exit_code */,
|
||||||
int /* silent */)
|
int /* silent */)
|
||||||
{
|
{
|
||||||
for (breakpoint &b : all_breakpoints_safe ())
|
for (breakpoint &b : all_breakpoints_safe ())
|
||||||
@@ -6780,8 +6780,8 @@ print_one_breakpoint_location (struct breakpoint *b,
|
|||||||
(uiout->test_flags (fix_breakpoint_script_output)
|
(uiout->test_flags (fix_breakpoint_script_output)
|
||||||
|| fix_breakpoint_script_output_globally);
|
|| fix_breakpoint_script_output_globally);
|
||||||
|
|
||||||
gdb::optional<ui_out_emit_tuple> tuple_emitter;
|
std::optional<ui_out_emit_tuple> tuple_emitter;
|
||||||
gdb::optional<ui_out_emit_list> list_emitter;
|
std::optional<ui_out_emit_list> list_emitter;
|
||||||
|
|
||||||
if (use_fixed_output)
|
if (use_fixed_output)
|
||||||
list_emitter.emplace (uiout, "script");
|
list_emitter.emplace (uiout, "script");
|
||||||
@@ -6854,7 +6854,8 @@ print_one_breakpoint (breakpoint *b, const bp_location **last_loc, int allflag)
|
|||||||
= (uiout->test_flags (fix_multi_location_breakpoint_output)
|
= (uiout->test_flags (fix_multi_location_breakpoint_output)
|
||||||
|| fix_multi_location_breakpoint_output_globally);
|
|| fix_multi_location_breakpoint_output_globally);
|
||||||
|
|
||||||
gdb::optional<ui_out_emit_tuple> bkpt_tuple_emitter (gdb::in_place, uiout, "bkpt");
|
std::optional<ui_out_emit_tuple> bkpt_tuple_emitter (std::in_place, uiout,
|
||||||
|
"bkpt");
|
||||||
bool printed = print_one_breakpoint_location (b, NULL, 0, last_loc,
|
bool printed = print_one_breakpoint_location (b, NULL, 0, last_loc,
|
||||||
allflag, false);
|
allflag, false);
|
||||||
|
|
||||||
@@ -6889,7 +6890,7 @@ print_one_breakpoint (breakpoint *b, const bp_location **last_loc, int allflag)
|
|||||||
|| !b->first_loc ().enabled
|
|| !b->first_loc ().enabled
|
||||||
|| b->first_loc ().disabled_by_cond))))
|
|| b->first_loc ().disabled_by_cond))))
|
||||||
{
|
{
|
||||||
gdb::optional<ui_out_emit_list> locations_list;
|
std::optional<ui_out_emit_list> locations_list;
|
||||||
|
|
||||||
/* For MI version <= 2, keep the behavior where GDB outputs an invalid
|
/* For MI version <= 2, keep the behavior where GDB outputs an invalid
|
||||||
MI record. For later versions, place breakpoint locations in a
|
MI record. For later versions, place breakpoint locations in a
|
||||||
@@ -9954,7 +9955,7 @@ watchpoint::print_it (const bpstat *bs) const
|
|||||||
|
|
||||||
string_file stb;
|
string_file stb;
|
||||||
|
|
||||||
gdb::optional<ui_out_emit_tuple> tuple_emitter;
|
std::optional<ui_out_emit_tuple> tuple_emitter;
|
||||||
switch (this->type)
|
switch (this->type)
|
||||||
{
|
{
|
||||||
case bp_watchpoint:
|
case bp_watchpoint:
|
||||||
@@ -10932,7 +10933,7 @@ until_break_command (const char *arg, int from_tty, int anywhere)
|
|||||||
|
|
||||||
std::vector<breakpoint_up> breakpoints;
|
std::vector<breakpoint_up> breakpoints;
|
||||||
|
|
||||||
gdb::optional<delete_longjmp_breakpoint_cleanup> lj_deleter;
|
std::optional<delete_longjmp_breakpoint_cleanup> lj_deleter;
|
||||||
|
|
||||||
if (frame_id_p (caller_frame_id))
|
if (frame_id_p (caller_frame_id))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -643,7 +643,7 @@ buildsym_compunit::record_line (struct subfile *subfile, int line,
|
|||||||
anyway. */
|
anyway. */
|
||||||
if (line == 0)
|
if (line == 0)
|
||||||
{
|
{
|
||||||
gdb::optional<int> last_line;
|
std::optional<int> last_line;
|
||||||
|
|
||||||
while (!subfile->line_vector_entries.empty ())
|
while (!subfile->line_vector_entries.empty ())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -655,12 +655,12 @@ show_script_ext_mode (struct ui_file *file, int from_tty,
|
|||||||
If SEARCH_PATH is non-zero, and the file isn't found in cwd,
|
If SEARCH_PATH is non-zero, and the file isn't found in cwd,
|
||||||
search for it in the source search path. */
|
search for it in the source search path. */
|
||||||
|
|
||||||
gdb::optional<open_script>
|
std::optional<open_script>
|
||||||
find_and_open_script (const char *script_file, int search_path)
|
find_and_open_script (const char *script_file, int search_path)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
openp_flags search_flags = OPF_TRY_CWD_FIRST | OPF_RETURN_REALPATH;
|
openp_flags search_flags = OPF_TRY_CWD_FIRST | OPF_RETURN_REALPATH;
|
||||||
gdb::optional<open_script> opened;
|
std::optional<open_script> opened;
|
||||||
|
|
||||||
gdb::unique_xmalloc_ptr<char> file (tilde_expand (script_file));
|
gdb::unique_xmalloc_ptr<char> file (tilde_expand (script_file));
|
||||||
|
|
||||||
@@ -742,7 +742,7 @@ source_script_with_search (const char *file, int from_tty, int search_path)
|
|||||||
if (file == NULL || *file == 0)
|
if (file == NULL || *file == 0)
|
||||||
error (_("source command requires file name of file to source."));
|
error (_("source command requires file name of file to source."));
|
||||||
|
|
||||||
gdb::optional<open_script> opened = find_and_open_script (file, search_path);
|
std::optional<open_script> opened = find_and_open_script (file, search_path);
|
||||||
if (!opened)
|
if (!opened)
|
||||||
{
|
{
|
||||||
/* The script wasn't found, or was otherwise inaccessible.
|
/* The script wasn't found, or was otherwise inaccessible.
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
#define CLI_CLI_CMDS_H
|
#define CLI_CLI_CMDS_H
|
||||||
|
|
||||||
#include "gdbsupport/filestuff.h"
|
#include "gdbsupport/filestuff.h"
|
||||||
#include "gdbsupport/gdb_optional.h"
|
#include <optional>
|
||||||
#include "completer.h"
|
#include "completer.h"
|
||||||
|
|
||||||
/* Chain containing all defined commands. */
|
/* Chain containing all defined commands. */
|
||||||
@@ -179,7 +179,7 @@ struct open_script
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
extern gdb::optional<open_script>
|
extern std::optional<open_script>
|
||||||
find_and_open_script (const char *file, int search_path);
|
find_and_open_script (const char *file, int search_path);
|
||||||
|
|
||||||
/* Command tracing state. */
|
/* Command tracing state. */
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
#include "cli/cli-cmds.h"
|
#include "cli/cli-cmds.h"
|
||||||
#include "cli/cli-decode.h"
|
#include "cli/cli-decode.h"
|
||||||
#include "cli/cli-style.h"
|
#include "cli/cli-style.h"
|
||||||
#include "gdbsupport/gdb_optional.h"
|
#include <optional>
|
||||||
|
|
||||||
/* Prototypes for local functions. */
|
/* Prototypes for local functions. */
|
||||||
|
|
||||||
@@ -2727,7 +2727,7 @@ cmd_func (struct cmd_list_element *cmd, const char *args, int from_tty)
|
|||||||
{
|
{
|
||||||
if (!cmd->is_command_class_help ())
|
if (!cmd->is_command_class_help ())
|
||||||
{
|
{
|
||||||
gdb::optional<scoped_restore_tmpl<bool>> restore_suppress;
|
std::optional<scoped_restore_tmpl<bool>> restore_suppress;
|
||||||
|
|
||||||
if (cmd->suppress_notification != NULL)
|
if (cmd->suppress_notification != NULL)
|
||||||
restore_suppress.emplace (cmd->suppress_notification, true);
|
restore_suppress.emplace (cmd->suppress_notification, true);
|
||||||
|
|||||||
@@ -233,7 +233,7 @@ struct cmd_list_element
|
|||||||
void (*destroyer) (struct cmd_list_element *self, void *context) = nullptr;
|
void (*destroyer) (struct cmd_list_element *self, void *context) = nullptr;
|
||||||
|
|
||||||
/* Setting affected by "set" and "show". Not used if type is not_set_cmd. */
|
/* Setting affected by "set" and "show". Not used if type is not_set_cmd. */
|
||||||
gdb::optional<setting> var;
|
std::optional<setting> var;
|
||||||
|
|
||||||
/* Pointer to NULL terminated list of enumerated values (like
|
/* Pointer to NULL terminated list of enumerated values (like
|
||||||
argv). */
|
argv). */
|
||||||
|
|||||||
@@ -58,11 +58,11 @@ struct option_def_and_value
|
|||||||
void *ctx;
|
void *ctx;
|
||||||
|
|
||||||
/* The option's value, if any. */
|
/* The option's value, if any. */
|
||||||
gdb::optional<option_value> value;
|
std::optional<option_value> value;
|
||||||
|
|
||||||
/* Constructor. */
|
/* Constructor. */
|
||||||
option_def_and_value (const option_def &option_, void *ctx_,
|
option_def_and_value (const option_def &option_, void *ctx_,
|
||||||
gdb::optional<option_value> &&value_ = {})
|
std::optional<option_value> &&value_ = {})
|
||||||
: option (option_),
|
: option (option_),
|
||||||
ctx (ctx_),
|
ctx (ctx_),
|
||||||
value (std::move (value_))
|
value (std::move (value_))
|
||||||
@@ -99,7 +99,7 @@ private:
|
|||||||
allocated on the heap, so we must clear the pointer in the
|
allocated on the heap, so we must clear the pointer in the
|
||||||
source, to avoid a double free. */
|
source, to avoid a double free. */
|
||||||
static void clear_value (const option_def &option,
|
static void clear_value (const option_def &option,
|
||||||
gdb::optional<option_value> &value)
|
std::optional<option_value> &value)
|
||||||
{
|
{
|
||||||
if (value.has_value ())
|
if (value.has_value ())
|
||||||
{
|
{
|
||||||
@@ -109,7 +109,7 @@ private:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static void save_option_value_in_ctx (gdb::optional<option_def_and_value> &ov);
|
static void save_option_value_in_ctx (std::optional<option_def_and_value> &ov);
|
||||||
|
|
||||||
/* Info passed around when handling completion. */
|
/* Info passed around when handling completion. */
|
||||||
struct parse_option_completion_info
|
struct parse_option_completion_info
|
||||||
@@ -177,7 +177,7 @@ complete_on_all_options (completion_tracker &tracker,
|
|||||||
/* Parse ARGS, guided by OPTIONS_GROUP. HAVE_DELIMITER is true if the
|
/* Parse ARGS, guided by OPTIONS_GROUP. HAVE_DELIMITER is true if the
|
||||||
whole ARGS line included the "--" options-terminator delimiter. */
|
whole ARGS line included the "--" options-terminator delimiter. */
|
||||||
|
|
||||||
static gdb::optional<option_def_and_value>
|
static std::optional<option_def_and_value>
|
||||||
parse_option (gdb::array_view<const option_def_group> options_group,
|
parse_option (gdb::array_view<const option_def_group> options_group,
|
||||||
process_options_mode mode,
|
process_options_mode mode,
|
||||||
bool have_delimiter,
|
bool have_delimiter,
|
||||||
@@ -496,7 +496,7 @@ complete_options (completion_tracker &tracker,
|
|||||||
}
|
}
|
||||||
else if (**args == '-')
|
else if (**args == '-')
|
||||||
{
|
{
|
||||||
gdb::optional<option_def_and_value> ov
|
std::optional<option_def_and_value> ov
|
||||||
= parse_option (options_group, mode, have_delimiter,
|
= parse_option (options_group, mode, have_delimiter,
|
||||||
args, &completion_info);
|
args, &completion_info);
|
||||||
if (!ov && !tracker.have_completions ())
|
if (!ov && !tracker.have_completions ())
|
||||||
@@ -589,7 +589,7 @@ complete_options (completion_tracker &tracker,
|
|||||||
/* Save the parsed value in the option's context. */
|
/* Save the parsed value in the option's context. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
save_option_value_in_ctx (gdb::optional<option_def_and_value> &ov)
|
save_option_value_in_ctx (std::optional<option_def_and_value> &ov)
|
||||||
{
|
{
|
||||||
switch (ov->option.type)
|
switch (ov->option.type)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
#ifndef CLI_OPTION_H
|
#ifndef CLI_OPTION_H
|
||||||
#define CLI_OPTION_H 1
|
#define CLI_OPTION_H 1
|
||||||
|
|
||||||
#include "gdbsupport/gdb_optional.h"
|
#include <optional>
|
||||||
#include "gdbsupport/array-view.h"
|
#include "gdbsupport/array-view.h"
|
||||||
#include "completer.h"
|
#include "completer.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ struct literal_def
|
|||||||
LONGEST use;
|
LONGEST use;
|
||||||
|
|
||||||
/* An optional number accepted that stands for the literal. */
|
/* An optional number accepted that stands for the literal. */
|
||||||
gdb::optional<LONGEST> val;
|
std::optional<LONGEST> val;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Return true if a setting of type VAR_TYPE is backed with type T.
|
/* Return true if a setting of type VAR_TYPE is backed with type T.
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
#include "osabi.h"
|
#include "osabi.h"
|
||||||
#include "gdbsupport/gdb_wait.h"
|
#include "gdbsupport/gdb_wait.h"
|
||||||
#include "valprint.h"
|
#include "valprint.h"
|
||||||
#include "gdbsupport/gdb_optional.h"
|
#include <optional>
|
||||||
#include "gdbsupport/gdb_unlinker.h"
|
#include "gdbsupport/gdb_unlinker.h"
|
||||||
#include "gdbsupport/pathstuff.h"
|
#include "gdbsupport/pathstuff.h"
|
||||||
#include "gdbsupport/scoped_ignore_signal.h"
|
#include "gdbsupport/scoped_ignore_signal.h"
|
||||||
@@ -768,7 +768,7 @@ compile_to_object (struct command_line *cmd, const char *cmd_string,
|
|||||||
|
|
||||||
compile_file_names fnames = get_new_file_names ();
|
compile_file_names fnames = get_new_file_names ();
|
||||||
|
|
||||||
gdb::optional<gdb::unlinker> source_remover;
|
std::optional<gdb::unlinker> source_remover;
|
||||||
|
|
||||||
{
|
{
|
||||||
gdb_file_up src = gdb_fopen_cloexec (fnames.source_file (), "w");
|
gdb_file_up src = gdb_fopen_cloexec (fnames.source_file (), "w");
|
||||||
|
|||||||
@@ -1967,7 +1967,7 @@ darwin_nat_target::create_inferior (const char *exec_file,
|
|||||||
const std::string &allargs,
|
const std::string &allargs,
|
||||||
char **env, int from_tty)
|
char **env, int from_tty)
|
||||||
{
|
{
|
||||||
gdb::optional<scoped_restore_tmpl<bool>> restore_startup_with_shell;
|
std::optional<scoped_restore_tmpl<bool>> restore_startup_with_shell;
|
||||||
darwin_nat_target *the_target = this;
|
darwin_nat_target *the_target = this;
|
||||||
|
|
||||||
if (startup_with_shell && may_have_sip ())
|
if (startup_with_shell && may_have_sip ())
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include "gdbsupport/scoped_fd.h"
|
#include "gdbsupport/scoped_fd.h"
|
||||||
#include "debuginfod-support.h"
|
#include "debuginfod-support.h"
|
||||||
#include "gdbsupport/gdb_optional.h"
|
#include <optional>
|
||||||
#include "cli/cli-cmds.h"
|
#include "cli/cli-cmds.h"
|
||||||
#include "cli/cli-style.h"
|
#include "cli/cli-style.h"
|
||||||
#include "cli-out.h"
|
#include "cli-out.h"
|
||||||
@@ -320,7 +320,7 @@ debuginfod_source_query (const unsigned char *build_id,
|
|||||||
|
|
||||||
char *dname = nullptr;
|
char *dname = nullptr;
|
||||||
scoped_fd fd;
|
scoped_fd fd;
|
||||||
gdb::optional<target_terminal::scoped_restore_terminal_state> term_state;
|
std::optional<target_terminal::scoped_restore_terminal_state> term_state;
|
||||||
|
|
||||||
{
|
{
|
||||||
user_data data ("source file", srcpath);
|
user_data data ("source file", srcpath);
|
||||||
@@ -366,7 +366,7 @@ debuginfod_debuginfo_query (const unsigned char *build_id,
|
|||||||
|
|
||||||
char *dname = nullptr;
|
char *dname = nullptr;
|
||||||
scoped_fd fd;
|
scoped_fd fd;
|
||||||
gdb::optional<target_terminal::scoped_restore_terminal_state> term_state;
|
std::optional<target_terminal::scoped_restore_terminal_state> term_state;
|
||||||
|
|
||||||
{
|
{
|
||||||
user_data data ("separate debug info for", filename);
|
user_data data ("separate debug info for", filename);
|
||||||
@@ -409,7 +409,7 @@ debuginfod_exec_query (const unsigned char *build_id,
|
|||||||
|
|
||||||
char *dname = nullptr;
|
char *dname = nullptr;
|
||||||
scoped_fd fd;
|
scoped_fd fd;
|
||||||
gdb::optional<target_terminal::scoped_restore_terminal_state> term_state;
|
std::optional<target_terminal::scoped_restore_terminal_state> term_state;
|
||||||
|
|
||||||
{
|
{
|
||||||
user_data data ("executable for", filename);
|
user_data data ("executable for", filename);
|
||||||
@@ -458,7 +458,7 @@ debuginfod_section_query (const unsigned char *build_id,
|
|||||||
char *dname = nullptr;
|
char *dname = nullptr;
|
||||||
std::string desc = std::string ("section ") + section_name + " for";
|
std::string desc = std::string ("section ") + section_name + " for";
|
||||||
scoped_fd fd;
|
scoped_fd fd;
|
||||||
gdb::optional<target_terminal::scoped_restore_terminal_state> term_state;
|
std::optional<target_terminal::scoped_restore_terminal_state> term_state;
|
||||||
|
|
||||||
{
|
{
|
||||||
user_data data (desc.c_str (), filename);
|
user_data data (desc.c_str (), filename);
|
||||||
|
|||||||
14
gdb/disasm.c
14
gdb/disasm.c
@@ -29,7 +29,7 @@
|
|||||||
#include "source.h"
|
#include "source.h"
|
||||||
#include "gdbsupport/gdb-safe-ctype.h"
|
#include "gdbsupport/gdb-safe-ctype.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "gdbsupport/gdb_optional.h"
|
#include <optional>
|
||||||
#include "valprint.h"
|
#include "valprint.h"
|
||||||
#include "cli/cli-style.h"
|
#include "cli/cli-style.h"
|
||||||
#include "objfiles.h"
|
#include "objfiles.h"
|
||||||
@@ -653,8 +653,8 @@ do_mixed_source_and_assembly_deprecated
|
|||||||
|
|
||||||
ui_out_emit_list asm_insns_list (uiout, "asm_insns");
|
ui_out_emit_list asm_insns_list (uiout, "asm_insns");
|
||||||
|
|
||||||
gdb::optional<ui_out_emit_tuple> outer_tuple_emitter;
|
std::optional<ui_out_emit_tuple> outer_tuple_emitter;
|
||||||
gdb::optional<ui_out_emit_list> inner_list_emitter;
|
std::optional<ui_out_emit_list> inner_list_emitter;
|
||||||
|
|
||||||
for (i = 0; i < newlines; i++)
|
for (i = 0; i < newlines; i++)
|
||||||
{
|
{
|
||||||
@@ -810,8 +810,8 @@ do_mixed_source_and_assembly (struct gdbarch *gdbarch,
|
|||||||
|
|
||||||
ui_out_emit_list asm_insns_emitter (uiout, "asm_insns");
|
ui_out_emit_list asm_insns_emitter (uiout, "asm_insns");
|
||||||
|
|
||||||
gdb::optional<ui_out_emit_tuple> tuple_emitter;
|
std::optional<ui_out_emit_tuple> tuple_emitter;
|
||||||
gdb::optional<ui_out_emit_list> list_emitter;
|
std::optional<ui_out_emit_list> list_emitter;
|
||||||
|
|
||||||
last_symtab = NULL;
|
last_symtab = NULL;
|
||||||
last_line = 0;
|
last_line = 0;
|
||||||
@@ -1093,7 +1093,7 @@ gdb_print_insn_1 (struct gdbarch *gdbarch, CORE_ADDR vma,
|
|||||||
struct disassemble_info *info)
|
struct disassemble_info *info)
|
||||||
{
|
{
|
||||||
/* Call into the extension languages to do the disassembly. */
|
/* Call into the extension languages to do the disassembly. */
|
||||||
gdb::optional<int> length = ext_lang_print_insn (gdbarch, vma, info);
|
std::optional<int> length = ext_lang_print_insn (gdbarch, vma, info);
|
||||||
if (length.has_value ())
|
if (length.has_value ())
|
||||||
return *length;
|
return *length;
|
||||||
|
|
||||||
@@ -1125,7 +1125,7 @@ gdb_disassembler::print_insn (CORE_ADDR memaddr,
|
|||||||
this output. */
|
this output. */
|
||||||
if (length > 0 && use_ext_lang_for_styling ())
|
if (length > 0 && use_ext_lang_for_styling ())
|
||||||
{
|
{
|
||||||
gdb::optional<std::string> ext_contents;
|
std::optional<std::string> ext_contents;
|
||||||
ext_contents = ext_lang_colorize_disasm (m_buffer.string (), arch ());
|
ext_contents = ext_lang_colorize_disasm (m_buffer.string (), arch ());
|
||||||
if (ext_contents.has_value ())
|
if (ext_contents.has_value ())
|
||||||
m_buffer = std::move (*ext_contents);
|
m_buffer = std::move (*ext_contents);
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ private:
|
|||||||
negative value (which indicates an error), then, if this variable has
|
negative value (which indicates an error), then, if this variable has
|
||||||
a value, we report a memory error to the user, otherwise, we report a
|
a value, we report a memory error to the user, otherwise, we report a
|
||||||
non-memory error. */
|
non-memory error. */
|
||||||
gdb::optional<CORE_ADDR> m_err_memaddr;
|
std::optional<CORE_ADDR> m_err_memaddr;
|
||||||
|
|
||||||
/* The stream to which disassembler output will be written. */
|
/* The stream to which disassembler output will be written. */
|
||||||
ui_file *m_dest;
|
ui_file *m_dest;
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
#include "dwarf2.h"
|
#include "dwarf2.h"
|
||||||
#include "dwarf2/types.h"
|
#include "dwarf2/types.h"
|
||||||
#include "gdbsupport/gdb_optional.h"
|
#include <optional>
|
||||||
|
|
||||||
/* Blocks are a bunch of untyped bytes. */
|
/* Blocks are a bunch of untyped bytes. */
|
||||||
struct dwarf_block
|
struct dwarf_block
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "buildsym.h"
|
#include "buildsym.h"
|
||||||
#include "dwarf2/comp-unit-head.h"
|
#include "dwarf2/comp-unit-head.h"
|
||||||
#include "gdbsupport/gdb_optional.h"
|
#include <optional>
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
|
|
||||||
/* Type used for delaying computation of method physnames.
|
/* Type used for delaying computation of method physnames.
|
||||||
@@ -101,7 +101,7 @@ struct dwarf2_cu
|
|||||||
struct comp_unit_head header;
|
struct comp_unit_head header;
|
||||||
|
|
||||||
/* Base address of this compilation unit. */
|
/* Base address of this compilation unit. */
|
||||||
gdb::optional<unrelocated_addr> base_address;
|
std::optional<unrelocated_addr> base_address;
|
||||||
|
|
||||||
/* The language we are debugging. */
|
/* The language we are debugging. */
|
||||||
const struct language_defn *language_defn = nullptr;
|
const struct language_defn *language_defn = nullptr;
|
||||||
@@ -189,7 +189,7 @@ public:
|
|||||||
|
|
||||||
/* The DW_AT_addr_base (DW_AT_GNU_addr_base) attribute if present.
|
/* The DW_AT_addr_base (DW_AT_GNU_addr_base) attribute if present.
|
||||||
Note this value comes from the Fission stub CU/TU's DIE. */
|
Note this value comes from the Fission stub CU/TU's DIE. */
|
||||||
gdb::optional<ULONGEST> addr_base;
|
std::optional<ULONGEST> addr_base;
|
||||||
|
|
||||||
/* The DW_AT_GNU_ranges_base attribute, if present.
|
/* The DW_AT_GNU_ranges_base attribute, if present.
|
||||||
|
|
||||||
@@ -242,7 +242,7 @@ public:
|
|||||||
files, the value is implicitly zero. For DWARF 5 version DWO files, the
|
files, the value is implicitly zero. For DWARF 5 version DWO files, the
|
||||||
value is often implicit and is the size of the header of
|
value is often implicit and is the size of the header of
|
||||||
.debug_str_offsets section (8 or 4, depending on the address size). */
|
.debug_str_offsets section (8 or 4, depending on the address size). */
|
||||||
gdb::optional<ULONGEST> str_offsets_base;
|
std::optional<ULONGEST> str_offsets_base;
|
||||||
|
|
||||||
/* Mark used when releasing cached dies. */
|
/* Mark used when releasing cached dies. */
|
||||||
bool m_mark : 1;
|
bool m_mark : 1;
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ struct die_info
|
|||||||
/* Return the address base of the compile unit, which, if exists, is
|
/* Return the address base of the compile unit, which, if exists, is
|
||||||
stored either at the attribute DW_AT_GNU_addr_base, or
|
stored either at the attribute DW_AT_GNU_addr_base, or
|
||||||
DW_AT_addr_base. */
|
DW_AT_addr_base. */
|
||||||
gdb::optional<ULONGEST> addr_base ()
|
std::optional<ULONGEST> addr_base ()
|
||||||
{
|
{
|
||||||
for (unsigned i = 0; i < num_attrs; ++i)
|
for (unsigned i = 0; i < num_attrs; ++i)
|
||||||
if (attrs[i].name == DW_AT_addr_base
|
if (attrs[i].name == DW_AT_addr_base
|
||||||
@@ -73,7 +73,7 @@ struct die_info
|
|||||||
complaint (_("address base attribute (offset %s) as wrong form"),
|
complaint (_("address base attribute (offset %s) as wrong form"),
|
||||||
sect_offset_str (sect_off));
|
sect_offset_str (sect_off));
|
||||||
}
|
}
|
||||||
return gdb::optional<ULONGEST> ();
|
return std::optional<ULONGEST> ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the base address of the compile unit into the .debug_ranges section,
|
/* Return the base address of the compile unit into the .debug_ranges section,
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ private:
|
|||||||
std::string build_id_str;
|
std::string build_id_str;
|
||||||
|
|
||||||
/* Captured value of dwz build id. */
|
/* Captured value of dwz build id. */
|
||||||
gdb::optional<std::string> dwz_build_id_str;
|
std::optional<std::string> dwz_build_id_str;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Class to manage the access to the DWARF index cache. */
|
/* Class to manage the access to the DWARF index cache. */
|
||||||
|
|||||||
@@ -1473,7 +1473,7 @@ struct index_wip_file
|
|||||||
FILENAME_TEMP is unlinked, because on MS-Windows one cannot
|
FILENAME_TEMP is unlinked, because on MS-Windows one cannot
|
||||||
delete a file that is still open. So, we wrap the unlinker in an
|
delete a file that is still open. So, we wrap the unlinker in an
|
||||||
optional and emplace it once we know the file name. */
|
optional and emplace it once we know the file name. */
|
||||||
gdb::optional<gdb::unlinker> unlink_file;
|
std::optional<gdb::unlinker> unlink_file;
|
||||||
|
|
||||||
gdb_file_up out_file;
|
gdb_file_up out_file;
|
||||||
};
|
};
|
||||||
@@ -1496,7 +1496,7 @@ write_dwarf_index (dwarf2_per_bfd *per_bfd, const char *dir,
|
|||||||
? INDEX5_SUFFIX : INDEX4_SUFFIX);
|
? INDEX5_SUFFIX : INDEX4_SUFFIX);
|
||||||
|
|
||||||
index_wip_file objfile_index_wip (dir, basename, index_suffix);
|
index_wip_file objfile_index_wip (dir, basename, index_suffix);
|
||||||
gdb::optional<index_wip_file> dwz_index_wip;
|
std::optional<index_wip_file> dwz_index_wip;
|
||||||
|
|
||||||
if (dwz_basename != NULL)
|
if (dwz_basename != NULL)
|
||||||
dwz_index_wip.emplace (dir, dwz_basename, index_suffix);
|
dwz_index_wip.emplace (dir, dwz_basename, index_suffix);
|
||||||
|
|||||||
@@ -160,8 +160,8 @@ read_formatted_entries (dwarf2_per_objfile *per_objfile, bfd *abfd,
|
|||||||
ULONGEST form = read_unsigned_leb128 (abfd, format, &bytes_read);
|
ULONGEST form = read_unsigned_leb128 (abfd, format, &bytes_read);
|
||||||
format += bytes_read;
|
format += bytes_read;
|
||||||
|
|
||||||
gdb::optional<const char *> string;
|
std::optional<const char *> string;
|
||||||
gdb::optional<unsigned int> uint;
|
std::optional<unsigned int> uint;
|
||||||
|
|
||||||
switch (form)
|
switch (form)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -444,7 +444,7 @@ dwarf_decode_macro_bytes (dwarf2_per_objfile *per_objfile,
|
|||||||
unsigned int offset_size,
|
unsigned int offset_size,
|
||||||
struct dwarf2_section_info *str_section,
|
struct dwarf2_section_info *str_section,
|
||||||
struct dwarf2_section_info *str_offsets_section,
|
struct dwarf2_section_info *str_offsets_section,
|
||||||
gdb::optional<ULONGEST> str_offsets_base,
|
std::optional<ULONGEST> str_offsets_base,
|
||||||
htab_t include_hash, struct dwarf2_cu *cu)
|
htab_t include_hash, struct dwarf2_cu *cu)
|
||||||
{
|
{
|
||||||
struct objfile *objfile = per_objfile->objfile;
|
struct objfile *objfile = per_objfile->objfile;
|
||||||
@@ -805,7 +805,7 @@ dwarf_decode_macros (dwarf2_per_objfile *per_objfile,
|
|||||||
const struct line_header *lh, unsigned int offset_size,
|
const struct line_header *lh, unsigned int offset_size,
|
||||||
unsigned int offset, struct dwarf2_section_info *str_section,
|
unsigned int offset, struct dwarf2_section_info *str_section,
|
||||||
struct dwarf2_section_info *str_offsets_section,
|
struct dwarf2_section_info *str_offsets_section,
|
||||||
gdb::optional<ULONGEST> str_offsets_base,
|
std::optional<ULONGEST> str_offsets_base,
|
||||||
int section_is_gnu, struct dwarf2_cu *cu)
|
int section_is_gnu, struct dwarf2_cu *cu)
|
||||||
{
|
{
|
||||||
bfd *abfd;
|
bfd *abfd;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ extern void dwarf_decode_macros (dwarf2_per_objfile *per_objfile,
|
|||||||
unsigned int offset,
|
unsigned int offset,
|
||||||
dwarf2_section_info *str_section,
|
dwarf2_section_info *str_section,
|
||||||
dwarf2_section_info *str_offsets_section,
|
dwarf2_section_info *str_offsets_section,
|
||||||
gdb::optional<ULONGEST> str_offsets_base,
|
std::optional<ULONGEST> str_offsets_base,
|
||||||
int section_is_gnu, struct dwarf2_cu *cu);
|
int section_is_gnu, struct dwarf2_cu *cu);
|
||||||
|
|
||||||
#endif /* GDB_DWARF2_MACRO_H */
|
#endif /* GDB_DWARF2_MACRO_H */
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ struct dw2_symtab_iterator
|
|||||||
dwarf2_per_objfile *per_objfile;
|
dwarf2_per_objfile *per_objfile;
|
||||||
/* If set, only look for symbols that match that block. Valid values are
|
/* If set, only look for symbols that match that block. Valid values are
|
||||||
GLOBAL_BLOCK and STATIC_BLOCK. */
|
GLOBAL_BLOCK and STATIC_BLOCK. */
|
||||||
gdb::optional<block_enum> block_index;
|
std::optional<block_enum> block_index;
|
||||||
/* The kind of symbol we're looking for. */
|
/* The kind of symbol we're looking for. */
|
||||||
domain_enum domain;
|
domain_enum domain;
|
||||||
/* The list of CUs from the index entry of the symbol,
|
/* The list of CUs from the index entry of the symbol,
|
||||||
@@ -204,7 +204,7 @@ struct dw2_symtab_iterator
|
|||||||
static void
|
static void
|
||||||
dw2_symtab_iter_init (struct dw2_symtab_iterator *iter,
|
dw2_symtab_iter_init (struct dw2_symtab_iterator *iter,
|
||||||
dwarf2_per_objfile *per_objfile,
|
dwarf2_per_objfile *per_objfile,
|
||||||
gdb::optional<block_enum> block_index,
|
std::optional<block_enum> block_index,
|
||||||
domain_enum domain, offset_type namei,
|
domain_enum domain, offset_type namei,
|
||||||
mapped_gdb_index &index)
|
mapped_gdb_index &index)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -77,7 +77,7 @@
|
|||||||
#include "build-id.h"
|
#include "build-id.h"
|
||||||
#include "namespace.h"
|
#include "namespace.h"
|
||||||
#include "gdbsupport/function-view.h"
|
#include "gdbsupport/function-view.h"
|
||||||
#include "gdbsupport/gdb_optional.h"
|
#include <optional>
|
||||||
#include "gdbsupport/underlying.h"
|
#include "gdbsupport/underlying.h"
|
||||||
#include "gdbsupport/hash_enum.h"
|
#include "gdbsupport/hash_enum.h"
|
||||||
#include "filename-seen-cache.h"
|
#include "filename-seen-cache.h"
|
||||||
@@ -4080,7 +4080,7 @@ read_cutu_die_from_dwo (dwarf2_cu *cu,
|
|||||||
/* Return the signature of the compile unit, if found. In DWARF 4 and before,
|
/* Return the signature of the compile unit, if found. In DWARF 4 and before,
|
||||||
the signature is in the DW_AT_GNU_dwo_id attribute. In DWARF 5 and later, the
|
the signature is in the DW_AT_GNU_dwo_id attribute. In DWARF 5 and later, the
|
||||||
signature is part of the header. */
|
signature is part of the header. */
|
||||||
static gdb::optional<ULONGEST>
|
static std::optional<ULONGEST>
|
||||||
lookup_dwo_id (struct dwarf2_cu *cu, struct die_info* comp_unit_die)
|
lookup_dwo_id (struct dwarf2_cu *cu, struct die_info* comp_unit_die)
|
||||||
{
|
{
|
||||||
if (cu->header.version >= 5)
|
if (cu->header.version >= 5)
|
||||||
@@ -4088,7 +4088,7 @@ lookup_dwo_id (struct dwarf2_cu *cu, struct die_info* comp_unit_die)
|
|||||||
struct attribute *attr;
|
struct attribute *attr;
|
||||||
attr = dwarf2_attr (comp_unit_die, DW_AT_GNU_dwo_id, cu);
|
attr = dwarf2_attr (comp_unit_die, DW_AT_GNU_dwo_id, cu);
|
||||||
if (attr == nullptr || !attr->form_is_unsigned ())
|
if (attr == nullptr || !attr->form_is_unsigned ())
|
||||||
return gdb::optional<ULONGEST> ();
|
return std::optional<ULONGEST> ();
|
||||||
return attr->as_unsigned ();
|
return attr->as_unsigned ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4121,7 +4121,7 @@ lookup_dwo_unit (dwarf2_cu *cu, die_info *comp_unit_die, const char *dwo_name)
|
|||||||
dwo_unit = lookup_dwo_type_unit (cu, dwo_name, comp_dir);
|
dwo_unit = lookup_dwo_type_unit (cu, dwo_name, comp_dir);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gdb::optional<ULONGEST> signature = lookup_dwo_id (cu, comp_unit_die);
|
std::optional<ULONGEST> signature = lookup_dwo_id (cu, comp_unit_die);
|
||||||
|
|
||||||
if (!signature.has_value ())
|
if (!signature.has_value ())
|
||||||
error (_("Dwarf Error: missing dwo_id for dwo_name %s"
|
error (_("Dwarf Error: missing dwo_id for dwo_name %s"
|
||||||
@@ -7981,7 +7981,7 @@ create_dwo_cu_reader (const struct die_reader_specs *reader,
|
|||||||
sect_offset sect_off = cu->per_cu->sect_off;
|
sect_offset sect_off = cu->per_cu->sect_off;
|
||||||
struct dwarf2_section_info *section = cu->per_cu->section;
|
struct dwarf2_section_info *section = cu->per_cu->section;
|
||||||
|
|
||||||
gdb::optional<ULONGEST> signature = lookup_dwo_id (cu, comp_unit_die);
|
std::optional<ULONGEST> signature = lookup_dwo_id (cu, comp_unit_die);
|
||||||
if (!signature.has_value ())
|
if (!signature.has_value ())
|
||||||
{
|
{
|
||||||
complaint (_("Dwarf Error: debug entry at offset %s is missing"
|
complaint (_("Dwarf Error: debug entry at offset %s is missing"
|
||||||
@@ -10785,7 +10785,7 @@ dwarf2_rnglists_process (unsigned offset, struct dwarf2_cu *cu,
|
|||||||
struct objfile *objfile = per_objfile->objfile;
|
struct objfile *objfile = per_objfile->objfile;
|
||||||
bfd *obfd = objfile->obfd.get ();
|
bfd *obfd = objfile->obfd.get ();
|
||||||
/* Base address selection entry. */
|
/* Base address selection entry. */
|
||||||
gdb::optional<unrelocated_addr> base;
|
std::optional<unrelocated_addr> base;
|
||||||
const gdb_byte *buffer;
|
const gdb_byte *buffer;
|
||||||
bool overflow = false;
|
bool overflow = false;
|
||||||
ULONGEST addr_index;
|
ULONGEST addr_index;
|
||||||
@@ -10991,7 +10991,7 @@ dwarf2_ranges_process (unsigned offset, struct dwarf2_cu *cu, dwarf_tag tag,
|
|||||||
unsigned int addr_size = cu_header->addr_size;
|
unsigned int addr_size = cu_header->addr_size;
|
||||||
CORE_ADDR mask = ~(~(CORE_ADDR)1 << (addr_size * 8 - 1));
|
CORE_ADDR mask = ~(~(CORE_ADDR)1 << (addr_size * 8 - 1));
|
||||||
/* Base address selection entry. */
|
/* Base address selection entry. */
|
||||||
gdb::optional<unrelocated_addr> base;
|
std::optional<unrelocated_addr> base;
|
||||||
unsigned int dummy;
|
unsigned int dummy;
|
||||||
const gdb_byte *buffer;
|
const gdb_byte *buffer;
|
||||||
|
|
||||||
@@ -16187,8 +16187,8 @@ cooked_indexer::scan_attributes (dwarf2_per_cu_data *scanning_per_cu,
|
|||||||
bool is_declaration = false;
|
bool is_declaration = false;
|
||||||
sect_offset origin_offset {};
|
sect_offset origin_offset {};
|
||||||
|
|
||||||
gdb::optional<unrelocated_addr> low_pc;
|
std::optional<unrelocated_addr> low_pc;
|
||||||
gdb::optional<unrelocated_addr> high_pc;
|
std::optional<unrelocated_addr> high_pc;
|
||||||
bool high_pc_relative = false;
|
bool high_pc_relative = false;
|
||||||
|
|
||||||
for (int i = 0; i < abbrev->num_attrs; ++i)
|
for (int i = 0; i < abbrev->num_attrs; ++i)
|
||||||
@@ -17565,7 +17565,7 @@ dwarf2_per_objfile::read_line_string (const gdb_byte *buf,
|
|||||||
|
|
||||||
static unrelocated_addr
|
static unrelocated_addr
|
||||||
read_addr_index_1 (dwarf2_per_objfile *per_objfile, unsigned int addr_index,
|
read_addr_index_1 (dwarf2_per_objfile *per_objfile, unsigned int addr_index,
|
||||||
gdb::optional<ULONGEST> addr_base, int addr_size)
|
std::optional<ULONGEST> addr_base, int addr_size)
|
||||||
{
|
{
|
||||||
struct objfile *objfile = per_objfile->objfile;
|
struct objfile *objfile = per_objfile->objfile;
|
||||||
bfd *abfd = objfile->obfd.get ();
|
bfd *abfd = objfile->obfd.get ();
|
||||||
@@ -17618,7 +17618,7 @@ dwarf2_read_addr_index (dwarf2_per_cu_data *per_cu,
|
|||||||
unsigned int addr_index)
|
unsigned int addr_index)
|
||||||
{
|
{
|
||||||
struct dwarf2_cu *cu = per_objfile->get_cu (per_cu);
|
struct dwarf2_cu *cu = per_objfile->get_cu (per_cu);
|
||||||
gdb::optional<ULONGEST> addr_base;
|
std::optional<ULONGEST> addr_base;
|
||||||
int addr_size;
|
int addr_size;
|
||||||
|
|
||||||
/* We need addr_base and addr_size.
|
/* We need addr_base and addr_size.
|
||||||
@@ -21389,7 +21389,7 @@ dwarf_decode_macros (struct dwarf2_cu *cu, unsigned int offset,
|
|||||||
|
|
||||||
struct dwarf2_section_info *str_offsets_section;
|
struct dwarf2_section_info *str_offsets_section;
|
||||||
struct dwarf2_section_info *str_section;
|
struct dwarf2_section_info *str_section;
|
||||||
gdb::optional<ULONGEST> str_offsets_base;
|
std::optional<ULONGEST> str_offsets_base;
|
||||||
|
|
||||||
if (cu->dwo_unit != nullptr)
|
if (cu->dwo_unit != nullptr)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -747,7 +747,7 @@ struct dwarf2_per_objfile
|
|||||||
dwarf2_cu *sym_cu = nullptr;
|
dwarf2_cu *sym_cu = nullptr;
|
||||||
|
|
||||||
/* CUs that are queued to be read. */
|
/* CUs that are queued to be read. */
|
||||||
gdb::optional<std::queue<dwarf2_queue_item>> queue;
|
std::optional<std::queue<dwarf2_queue_item>> queue;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/* Hold the corresponding compunit_symtab for each CU or TU. This
|
/* Hold the corresponding compunit_symtab for each CU or TU. This
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ expression::uses_objfile (struct objfile *objfile) const
|
|||||||
struct value *
|
struct value *
|
||||||
expression::evaluate (struct type *expect_type, enum noside noside)
|
expression::evaluate (struct type *expect_type, enum noside noside)
|
||||||
{
|
{
|
||||||
gdb::optional<enable_thread_stack_temporaries> stack_temporaries;
|
std::optional<enable_thread_stack_temporaries> stack_temporaries;
|
||||||
if (target_has_execution () && inferior_ptid != null_ptid
|
if (target_has_execution () && inferior_ptid != null_ptid
|
||||||
&& language_defn->la_language == language_cplus
|
&& language_defn->la_language == language_cplus
|
||||||
&& !thread_stack_temporaries_enabled_p (inferior_thread ()))
|
&& !thread_stack_temporaries_enabled_p (inferior_thread ()))
|
||||||
|
|||||||
@@ -692,7 +692,7 @@ void
|
|||||||
gdb_rl_deprep_term_function (void)
|
gdb_rl_deprep_term_function (void)
|
||||||
{
|
{
|
||||||
#ifdef RL_STATE_EOF
|
#ifdef RL_STATE_EOF
|
||||||
gdb::optional<scoped_restore_tmpl<int>> restore_eof_found;
|
std::optional<scoped_restore_tmpl<int>> restore_eof_found;
|
||||||
|
|
||||||
if (RL_ISSTATE (RL_STATE_EOF))
|
if (RL_ISSTATE (RL_STATE_EOF))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
#include "serial.h"
|
#include "serial.h"
|
||||||
#include "gdbthread.h"
|
#include "gdbthread.h"
|
||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
#include "gdbsupport/gdb_optional.h"
|
#include <optional>
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_flush (void)
|
print_flush (void)
|
||||||
@@ -38,7 +38,7 @@ print_flush (void)
|
|||||||
if (deprecated_error_begin_hook)
|
if (deprecated_error_begin_hook)
|
||||||
deprecated_error_begin_hook ();
|
deprecated_error_begin_hook ();
|
||||||
|
|
||||||
gdb::optional<target_terminal::scoped_restore_terminal_state> term_state;
|
std::optional<target_terminal::scoped_restore_terminal_state> term_state;
|
||||||
if (target_supports_terminal_ours ())
|
if (target_supports_terminal_ours ())
|
||||||
{
|
{
|
||||||
term_state.emplace ();
|
term_state.emplace ();
|
||||||
|
|||||||
@@ -256,13 +256,13 @@ struct extension_language_ops
|
|||||||
CONTENTS is the contents of the file. This should either return
|
CONTENTS is the contents of the file. This should either return
|
||||||
colorized (using ANSI terminal escapes) version of the contents,
|
colorized (using ANSI terminal escapes) version of the contents,
|
||||||
or an empty option. */
|
or an empty option. */
|
||||||
gdb::optional<std::string> (*colorize) (const std::string &name,
|
std::optional<std::string> (*colorize) (const std::string &name,
|
||||||
const std::string &contents);
|
const std::string &contents);
|
||||||
|
|
||||||
/* Colorize a single line of disassembler output, CONTENT. This should
|
/* Colorize a single line of disassembler output, CONTENT. This should
|
||||||
either return colorized (using ANSI terminal escapes) version of the
|
either return colorized (using ANSI terminal escapes) version of the
|
||||||
contents, or an empty optional. */
|
contents, or an empty optional. */
|
||||||
gdb::optional<std::string> (*colorize_disasm) (const std::string &content,
|
std::optional<std::string> (*colorize_disasm) (const std::string &content,
|
||||||
gdbarch *gdbarch);
|
gdbarch *gdbarch);
|
||||||
|
|
||||||
/* Print a single instruction from ADDRESS in architecture GDBARCH. INFO
|
/* Print a single instruction from ADDRESS in architecture GDBARCH. INFO
|
||||||
@@ -276,7 +276,7 @@ struct extension_language_ops
|
|||||||
If no instruction can be disassembled then return an empty value and
|
If no instruction can be disassembled then return an empty value and
|
||||||
other extension languages will get a chance to perform the
|
other extension languages will get a chance to perform the
|
||||||
disassembly. */
|
disassembly. */
|
||||||
gdb::optional<int> (*print_insn) (struct gdbarch *gdbarch,
|
std::optional<int> (*print_insn) (struct gdbarch *gdbarch,
|
||||||
CORE_ADDR address,
|
CORE_ADDR address,
|
||||||
struct disassemble_info *info);
|
struct disassemble_info *info);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -939,10 +939,10 @@ xmethod_worker::get_result_type (value *object, gdb::array_view<value *> args)
|
|||||||
|
|
||||||
/* See extension.h. */
|
/* See extension.h. */
|
||||||
|
|
||||||
gdb::optional<std::string>
|
std::optional<std::string>
|
||||||
ext_lang_colorize (const std::string &filename, const std::string &contents)
|
ext_lang_colorize (const std::string &filename, const std::string &contents)
|
||||||
{
|
{
|
||||||
gdb::optional<std::string> result;
|
std::optional<std::string> result;
|
||||||
|
|
||||||
for (const struct extension_language_defn *extlang : extension_languages)
|
for (const struct extension_language_defn *extlang : extension_languages)
|
||||||
{
|
{
|
||||||
@@ -959,10 +959,10 @@ ext_lang_colorize (const std::string &filename, const std::string &contents)
|
|||||||
|
|
||||||
/* See extension.h. */
|
/* See extension.h. */
|
||||||
|
|
||||||
gdb::optional<std::string>
|
std::optional<std::string>
|
||||||
ext_lang_colorize_disasm (const std::string &content, gdbarch *gdbarch)
|
ext_lang_colorize_disasm (const std::string &content, gdbarch *gdbarch)
|
||||||
{
|
{
|
||||||
gdb::optional<std::string> result;
|
std::optional<std::string> result;
|
||||||
|
|
||||||
for (const struct extension_language_defn *extlang : extension_languages)
|
for (const struct extension_language_defn *extlang : extension_languages)
|
||||||
{
|
{
|
||||||
@@ -979,7 +979,7 @@ ext_lang_colorize_disasm (const std::string &content, gdbarch *gdbarch)
|
|||||||
|
|
||||||
/* See extension.h. */
|
/* See extension.h. */
|
||||||
|
|
||||||
gdb::optional<int>
|
std::optional<int>
|
||||||
ext_lang_print_insn (struct gdbarch *gdbarch, CORE_ADDR address,
|
ext_lang_print_insn (struct gdbarch *gdbarch, CORE_ADDR address,
|
||||||
struct disassemble_info *info)
|
struct disassemble_info *info)
|
||||||
{
|
{
|
||||||
@@ -988,7 +988,7 @@ ext_lang_print_insn (struct gdbarch *gdbarch, CORE_ADDR address,
|
|||||||
if (extlang->ops == nullptr
|
if (extlang->ops == nullptr
|
||||||
|| extlang->ops->print_insn == nullptr)
|
|| extlang->ops->print_insn == nullptr)
|
||||||
continue;
|
continue;
|
||||||
gdb::optional<int> length
|
std::optional<int> length
|
||||||
= extlang->ops->print_insn (gdbarch, address, info);
|
= extlang->ops->print_insn (gdbarch, address, info);
|
||||||
if (length.has_value ())
|
if (length.has_value ())
|
||||||
return length;
|
return length;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "mi/mi-cmds.h"
|
#include "mi/mi-cmds.h"
|
||||||
#include "gdbsupport/array-view.h"
|
#include "gdbsupport/array-view.h"
|
||||||
#include "gdbsupport/gdb_optional.h"
|
#include <optional>
|
||||||
|
|
||||||
struct breakpoint;
|
struct breakpoint;
|
||||||
struct command_line;
|
struct command_line;
|
||||||
@@ -316,7 +316,7 @@ extern void get_matching_xmethod_workers
|
|||||||
either a colorized (using ANSI terminal escapes) version of the
|
either a colorized (using ANSI terminal escapes) version of the
|
||||||
source code, or an empty value if colorizing could not be done. */
|
source code, or an empty value if colorizing could not be done. */
|
||||||
|
|
||||||
extern gdb::optional<std::string> ext_lang_colorize
|
extern std::optional<std::string> ext_lang_colorize
|
||||||
(const std::string &filename, const std::string &contents);
|
(const std::string &filename, const std::string &contents);
|
||||||
|
|
||||||
/* Try to colorize a single line of disassembler output, CONTENT for
|
/* Try to colorize a single line of disassembler output, CONTENT for
|
||||||
@@ -324,7 +324,7 @@ extern gdb::optional<std::string> ext_lang_colorize
|
|||||||
escapes) version of CONTENT, or an empty value if colorizing could not
|
escapes) version of CONTENT, or an empty value if colorizing could not
|
||||||
be done. */
|
be done. */
|
||||||
|
|
||||||
extern gdb::optional<std::string> ext_lang_colorize_disasm
|
extern std::optional<std::string> ext_lang_colorize_disasm
|
||||||
(const std::string &content, gdbarch *gdbarch);
|
(const std::string &content, gdbarch *gdbarch);
|
||||||
|
|
||||||
/* Calls extension_language_ops::print_insn for each extension language,
|
/* Calls extension_language_ops::print_insn for each extension language,
|
||||||
@@ -334,7 +334,7 @@ extern gdb::optional<std::string> ext_lang_colorize_disasm
|
|||||||
All arguments are forwarded to extension_language_ops::print_insn, see
|
All arguments are forwarded to extension_language_ops::print_insn, see
|
||||||
that function for a full description. */
|
that function for a full description. */
|
||||||
|
|
||||||
extern gdb::optional<int> ext_lang_print_insn
|
extern std::optional<int> ext_lang_print_insn
|
||||||
(struct gdbarch *gdbarch, CORE_ADDR address, struct disassemble_info *info);
|
(struct gdbarch *gdbarch, CORE_ADDR address, struct disassemble_info *info);
|
||||||
|
|
||||||
#if GDB_SELF_TEST
|
#if GDB_SELF_TEST
|
||||||
|
|||||||
@@ -306,7 +306,7 @@ protected:
|
|||||||
|
|
||||||
/* Set and reset to handle removing intermediate values from the
|
/* Set and reset to handle removing intermediate values from the
|
||||||
value chain. */
|
value chain. */
|
||||||
gdb::optional<scoped_value_mark> m_mark;
|
std::optional<scoped_value_mark> m_mark;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* A class used by FORTRAN_VALUE_SUBARRAY when repacking Fortran array
|
/* A class used by FORTRAN_VALUE_SUBARRAY when repacking Fortran array
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ fbsd_nat_target::have_pending_event (ptid_t filter)
|
|||||||
|
|
||||||
/* See fbsd-nat.h. */
|
/* See fbsd-nat.h. */
|
||||||
|
|
||||||
gdb::optional<fbsd_nat_target::pending_event>
|
std::optional<fbsd_nat_target::pending_event>
|
||||||
fbsd_nat_target::take_pending_event (ptid_t filter)
|
fbsd_nat_target::take_pending_event (ptid_t filter)
|
||||||
{
|
{
|
||||||
for (auto it = m_pending_events.begin (); it != m_pending_events.end (); it++)
|
for (auto it = m_pending_events.begin (); it != m_pending_events.end (); it++)
|
||||||
@@ -1663,7 +1663,7 @@ fbsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
|
|||||||
target_options_to_string (target_options).c_str ());
|
target_options_to_string (target_options).c_str ());
|
||||||
|
|
||||||
/* If there is a valid pending event, return it. */
|
/* If there is a valid pending event, return it. */
|
||||||
gdb::optional<pending_event> event = take_pending_event (ptid);
|
std::optional<pending_event> event = take_pending_event (ptid);
|
||||||
if (event.has_value ())
|
if (event.has_value ())
|
||||||
{
|
{
|
||||||
/* Stop any other inferiors currently running. */
|
/* Stop any other inferiors currently running. */
|
||||||
@@ -1899,7 +1899,7 @@ fbsd_nat_target::detach_fork_children (inferior *inf)
|
|||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
gdb::optional<pending_event> event = take_pending_event (ptid);
|
std::optional<pending_event> event = take_pending_event (ptid);
|
||||||
if (!event.has_value ())
|
if (!event.has_value ())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
#ifndef FBSD_NAT_H
|
#ifndef FBSD_NAT_H
|
||||||
#define FBSD_NAT_H
|
#define FBSD_NAT_H
|
||||||
|
|
||||||
#include "gdbsupport/gdb_optional.h"
|
#include <optional>
|
||||||
#include "inf-ptrace.h"
|
#include "inf-ptrace.h"
|
||||||
#include "regcache.h"
|
#include "regcache.h"
|
||||||
#include "regset.h"
|
#include "regset.h"
|
||||||
@@ -262,7 +262,7 @@ private:
|
|||||||
FILTER. If there is a matching event, the event is removed from
|
FILTER. If there is a matching event, the event is removed from
|
||||||
the pending list and returned. */
|
the pending list and returned. */
|
||||||
|
|
||||||
gdb::optional<pending_event> take_pending_event (ptid_t filter);
|
std::optional<pending_event> take_pending_event (ptid_t filter);
|
||||||
|
|
||||||
/* List of pending events. */
|
/* List of pending events. */
|
||||||
|
|
||||||
|
|||||||
@@ -650,10 +650,10 @@ find_signalled_thread (struct thread_info *info, void *data)
|
|||||||
the data is prefixed with a 32-bit integer size to match the format
|
the data is prefixed with a 32-bit integer size to match the format
|
||||||
used in FreeBSD NT_PROCSTAT_* notes. */
|
used in FreeBSD NT_PROCSTAT_* notes. */
|
||||||
|
|
||||||
static gdb::optional<gdb::byte_vector>
|
static std::optional<gdb::byte_vector>
|
||||||
fbsd_make_note_desc (enum target_object object, uint32_t structsize)
|
fbsd_make_note_desc (enum target_object object, uint32_t structsize)
|
||||||
{
|
{
|
||||||
gdb::optional<gdb::byte_vector> buf =
|
std::optional<gdb::byte_vector> buf =
|
||||||
target_read_alloc (current_inferior ()->top_target (), object, NULL);
|
target_read_alloc (current_inferior ()->top_target (), object, NULL);
|
||||||
if (!buf || buf->empty ())
|
if (!buf || buf->empty ())
|
||||||
return {};
|
return {};
|
||||||
@@ -735,7 +735,7 @@ fbsd_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
|
|||||||
|
|
||||||
/* Auxiliary vector. */
|
/* Auxiliary vector. */
|
||||||
uint32_t structsize = gdbarch_ptr_bit (gdbarch) / 4; /* Elf_Auxinfo */
|
uint32_t structsize = gdbarch_ptr_bit (gdbarch) / 4; /* Elf_Auxinfo */
|
||||||
gdb::optional<gdb::byte_vector> note_desc =
|
std::optional<gdb::byte_vector> note_desc =
|
||||||
fbsd_make_note_desc (TARGET_OBJECT_AUXV, structsize);
|
fbsd_make_note_desc (TARGET_OBJECT_AUXV, structsize);
|
||||||
if (note_desc && !note_desc->empty ())
|
if (note_desc && !note_desc->empty ())
|
||||||
{
|
{
|
||||||
@@ -2340,7 +2340,7 @@ fbsd_vdso_range (struct gdbarch *gdbarch, struct mem_range *range)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Fetch the list of address space entries from the running target. */
|
/* Fetch the list of address space entries from the running target. */
|
||||||
gdb::optional<gdb::byte_vector> buf =
|
std::optional<gdb::byte_vector> buf =
|
||||||
target_read_alloc (current_inferior ()->top_target (),
|
target_read_alloc (current_inferior ()->top_target (),
|
||||||
TARGET_OBJECT_FREEBSD_VMMAP, nullptr);
|
TARGET_OBJECT_FREEBSD_VMMAP, nullptr);
|
||||||
if (!buf || buf->empty ())
|
if (!buf || buf->empty ())
|
||||||
|
|||||||
@@ -210,10 +210,10 @@ struct thread_suspend_state
|
|||||||
|
|
||||||
- If the thread is running, then this field has its value removed by
|
- If the thread is running, then this field has its value removed by
|
||||||
calling stop_pc.reset() (see thread_info::set_executing()).
|
calling stop_pc.reset() (see thread_info::set_executing()).
|
||||||
Attempting to read a gdb::optional with no value is undefined
|
Attempting to read a std::optional with no value is undefined
|
||||||
behaviour and will trigger an assertion error when _GLIBCXX_DEBUG is
|
behaviour and will trigger an assertion error when _GLIBCXX_DEBUG is
|
||||||
defined, which should make error easier to track down. */
|
defined, which should make error easier to track down. */
|
||||||
gdb::optional<CORE_ADDR> stop_pc;
|
std::optional<CORE_ADDR> stop_pc;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Base class for target-specific thread data. */
|
/* Base class for target-specific thread data. */
|
||||||
@@ -645,7 +645,7 @@ extern void delete_thread_silent (struct thread_info *thread);
|
|||||||
available. If SILENT, then don't inform the CLI about the
|
available. If SILENT, then don't inform the CLI about the
|
||||||
exit. */
|
exit. */
|
||||||
extern void set_thread_exited (thread_info *tp,
|
extern void set_thread_exited (thread_info *tp,
|
||||||
gdb::optional<ULONGEST> exit_code = {},
|
std::optional<ULONGEST> exit_code = {},
|
||||||
bool silent = false);
|
bool silent = false);
|
||||||
|
|
||||||
/* Delete a step_resume_breakpoint from the thread database. */
|
/* Delete a step_resume_breakpoint from the thread database. */
|
||||||
@@ -1042,7 +1042,7 @@ extern bool switch_to_thread_if_alive (thread_info *thr);
|
|||||||
exception if !FLAGS.SILENT and !FLAGS.CONT and CMD fails. */
|
exception if !FLAGS.SILENT and !FLAGS.CONT and CMD fails. */
|
||||||
|
|
||||||
extern void thread_try_catch_cmd (thread_info *thr,
|
extern void thread_try_catch_cmd (thread_info *thr,
|
||||||
gdb::optional<int> ada_task,
|
std::optional<int> ada_task,
|
||||||
const char *cmd, int from_tty,
|
const char *cmd, int from_tty,
|
||||||
const qcs_flags &flags);
|
const qcs_flags &flags);
|
||||||
|
|
||||||
|
|||||||
@@ -1046,7 +1046,7 @@ has_static_range (const struct range_bounds *bounds)
|
|||||||
|
|
||||||
/* See gdbtypes.h. */
|
/* See gdbtypes.h. */
|
||||||
|
|
||||||
gdb::optional<LONGEST>
|
std::optional<LONGEST>
|
||||||
get_discrete_low_bound (struct type *type)
|
get_discrete_low_bound (struct type *type)
|
||||||
{
|
{
|
||||||
type = check_typedef (type);
|
type = check_typedef (type);
|
||||||
@@ -1062,7 +1062,7 @@ get_discrete_low_bound (struct type *type)
|
|||||||
|
|
||||||
if (type->target_type ()->code () == TYPE_CODE_ENUM)
|
if (type->target_type ()->code () == TYPE_CODE_ENUM)
|
||||||
{
|
{
|
||||||
gdb::optional<LONGEST> low_pos
|
std::optional<LONGEST> low_pos
|
||||||
= discrete_position (type->target_type (), low);
|
= discrete_position (type->target_type (), low);
|
||||||
|
|
||||||
if (low_pos.has_value ())
|
if (low_pos.has_value ())
|
||||||
@@ -1113,7 +1113,7 @@ get_discrete_low_bound (struct type *type)
|
|||||||
|
|
||||||
/* See gdbtypes.h. */
|
/* See gdbtypes.h. */
|
||||||
|
|
||||||
gdb::optional<LONGEST>
|
std::optional<LONGEST>
|
||||||
get_discrete_high_bound (struct type *type)
|
get_discrete_high_bound (struct type *type)
|
||||||
{
|
{
|
||||||
type = check_typedef (type);
|
type = check_typedef (type);
|
||||||
@@ -1129,7 +1129,7 @@ get_discrete_high_bound (struct type *type)
|
|||||||
|
|
||||||
if (type->target_type ()->code () == TYPE_CODE_ENUM)
|
if (type->target_type ()->code () == TYPE_CODE_ENUM)
|
||||||
{
|
{
|
||||||
gdb::optional<LONGEST> high_pos
|
std::optional<LONGEST> high_pos
|
||||||
= discrete_position (type->target_type (), high);
|
= discrete_position (type->target_type (), high);
|
||||||
|
|
||||||
if (high_pos.has_value ())
|
if (high_pos.has_value ())
|
||||||
@@ -1192,11 +1192,11 @@ get_discrete_high_bound (struct type *type)
|
|||||||
bool
|
bool
|
||||||
get_discrete_bounds (struct type *type, LONGEST *lowp, LONGEST *highp)
|
get_discrete_bounds (struct type *type, LONGEST *lowp, LONGEST *highp)
|
||||||
{
|
{
|
||||||
gdb::optional<LONGEST> low = get_discrete_low_bound (type);
|
std::optional<LONGEST> low = get_discrete_low_bound (type);
|
||||||
if (!low.has_value ())
|
if (!low.has_value ())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
gdb::optional<LONGEST> high = get_discrete_high_bound (type);
|
std::optional<LONGEST> high = get_discrete_high_bound (type);
|
||||||
if (!high.has_value ())
|
if (!high.has_value ())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -1244,7 +1244,7 @@ get_array_bounds (struct type *type, LONGEST *low_bound, LONGEST *high_bound)
|
|||||||
in which case the value of POS is unmodified.
|
in which case the value of POS is unmodified.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
gdb::optional<LONGEST>
|
std::optional<LONGEST>
|
||||||
discrete_position (struct type *type, LONGEST val)
|
discrete_position (struct type *type, LONGEST val)
|
||||||
{
|
{
|
||||||
if (type->code () == TYPE_CODE_RANGE)
|
if (type->code () == TYPE_CODE_RANGE)
|
||||||
@@ -2535,7 +2535,7 @@ compute_variant_fields_inner (struct type *type,
|
|||||||
std::vector<bool> &flags)
|
std::vector<bool> &flags)
|
||||||
{
|
{
|
||||||
/* Evaluate the discriminant. */
|
/* Evaluate the discriminant. */
|
||||||
gdb::optional<ULONGEST> discr_value;
|
std::optional<ULONGEST> discr_value;
|
||||||
if (part.discriminant_index != -1)
|
if (part.discriminant_index != -1)
|
||||||
{
|
{
|
||||||
int idx = part.discriminant_index;
|
int idx = part.discriminant_index;
|
||||||
@@ -2758,7 +2758,7 @@ resolve_dynamic_type_internal (struct type *type,
|
|||||||
if (!is_dynamic_type_internal (real_type, top_level))
|
if (!is_dynamic_type_internal (real_type, top_level))
|
||||||
return type;
|
return type;
|
||||||
|
|
||||||
gdb::optional<CORE_ADDR> type_length;
|
std::optional<CORE_ADDR> type_length;
|
||||||
prop = TYPE_DYNAMIC_LENGTH (type);
|
prop = TYPE_DYNAMIC_LENGTH (type);
|
||||||
if (prop != NULL
|
if (prop != NULL
|
||||||
&& dwarf2_evaluate_property (prop, frame, addr_stack, &value))
|
&& dwarf2_evaluate_property (prop, frame, addr_stack, &value))
|
||||||
|
|||||||
@@ -47,7 +47,7 @@
|
|||||||
#include "hashtab.h"
|
#include "hashtab.h"
|
||||||
#include "gdbsupport/array-view.h"
|
#include "gdbsupport/array-view.h"
|
||||||
#include "gdbsupport/gdb-hashtab.h"
|
#include "gdbsupport/gdb-hashtab.h"
|
||||||
#include "gdbsupport/gdb_optional.h"
|
#include <optional>
|
||||||
#include "gdbsupport/offset-type.h"
|
#include "gdbsupport/offset-type.h"
|
||||||
#include "gdbsupport/enum-flags.h"
|
#include "gdbsupport/enum-flags.h"
|
||||||
#include "gdbsupport/underlying.h"
|
#include "gdbsupport/underlying.h"
|
||||||
@@ -2663,11 +2663,11 @@ extern bool get_discrete_bounds (struct type *type, LONGEST *lowp,
|
|||||||
|
|
||||||
/* If TYPE's low bound is a known constant, return it, else return nullopt. */
|
/* If TYPE's low bound is a known constant, return it, else return nullopt. */
|
||||||
|
|
||||||
extern gdb::optional<LONGEST> get_discrete_low_bound (struct type *type);
|
extern std::optional<LONGEST> get_discrete_low_bound (struct type *type);
|
||||||
|
|
||||||
/* If TYPE's high bound is a known constant, return it, else return nullopt. */
|
/* If TYPE's high bound is a known constant, return it, else return nullopt. */
|
||||||
|
|
||||||
extern gdb::optional<LONGEST> get_discrete_high_bound (struct type *type);
|
extern std::optional<LONGEST> get_discrete_high_bound (struct type *type);
|
||||||
|
|
||||||
/* Assuming TYPE is a simple, non-empty array type, compute its upper
|
/* Assuming TYPE is a simple, non-empty array type, compute its upper
|
||||||
and lower bound. Save the low bound into LOW_BOUND if not NULL.
|
and lower bound. Save the low bound into LOW_BOUND if not NULL.
|
||||||
@@ -2679,7 +2679,7 @@ extern gdb::optional<LONGEST> get_discrete_high_bound (struct type *type);
|
|||||||
extern bool get_array_bounds (struct type *type, LONGEST *low_bound,
|
extern bool get_array_bounds (struct type *type, LONGEST *low_bound,
|
||||||
LONGEST *high_bound);
|
LONGEST *high_bound);
|
||||||
|
|
||||||
extern gdb::optional<LONGEST> discrete_position (struct type *type,
|
extern std::optional<LONGEST> discrete_position (struct type *type,
|
||||||
LONGEST val);
|
LONGEST val);
|
||||||
|
|
||||||
extern int class_types_same_p (const struct type *, const struct type *);
|
extern int class_types_same_p (const struct type *, const struct type *);
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
#include "target.h"
|
#include "target.h"
|
||||||
#include "guile-internal.h"
|
#include "guile-internal.h"
|
||||||
#include "gdbsupport/gdb_optional.h"
|
#include <optional>
|
||||||
|
|
||||||
#ifdef HAVE_POLL
|
#ifdef HAVE_POLL
|
||||||
#if defined (HAVE_POLL_H)
|
#if defined (HAVE_POLL_H)
|
||||||
@@ -602,7 +602,7 @@ ioscm_with_output_to_port_worker (SCM port, SCM thunk, enum oport oport,
|
|||||||
? &gdb_stderr : &gdb_stdout);
|
? &gdb_stderr : &gdb_stdout);
|
||||||
|
|
||||||
{
|
{
|
||||||
gdb::optional<ui_out_redirect_pop> redirect_popper;
|
std::optional<ui_out_redirect_pop> redirect_popper;
|
||||||
if (oport == GDB_STDERR)
|
if (oport == GDB_STDERR)
|
||||||
gdb_stderr = port_file.get ();
|
gdb_stderr = port_file.get ();
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ struct ia64_table_entry
|
|||||||
};
|
};
|
||||||
|
|
||||||
static struct ia64_table_entry *ktab = NULL;
|
static struct ia64_table_entry *ktab = NULL;
|
||||||
static gdb::optional<gdb::byte_vector> ktab_buf;
|
static std::optional<gdb::byte_vector> ktab_buf;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -2648,7 +2648,7 @@ ia64_access_mem (unw_addr_space_t as,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Call low-level function to access the kernel unwind table. */
|
/* Call low-level function to access the kernel unwind table. */
|
||||||
static gdb::optional<gdb::byte_vector>
|
static std::optional<gdb::byte_vector>
|
||||||
getunwind_table ()
|
getunwind_table ()
|
||||||
{
|
{
|
||||||
/* FIXME drow/2005-09-10: This code used to call
|
/* FIXME drow/2005-09-10: This code used to call
|
||||||
|
|||||||
@@ -352,7 +352,7 @@ inf_child_target::fileio_unlink (struct inferior *inf, const char *filename,
|
|||||||
|
|
||||||
/* Implementation of to_fileio_readlink. */
|
/* Implementation of to_fileio_readlink. */
|
||||||
|
|
||||||
gdb::optional<std::string>
|
std::optional<std::string>
|
||||||
inf_child_target::fileio_readlink (struct inferior *inf, const char *filename,
|
inf_child_target::fileio_readlink (struct inferior *inf, const char *filename,
|
||||||
fileio_error *target_errno)
|
fileio_error *target_errno)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ public:
|
|||||||
int fileio_unlink (struct inferior *inf,
|
int fileio_unlink (struct inferior *inf,
|
||||||
const char *filename,
|
const char *filename,
|
||||||
fileio_error *target_errno) override;
|
fileio_error *target_errno) override;
|
||||||
gdb::optional<std::string> fileio_readlink (struct inferior *inf,
|
std::optional<std::string> fileio_readlink (struct inferior *inf,
|
||||||
const char *filename,
|
const char *filename,
|
||||||
fileio_error *target_errno) override;
|
fileio_error *target_errno) override;
|
||||||
bool use_agent (bool use) override;
|
bool use_agent (bool use) override;
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
#include "interps.h"
|
#include "interps.h"
|
||||||
#include "skip.h"
|
#include "skip.h"
|
||||||
#include "gdbsupport/gdb_optional.h"
|
#include <optional>
|
||||||
#include "source.h"
|
#include "source.h"
|
||||||
#include "cli/cli-style.h"
|
#include "cli/cli-style.h"
|
||||||
#include "dwarf2/loc.h"
|
#include "dwarf2/loc.h"
|
||||||
@@ -2790,7 +2790,7 @@ notice_new_inferior (thread_info *thr, bool leave_running, int from_tty)
|
|||||||
enum attach_post_wait_mode mode
|
enum attach_post_wait_mode mode
|
||||||
= leave_running ? ATTACH_POST_WAIT_RESUME : ATTACH_POST_WAIT_NOTHING;
|
= leave_running ? ATTACH_POST_WAIT_RESUME : ATTACH_POST_WAIT_NOTHING;
|
||||||
|
|
||||||
gdb::optional<scoped_restore_current_thread> restore_thread;
|
std::optional<scoped_restore_current_thread> restore_thread;
|
||||||
|
|
||||||
if (inferior_ptid != null_ptid)
|
if (inferior_ptid != null_ptid)
|
||||||
restore_thread.emplace ();
|
restore_thread.emplace ();
|
||||||
|
|||||||
@@ -731,10 +731,10 @@ switch_to_inferior_no_thread (inferior *inf)
|
|||||||
|
|
||||||
/* See regcache.h. */
|
/* See regcache.h. */
|
||||||
|
|
||||||
gdb::optional<scoped_restore_current_thread>
|
std::optional<scoped_restore_current_thread>
|
||||||
maybe_switch_inferior (inferior *inf)
|
maybe_switch_inferior (inferior *inf)
|
||||||
{
|
{
|
||||||
gdb::optional<scoped_restore_current_thread> maybe_restore_thread;
|
std::optional<scoped_restore_current_thread> maybe_restore_thread;
|
||||||
if (inf != current_inferior ())
|
if (inf != current_inferior ())
|
||||||
{
|
{
|
||||||
maybe_restore_thread.emplace ();
|
maybe_restore_thread.emplace ();
|
||||||
|
|||||||
@@ -340,7 +340,7 @@ extern void switch_to_inferior_no_thread (inferior *inf);
|
|||||||
|
|
||||||
If the current inferior was changed, return an RAII object that will
|
If the current inferior was changed, return an RAII object that will
|
||||||
restore the original current context. */
|
restore the original current context. */
|
||||||
extern gdb::optional<scoped_restore_current_thread> maybe_switch_inferior
|
extern std::optional<scoped_restore_current_thread> maybe_switch_inferior
|
||||||
(inferior *inf);
|
(inferior *inf);
|
||||||
|
|
||||||
/* Info about an inferior's target description. There's one of these
|
/* Info about an inferior's target description. There's one of these
|
||||||
|
|||||||
@@ -113,9 +113,9 @@ static struct terminal_info *get_inflow_inferior_data (struct inferior *);
|
|||||||
we save our handlers in these two variables and set SIGINT and SIGQUIT
|
we save our handlers in these two variables and set SIGINT and SIGQUIT
|
||||||
to SIG_IGN. */
|
to SIG_IGN. */
|
||||||
|
|
||||||
static gdb::optional<sighandler_t> sigint_ours;
|
static std::optional<sighandler_t> sigint_ours;
|
||||||
#ifdef SIGQUIT
|
#ifdef SIGQUIT
|
||||||
static gdb::optional<sighandler_t> sigquit_ours;
|
static std::optional<sighandler_t> sigquit_ours;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* The name of the tty (from the `tty' command) that we're giving to
|
/* The name of the tty (from the `tty' command) that we're giving to
|
||||||
|
|||||||
12
gdb/infrun.c
12
gdb/infrun.c
@@ -62,7 +62,7 @@
|
|||||||
#include "thread-fsm.h"
|
#include "thread-fsm.h"
|
||||||
#include "gdbsupport/enum-flags.h"
|
#include "gdbsupport/enum-flags.h"
|
||||||
#include "progspace-and-thread.h"
|
#include "progspace-and-thread.h"
|
||||||
#include "gdbsupport/gdb_optional.h"
|
#include <optional>
|
||||||
#include "arch-utils.h"
|
#include "arch-utils.h"
|
||||||
#include "gdbsupport/scope-exit.h"
|
#include "gdbsupport/scope-exit.h"
|
||||||
#include "gdbsupport/forward-scope-exit.h"
|
#include "gdbsupport/forward-scope-exit.h"
|
||||||
@@ -711,7 +711,7 @@ holding the child stopped. Try \"set detach-on-fork\" or \
|
|||||||
{
|
{
|
||||||
/* If FOLLOW_CHILD, we leave CHILD_INF as the current inferior
|
/* If FOLLOW_CHILD, we leave CHILD_INF as the current inferior
|
||||||
(do not restore the parent as the current inferior). */
|
(do not restore the parent as the current inferior). */
|
||||||
gdb::optional<scoped_restore_current_thread> maybe_restore;
|
std::optional<scoped_restore_current_thread> maybe_restore;
|
||||||
|
|
||||||
if (!follow_child && !sched_multi)
|
if (!follow_child && !sched_multi)
|
||||||
maybe_restore.emplace ();
|
maybe_restore.emplace ();
|
||||||
@@ -4399,7 +4399,7 @@ fetch_inferior_event ()
|
|||||||
debugging. If we're looking at traceframes while the target is
|
debugging. If we're looking at traceframes while the target is
|
||||||
running, we're going to need to get back to that mode after
|
running, we're going to need to get back to that mode after
|
||||||
handling the event. */
|
handling the event. */
|
||||||
gdb::optional<scoped_restore_current_traceframe> maybe_restore_traceframe;
|
std::optional<scoped_restore_current_traceframe> maybe_restore_traceframe;
|
||||||
if (non_stop)
|
if (non_stop)
|
||||||
{
|
{
|
||||||
maybe_restore_traceframe.emplace ();
|
maybe_restore_traceframe.emplace ();
|
||||||
@@ -4772,7 +4772,7 @@ adjust_pc_after_break (struct thread_info *thread,
|
|||||||
|| (target_is_non_stop_p ()
|
|| (target_is_non_stop_p ()
|
||||||
&& moribund_breakpoint_here_p (aspace, breakpoint_pc)))
|
&& moribund_breakpoint_here_p (aspace, breakpoint_pc)))
|
||||||
{
|
{
|
||||||
gdb::optional<scoped_restore_tmpl<int>> restore_operation_disable;
|
std::optional<scoped_restore_tmpl<int>> restore_operation_disable;
|
||||||
|
|
||||||
if (record_full_is_used ())
|
if (record_full_is_used ())
|
||||||
restore_operation_disable.emplace
|
restore_operation_disable.emplace
|
||||||
@@ -6722,7 +6722,7 @@ handle_signal_stop (struct execution_control_state *ecs)
|
|||||||
decr_pc = gdbarch_decr_pc_after_break (gdbarch);
|
decr_pc = gdbarch_decr_pc_after_break (gdbarch);
|
||||||
if (decr_pc != 0)
|
if (decr_pc != 0)
|
||||||
{
|
{
|
||||||
gdb::optional<scoped_restore_tmpl<int>>
|
std::optional<scoped_restore_tmpl<int>>
|
||||||
restore_operation_disable;
|
restore_operation_disable;
|
||||||
|
|
||||||
if (record_full_is_used ())
|
if (record_full_is_used ())
|
||||||
@@ -8930,7 +8930,7 @@ normal_stop ()
|
|||||||
else if (last.kind () != TARGET_WAITKIND_NO_RESUMED)
|
else if (last.kind () != TARGET_WAITKIND_NO_RESUMED)
|
||||||
finish_ptid = inferior_ptid;
|
finish_ptid = inferior_ptid;
|
||||||
|
|
||||||
gdb::optional<scoped_finish_thread_state> maybe_finish_thread_state;
|
std::optional<scoped_finish_thread_state> maybe_finish_thread_state;
|
||||||
if (finish_ptid != null_ptid)
|
if (finish_ptid != null_ptid)
|
||||||
{
|
{
|
||||||
maybe_finish_thread_state.emplace
|
maybe_finish_thread_state.emplace
|
||||||
|
|||||||
@@ -430,7 +430,7 @@ interps_notify_new_thread (thread_info *t)
|
|||||||
|
|
||||||
void
|
void
|
||||||
interps_notify_thread_exited (thread_info *t,
|
interps_notify_thread_exited (thread_info *t,
|
||||||
gdb::optional<ULONGEST> exit_code,
|
std::optional<ULONGEST> exit_code,
|
||||||
int silent)
|
int silent)
|
||||||
{
|
{
|
||||||
interps_notify (&interp::on_thread_exited, t, exit_code, silent);
|
interps_notify (&interp::on_thread_exited, t, exit_code, silent);
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ public:
|
|||||||
|
|
||||||
/* Notify the interpreter that thread T has exited. */
|
/* Notify the interpreter that thread T has exited. */
|
||||||
virtual void on_thread_exited (thread_info *,
|
virtual void on_thread_exited (thread_info *,
|
||||||
gdb::optional<ULONGEST> exit_code,
|
std::optional<ULONGEST> exit_code,
|
||||||
int silent) {}
|
int silent) {}
|
||||||
|
|
||||||
/* Notify the interpreter that inferior INF was added. */
|
/* Notify the interpreter that inferior INF was added. */
|
||||||
@@ -292,7 +292,7 @@ extern void interps_notify_new_thread (thread_info *t);
|
|||||||
|
|
||||||
/* Notify all interpreters that thread T has exited. */
|
/* Notify all interpreters that thread T has exited. */
|
||||||
extern void interps_notify_thread_exited (thread_info *t,
|
extern void interps_notify_thread_exited (thread_info *t,
|
||||||
gdb::optional<ULONGEST> exit_code,
|
std::optional<ULONGEST> exit_code,
|
||||||
int silent);
|
int silent);
|
||||||
|
|
||||||
/* Notify all interpreters that inferior INF was added. */
|
/* Notify all interpreters that inferior INF was added. */
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ maint_info_jit_cmd (const char *args, int from_tty)
|
|||||||
inferior *inf = current_inferior ();
|
inferior *inf = current_inferior ();
|
||||||
bool printed_header = false;
|
bool printed_header = false;
|
||||||
|
|
||||||
gdb::optional<ui_out_emit_table> table_emitter;
|
std::optional<ui_out_emit_table> table_emitter;
|
||||||
|
|
||||||
/* Print a line for each JIT-ed objfile. */
|
/* Print a line for each JIT-ed objfile. */
|
||||||
for (objfile *obj : inf->pspace->objfiles ())
|
for (objfile *obj : inf->pspace->objfiles ())
|
||||||
|
|||||||
@@ -4003,7 +4003,7 @@ linux_proc_xfer_memory_partial (int pid, gdb_byte *readbuf,
|
|||||||
static bool
|
static bool
|
||||||
proc_mem_file_is_writable ()
|
proc_mem_file_is_writable ()
|
||||||
{
|
{
|
||||||
static gdb::optional<bool> writable;
|
static std::optional<bool> writable;
|
||||||
|
|
||||||
if (writable.has_value ())
|
if (writable.has_value ())
|
||||||
return *writable;
|
return *writable;
|
||||||
@@ -4424,7 +4424,7 @@ linux_nat_target::fileio_open (struct inferior *inf, const char *filename,
|
|||||||
|
|
||||||
/* Implementation of to_fileio_readlink. */
|
/* Implementation of to_fileio_readlink. */
|
||||||
|
|
||||||
gdb::optional<std::string>
|
std::optional<std::string>
|
||||||
linux_nat_target::fileio_readlink (struct inferior *inf, const char *filename,
|
linux_nat_target::fileio_readlink (struct inferior *inf, const char *filename,
|
||||||
fileio_error *target_errno)
|
fileio_error *target_errno)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ public:
|
|||||||
int flags, int mode, int warn_if_slow,
|
int flags, int mode, int warn_if_slow,
|
||||||
fileio_error *target_errno) override;
|
fileio_error *target_errno) override;
|
||||||
|
|
||||||
gdb::optional<std::string>
|
std::optional<std::string>
|
||||||
fileio_readlink (struct inferior *inf,
|
fileio_readlink (struct inferior *inf,
|
||||||
const char *filename,
|
const char *filename,
|
||||||
fileio_error *target_errno) override;
|
fileio_error *target_errno) override;
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
#include "gdbcmd.h"
|
#include "gdbcmd.h"
|
||||||
#include "gdbsupport/gdb_regex.h"
|
#include "gdbsupport/gdb_regex.h"
|
||||||
#include "gdbsupport/enum-flags.h"
|
#include "gdbsupport/enum-flags.h"
|
||||||
#include "gdbsupport/gdb_optional.h"
|
#include <optional>
|
||||||
#include "gcore.h"
|
#include "gcore.h"
|
||||||
#include "gcore-elf.h"
|
#include "gcore-elf.h"
|
||||||
#include "solib-svr4.h"
|
#include "solib-svr4.h"
|
||||||
@@ -229,7 +229,7 @@ struct linux_info
|
|||||||
int vsyscall_range_p = 0;
|
int vsyscall_range_p = 0;
|
||||||
|
|
||||||
/* Inferior's displaced step buffers. */
|
/* Inferior's displaced step buffers. */
|
||||||
gdb::optional<displaced_step_buffers> disp_step_bufs;
|
std::optional<displaced_step_buffers> disp_step_bufs;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Per-inferior data key. */
|
/* Per-inferior data key. */
|
||||||
@@ -589,7 +589,7 @@ struct mapping_regexes
|
|||||||
static int
|
static int
|
||||||
mapping_is_anonymous_p (const char *filename)
|
mapping_is_anonymous_p (const char *filename)
|
||||||
{
|
{
|
||||||
static gdb::optional<mapping_regexes> regexes;
|
static std::optional<mapping_regexes> regexes;
|
||||||
static int init_regex_p = 0;
|
static int init_regex_p = 0;
|
||||||
|
|
||||||
if (!init_regex_p)
|
if (!init_regex_p)
|
||||||
@@ -873,7 +873,7 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
|
|||||||
if (cwd_f)
|
if (cwd_f)
|
||||||
{
|
{
|
||||||
xsnprintf (filename, sizeof filename, "/proc/%ld/cwd", pid);
|
xsnprintf (filename, sizeof filename, "/proc/%ld/cwd", pid);
|
||||||
gdb::optional<std::string> contents
|
std::optional<std::string> contents
|
||||||
= target_fileio_readlink (NULL, filename, &target_errno);
|
= target_fileio_readlink (NULL, filename, &target_errno);
|
||||||
if (contents.has_value ())
|
if (contents.has_value ())
|
||||||
gdb_printf ("cwd = '%s'\n", contents->c_str ());
|
gdb_printf ("cwd = '%s'\n", contents->c_str ());
|
||||||
@@ -883,7 +883,7 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
|
|||||||
if (exe_f)
|
if (exe_f)
|
||||||
{
|
{
|
||||||
xsnprintf (filename, sizeof filename, "/proc/%ld/exe", pid);
|
xsnprintf (filename, sizeof filename, "/proc/%ld/exe", pid);
|
||||||
gdb::optional<std::string> contents
|
std::optional<std::string> contents
|
||||||
= target_fileio_readlink (NULL, filename, &target_errno);
|
= target_fileio_readlink (NULL, filename, &target_errno);
|
||||||
if (contents.has_value ())
|
if (contents.has_value ())
|
||||||
gdb_printf ("exe = '%s'\n", contents->c_str ());
|
gdb_printf ("exe = '%s'\n", contents->c_str ());
|
||||||
@@ -2108,7 +2108,7 @@ linux_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* Auxillary vector. */
|
/* Auxillary vector. */
|
||||||
gdb::optional<gdb::byte_vector> auxv =
|
std::optional<gdb::byte_vector> auxv =
|
||||||
target_read_alloc (current_inferior ()->top_target (),
|
target_read_alloc (current_inferior ()->top_target (),
|
||||||
TARGET_OBJECT_AUXV, NULL);
|
TARGET_OBJECT_AUXV, NULL);
|
||||||
if (auxv && !auxv->empty ())
|
if (auxv && !auxv->empty ())
|
||||||
@@ -2675,7 +2675,7 @@ linux_displaced_step_restore_all_in_ptid (inferior *parent_inf, ptid_t ptid)
|
|||||||
/* Helper for linux_get_hwcap and linux_get_hwcap2. */
|
/* Helper for linux_get_hwcap and linux_get_hwcap2. */
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
linux_get_hwcap_helper (const gdb::optional<gdb::byte_vector> &auxv,
|
linux_get_hwcap_helper (const std::optional<gdb::byte_vector> &auxv,
|
||||||
target_ops *target, gdbarch *gdbarch, CORE_ADDR match)
|
target_ops *target, gdbarch *gdbarch, CORE_ADDR match)
|
||||||
{
|
{
|
||||||
CORE_ADDR field;
|
CORE_ADDR field;
|
||||||
@@ -2688,7 +2688,7 @@ linux_get_hwcap_helper (const gdb::optional<gdb::byte_vector> &auxv,
|
|||||||
/* See linux-tdep.h. */
|
/* See linux-tdep.h. */
|
||||||
|
|
||||||
CORE_ADDR
|
CORE_ADDR
|
||||||
linux_get_hwcap (const gdb::optional<gdb::byte_vector> &auxv,
|
linux_get_hwcap (const std::optional<gdb::byte_vector> &auxv,
|
||||||
target_ops *target, gdbarch *gdbarch)
|
target_ops *target, gdbarch *gdbarch)
|
||||||
{
|
{
|
||||||
return linux_get_hwcap_helper (auxv, target, gdbarch, AT_HWCAP);
|
return linux_get_hwcap_helper (auxv, target, gdbarch, AT_HWCAP);
|
||||||
@@ -2707,7 +2707,7 @@ linux_get_hwcap ()
|
|||||||
/* See linux-tdep.h. */
|
/* See linux-tdep.h. */
|
||||||
|
|
||||||
CORE_ADDR
|
CORE_ADDR
|
||||||
linux_get_hwcap2 (const gdb::optional<gdb::byte_vector> &auxv,
|
linux_get_hwcap2 (const std::optional<gdb::byte_vector> &auxv,
|
||||||
target_ops *target, gdbarch *gdbarch)
|
target_ops *target, gdbarch *gdbarch)
|
||||||
{
|
{
|
||||||
return linux_get_hwcap_helper (auxv, target, gdbarch, AT_HWCAP2);
|
return linux_get_hwcap_helper (auxv, target, gdbarch, AT_HWCAP2);
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ extern int linux_is_uclinux (void);
|
|||||||
parse auxv entries.
|
parse auxv entries.
|
||||||
|
|
||||||
On error, 0 is returned. */
|
On error, 0 is returned. */
|
||||||
extern CORE_ADDR linux_get_hwcap (const gdb::optional<gdb::byte_vector> &auxv,
|
extern CORE_ADDR linux_get_hwcap (const std::optional<gdb::byte_vector> &auxv,
|
||||||
struct target_ops *target, gdbarch *gdbarch);
|
struct target_ops *target, gdbarch *gdbarch);
|
||||||
|
|
||||||
/* Same as the above, but obtain all the inputs from the current inferior. */
|
/* Same as the above, but obtain all the inputs from the current inferior. */
|
||||||
@@ -105,7 +105,7 @@ extern CORE_ADDR linux_get_hwcap ();
|
|||||||
parse auxv entries.
|
parse auxv entries.
|
||||||
|
|
||||||
On error, 0 is returned. */
|
On error, 0 is returned. */
|
||||||
extern CORE_ADDR linux_get_hwcap2 (const gdb::optional<gdb::byte_vector> &auxv,
|
extern CORE_ADDR linux_get_hwcap2 (const std::optional<gdb::byte_vector> &auxv,
|
||||||
struct target_ops *target, gdbarch *gdbarch);
|
struct target_ops *target, gdbarch *gdbarch);
|
||||||
|
|
||||||
/* Same as the above, but obtain all the inputs from the current inferior. */
|
/* Same as the above, but obtain all the inputs from the current inferior. */
|
||||||
|
|||||||
@@ -312,7 +312,7 @@ struct thread_db_thread_info : public private_thread_info
|
|||||||
/* Cached thread state. */
|
/* Cached thread state. */
|
||||||
td_thrhandle_t th {};
|
td_thrhandle_t th {};
|
||||||
thread_t tid {};
|
thread_t tid {};
|
||||||
gdb::optional<gdb::byte_vector> thread_handle;
|
std::optional<gdb::byte_vector> thread_handle;
|
||||||
};
|
};
|
||||||
|
|
||||||
static thread_db_thread_info *
|
static thread_db_thread_info *
|
||||||
|
|||||||
@@ -361,7 +361,7 @@ get_init_files (std::vector<std::string> *system_gdbinit,
|
|||||||
{
|
{
|
||||||
/* Cache the file lookup object so we only actually search for the files
|
/* Cache the file lookup object so we only actually search for the files
|
||||||
once. */
|
once. */
|
||||||
static gdb::optional<gdb_initfile_finder> init_files;
|
static std::optional<gdb_initfile_finder> init_files;
|
||||||
if (!init_files.has_value ())
|
if (!init_files.has_value ())
|
||||||
init_files.emplace (GDBINIT, SYSTEM_GDBINIT, SYSTEM_GDBINIT_RELOCATABLE,
|
init_files.emplace (GDBINIT, SYSTEM_GDBINIT, SYSTEM_GDBINIT_RELOCATABLE,
|
||||||
SYSTEM_GDBINIT_DIR, SYSTEM_GDBINIT_DIR_RELOCATABLE,
|
SYSTEM_GDBINIT_DIR, SYSTEM_GDBINIT_DIR_RELOCATABLE,
|
||||||
@@ -381,7 +381,7 @@ get_earlyinit_files (std::string *home_gdbearlyinit)
|
|||||||
{
|
{
|
||||||
/* Cache the file lookup object so we only actually search for the files
|
/* Cache the file lookup object so we only actually search for the files
|
||||||
once. */
|
once. */
|
||||||
static gdb::optional<gdb_initfile_finder> init_files;
|
static std::optional<gdb_initfile_finder> init_files;
|
||||||
if (!init_files.has_value ())
|
if (!init_files.has_value ())
|
||||||
init_files.emplace (GDBEARLYINIT, nullptr, false, nullptr, false, false);
|
init_files.emplace (GDBEARLYINIT, nullptr, false, nullptr, false, false);
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
#include "extension.h"
|
#include "extension.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include "mi-parse.h"
|
#include "mi-parse.h"
|
||||||
#include "gdbsupport/gdb_optional.h"
|
#include <optional>
|
||||||
#include "gdbsupport/gdb-safe-ctype.h"
|
#include "gdbsupport/gdb-safe-ctype.h"
|
||||||
#include "inferior.h"
|
#include "inferior.h"
|
||||||
#include "observable.h"
|
#include "observable.h"
|
||||||
@@ -515,7 +515,7 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what,
|
|||||||
arg->val->type ()->length ()))))
|
arg->val->type ()->length ()))))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gdb::optional<ui_out_emit_tuple> tuple_emitter;
|
std::optional<ui_out_emit_tuple> tuple_emitter;
|
||||||
if (values != PRINT_NO_VALUES || what == all)
|
if (values != PRINT_NO_VALUES || what == all)
|
||||||
tuple_emitter.emplace (uiout, nullptr);
|
tuple_emitter.emplace (uiout, nullptr);
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
#include "mi-getopt.h"
|
#include "mi-getopt.h"
|
||||||
#include "gdbthread.h"
|
#include "gdbthread.h"
|
||||||
#include "mi-parse.h"
|
#include "mi-parse.h"
|
||||||
#include "gdbsupport/gdb_optional.h"
|
#include <optional>
|
||||||
#include "inferior.h"
|
#include "inferior.h"
|
||||||
|
|
||||||
static void varobj_update_one (struct varobj *var,
|
static void varobj_update_one (struct varobj *var,
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ mi_command::mi_command (const char *name, int *suppress_notification)
|
|||||||
|
|
||||||
/* See mi-cmds.h. */
|
/* See mi-cmds.h. */
|
||||||
|
|
||||||
gdb::optional<scoped_restore_tmpl<int>>
|
std::optional<scoped_restore_tmpl<int>>
|
||||||
mi_command::do_suppress_notification () const
|
mi_command::do_suppress_notification () const
|
||||||
{
|
{
|
||||||
if (m_suppress_notification != nullptr)
|
if (m_suppress_notification != nullptr)
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
#define MI_MI_CMDS_H
|
#define MI_MI_CMDS_H
|
||||||
|
|
||||||
#include "gdbsupport/function-view.h"
|
#include "gdbsupport/function-view.h"
|
||||||
#include "gdbsupport/gdb_optional.h"
|
#include <optional>
|
||||||
#include "mi/mi-main.h"
|
#include "mi/mi-main.h"
|
||||||
|
|
||||||
enum print_values {
|
enum print_values {
|
||||||
@@ -180,12 +180,12 @@ struct mi_command
|
|||||||
|
|
||||||
/* If this command was created with a suppress notifications pointer,
|
/* If this command was created with a suppress notifications pointer,
|
||||||
then this function will set the suppress flag and return a
|
then this function will set the suppress flag and return a
|
||||||
gdb::optional with its value set to an object that will restore the
|
std::optional with its value set to an object that will restore the
|
||||||
previous value of the suppress notifications flag.
|
previous value of the suppress notifications flag.
|
||||||
|
|
||||||
If this command was created without a suppress notifications points,
|
If this command was created without a suppress notifications points,
|
||||||
then this function returns an empty gdb::optional. */
|
then this function returns an empty std::optional. */
|
||||||
gdb::optional<scoped_restore_tmpl<int>> do_suppress_notification () const;
|
std::optional<scoped_restore_tmpl<int>> do_suppress_notification () const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ mi_interp::on_new_thread (thread_info *t)
|
|||||||
|
|
||||||
void
|
void
|
||||||
mi_interp::on_thread_exited (thread_info *t,
|
mi_interp::on_thread_exited (thread_info *t,
|
||||||
gdb::optional<ULONGEST> /* exit_code */,
|
std::optional<ULONGEST> /* exit_code */,
|
||||||
int /* silent */)
|
int /* silent */)
|
||||||
{
|
{
|
||||||
target_terminal::scoped_restore_terminal_state term_state;
|
target_terminal::scoped_restore_terminal_state term_state;
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public:
|
|||||||
void on_command_error () override;
|
void on_command_error () override;
|
||||||
void on_user_selected_context_changed (user_selected_what selection) override;
|
void on_user_selected_context_changed (user_selected_what selection) override;
|
||||||
void on_new_thread (thread_info *t) override;
|
void on_new_thread (thread_info *t) override;
|
||||||
void on_thread_exited (thread_info *t, gdb::optional<ULONGEST> exit_code,
|
void on_thread_exited (thread_info *t, std::optional<ULONGEST> exit_code,
|
||||||
int silent) override;
|
int silent) override;
|
||||||
void on_inferior_added (inferior *inf) override;
|
void on_inferior_added (inferior *inf) override;
|
||||||
void on_inferior_appeared (inferior *inf) override;
|
void on_inferior_appeared (inferior *inf) override;
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
#include "extension.h"
|
#include "extension.h"
|
||||||
#include "gdbcmd.h"
|
#include "gdbcmd.h"
|
||||||
#include "observable.h"
|
#include "observable.h"
|
||||||
#include "gdbsupport/gdb_optional.h"
|
#include <optional>
|
||||||
#include "gdbsupport/byte-vector.h"
|
#include "gdbsupport/byte-vector.h"
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@@ -2097,7 +2097,7 @@ mi_cmd_execute (struct mi_parse *parse)
|
|||||||
|
|
||||||
user_selected_context current_user_selected_context;
|
user_selected_context current_user_selected_context;
|
||||||
|
|
||||||
gdb::optional<scoped_restore_current_thread> thread_saver;
|
std::optional<scoped_restore_current_thread> thread_saver;
|
||||||
if (parse->thread != -1)
|
if (parse->thread != -1)
|
||||||
{
|
{
|
||||||
thread_info *tp = find_thread_global_id (parse->thread);
|
thread_info *tp = find_thread_global_id (parse->thread);
|
||||||
@@ -2114,7 +2114,7 @@ mi_cmd_execute (struct mi_parse *parse)
|
|||||||
switch_to_thread (tp);
|
switch_to_thread (tp);
|
||||||
}
|
}
|
||||||
|
|
||||||
gdb::optional<scoped_restore_selected_frame> frame_saver;
|
std::optional<scoped_restore_selected_frame> frame_saver;
|
||||||
if (parse->frame != -1)
|
if (parse->frame != -1)
|
||||||
{
|
{
|
||||||
frame_info_ptr fid;
|
frame_info_ptr fid;
|
||||||
@@ -2132,7 +2132,7 @@ mi_cmd_execute (struct mi_parse *parse)
|
|||||||
error (_("Invalid frame id: %d"), frame);
|
error (_("Invalid frame id: %d"), frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
gdb::optional<scoped_restore_current_language> lang_saver;
|
std::optional<scoped_restore_current_language> lang_saver;
|
||||||
if (parse->language != language_unknown)
|
if (parse->language != language_unknown)
|
||||||
{
|
{
|
||||||
lang_saver.emplace ();
|
lang_saver.emplace ();
|
||||||
@@ -2143,7 +2143,7 @@ mi_cmd_execute (struct mi_parse *parse)
|
|||||||
|
|
||||||
gdb_assert (parse->cmd != nullptr);
|
gdb_assert (parse->cmd != nullptr);
|
||||||
|
|
||||||
gdb::optional<scoped_restore_tmpl<int>> restore_suppress_notification
|
std::optional<scoped_restore_tmpl<int>> restore_suppress_notification
|
||||||
= parse->cmd->do_suppress_notification ();
|
= parse->cmd->do_suppress_notification ();
|
||||||
|
|
||||||
parse->cmd->invoke (parse);
|
parse->cmd->invoke (parse);
|
||||||
@@ -2514,7 +2514,7 @@ print_variable_or_computed (const char *expression, enum print_values values)
|
|||||||
else
|
else
|
||||||
val = expr->evaluate ();
|
val = expr->evaluate ();
|
||||||
|
|
||||||
gdb::optional<ui_out_emit_tuple> tuple_emitter;
|
std::optional<ui_out_emit_tuple> tuple_emitter;
|
||||||
if (values != PRINT_NO_VALUES)
|
if (values != PRINT_NO_VALUES)
|
||||||
tuple_emitter.emplace (uiout, nullptr);
|
tuple_emitter.emplace (uiout, nullptr);
|
||||||
uiout->field_string ("name", expression);
|
uiout->field_string ("name", expression);
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ linux_common_core_of_thread (ptid_t ptid)
|
|||||||
sprintf (filename, "/proc/%lld/task/%lld/stat",
|
sprintf (filename, "/proc/%lld/task/%lld/stat",
|
||||||
(PID_T) ptid.pid (), (PID_T) ptid.lwp ());
|
(PID_T) ptid.pid (), (PID_T) ptid.lwp ());
|
||||||
|
|
||||||
gdb::optional<std::string> content = read_text_file_to_string (filename);
|
std::optional<std::string> content = read_text_file_to_string (filename);
|
||||||
if (!content.has_value ())
|
if (!content.has_value ())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@@ -257,10 +257,10 @@ get_cores_used_by_process (PID_T pid, int *cores, const int num_cores)
|
|||||||
|
|
||||||
/* get_core_array_size helper that uses /sys/devices/system/cpu/possible. */
|
/* get_core_array_size helper that uses /sys/devices/system/cpu/possible. */
|
||||||
|
|
||||||
static gdb::optional<size_t>
|
static std::optional<size_t>
|
||||||
get_core_array_size_using_sys_possible ()
|
get_core_array_size_using_sys_possible ()
|
||||||
{
|
{
|
||||||
gdb::optional<std::string> possible
|
std::optional<std::string> possible
|
||||||
= read_text_file_to_string ("/sys/devices/system/cpu/possible");
|
= read_text_file_to_string ("/sys/devices/system/cpu/possible");
|
||||||
|
|
||||||
if (!possible.has_value ())
|
if (!possible.has_value ())
|
||||||
@@ -310,7 +310,7 @@ get_core_array_size ()
|
|||||||
we are in a container that has access to a subset of the host's cores.
|
we are in a container that has access to a subset of the host's cores.
|
||||||
It will return a size that considers all the CPU cores available to the
|
It will return a size that considers all the CPU cores available to the
|
||||||
host. If that fails for some reason, fall back to sysconf. */
|
host. If that fails for some reason, fall back to sysconf. */
|
||||||
gdb::optional<size_t> count = get_core_array_size_using_sys_possible ();
|
std::optional<size_t> count = get_core_array_size_using_sys_possible ();
|
||||||
if (count.has_value ())
|
if (count.has_value ())
|
||||||
return *count;
|
return *count;
|
||||||
|
|
||||||
|
|||||||
@@ -698,10 +698,10 @@ windows_process_info::matching_pending_stop (bool debug_events)
|
|||||||
|
|
||||||
/* See nat/windows-nat.h. */
|
/* See nat/windows-nat.h. */
|
||||||
|
|
||||||
gdb::optional<pending_stop>
|
std::optional<pending_stop>
|
||||||
windows_process_info::fetch_pending_stop (bool debug_events)
|
windows_process_info::fetch_pending_stop (bool debug_events)
|
||||||
{
|
{
|
||||||
gdb::optional<pending_stop> result;
|
std::optional<pending_stop> result;
|
||||||
for (auto iter = pending_stops.begin ();
|
for (auto iter = pending_stops.begin ();
|
||||||
iter != pending_stops.end ();
|
iter != pending_stops.end ();
|
||||||
++iter)
|
++iter)
|
||||||
@@ -818,7 +818,7 @@ create_process_wrapper (FUNC *do_create_process, const CHAR *image,
|
|||||||
InitializeProcThreadAttributeList (info_ex.lpAttributeList,
|
InitializeProcThreadAttributeList (info_ex.lpAttributeList,
|
||||||
1, 0, &size);
|
1, 0, &size);
|
||||||
|
|
||||||
gdb::optional<BOOL> return_value;
|
std::optional<BOOL> return_value;
|
||||||
DWORD attr_flags = relocate_aslr_flags;
|
DWORD attr_flags = relocate_aslr_flags;
|
||||||
if (!UpdateProcThreadAttribute (info_ex.lpAttributeList, 0,
|
if (!UpdateProcThreadAttribute (info_ex.lpAttributeList, 0,
|
||||||
mitigation_policy,
|
mitigation_policy,
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
#include <psapi.h>
|
#include <psapi.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "gdbsupport/gdb_optional.h"
|
#include <optional>
|
||||||
#include "target/waitstatus.h"
|
#include "target/waitstatus.h"
|
||||||
|
|
||||||
#define STATUS_WX86_BREAKPOINT 0x4000001F
|
#define STATUS_WX86_BREAKPOINT 0x4000001F
|
||||||
@@ -246,7 +246,7 @@ struct windows_process_info
|
|||||||
remove it from the list of pending stops, set 'current_event', and
|
remove it from the list of pending stops, set 'current_event', and
|
||||||
return it. Otherwise, return an empty optional. */
|
return it. Otherwise, return an empty optional. */
|
||||||
|
|
||||||
gdb::optional<pending_stop> fetch_pending_stop (bool debug_events);
|
std::optional<pending_stop> fetch_pending_stop (bool debug_events);
|
||||||
|
|
||||||
const char *pid_to_exec_file (int);
|
const char *pid_to_exec_file (int);
|
||||||
|
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ extern observable<struct thread_info */* t */> new_thread;
|
|||||||
removing the thread from its tables without wanting to notify the
|
removing the thread from its tables without wanting to notify the
|
||||||
CLI about it. */
|
CLI about it. */
|
||||||
extern observable<thread_info */* t */,
|
extern observable<thread_info */* t */,
|
||||||
gdb::optional<ULONGEST> /* exit_code */,
|
std::optional<ULONGEST> /* exit_code */,
|
||||||
bool /* silent */> thread_exit;
|
bool /* silent */> thread_exit;
|
||||||
|
|
||||||
/* An explicit stop request was issued to PTID. If PTID equals
|
/* An explicit stop request was issued to PTID. If PTID equals
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ std::unique_ptr<osdata>
|
|||||||
get_osdata (const char *type)
|
get_osdata (const char *type)
|
||||||
{
|
{
|
||||||
std::unique_ptr<osdata> osdata;
|
std::unique_ptr<osdata> osdata;
|
||||||
gdb::optional<gdb::char_vector> xml = target_get_osdata (type);
|
std::optional<gdb::char_vector> xml = target_get_osdata (type);
|
||||||
|
|
||||||
if (xml)
|
if (xml)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
#include "objfiles.h"
|
#include "objfiles.h"
|
||||||
#include "user-regs.h"
|
#include "user-regs.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "gdbsupport/gdb_optional.h"
|
#include <optional>
|
||||||
#include "c-exp.h"
|
#include "c-exp.h"
|
||||||
|
|
||||||
static unsigned int expressiondebug = 0;
|
static unsigned int expressiondebug = 0;
|
||||||
@@ -471,7 +471,7 @@ parse_expression (const char *string, innermost_block_tracker *tracker,
|
|||||||
expression_up
|
expression_up
|
||||||
parse_expression_with_language (const char *string, enum language lang)
|
parse_expression_with_language (const char *string, enum language lang)
|
||||||
{
|
{
|
||||||
gdb::optional<scoped_restore_current_language> lang_saver;
|
std::optional<scoped_restore_current_language> lang_saver;
|
||||||
if (current_language->la_language != lang)
|
if (current_language->la_language != lang)
|
||||||
{
|
{
|
||||||
lang_saver.emplace ();
|
lang_saver.emplace ();
|
||||||
|
|||||||
@@ -464,7 +464,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* The interface option. Initialized if has_value () returns true. */
|
/* The interface option. Initialized if has_value () returns true. */
|
||||||
gdb::optional<enum debug_reg_interface> m_interface;
|
std::optional<enum debug_reg_interface> m_interface;
|
||||||
|
|
||||||
/* The info returned by the kernel with PPC_PTRACE_GETHWDBGINFO. Only
|
/* The info returned by the kernel with PPC_PTRACE_GETHWDBGINFO. Only
|
||||||
valid if we determined that the interface is HWDEBUG. */
|
valid if we determined that the interface is HWDEBUG. */
|
||||||
@@ -485,7 +485,7 @@ struct ppc_linux_process_info
|
|||||||
/* The watchpoint value that GDB requested for this process.
|
/* The watchpoint value that GDB requested for this process.
|
||||||
|
|
||||||
Only used when the interface is DEBUGREG. */
|
Only used when the interface is DEBUGREG. */
|
||||||
gdb::optional<long> requested_wp_val;
|
std::optional<long> requested_wp_val;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ppc_linux_nat_target final : public linux_nat_target
|
struct ppc_linux_nat_target final : public linux_nat_target
|
||||||
|
|||||||
@@ -1609,7 +1609,7 @@ ppc_linux_core_read_description (struct gdbarch *gdbarch,
|
|||||||
if (vsx)
|
if (vsx)
|
||||||
features.vsx = true;
|
features.vsx = true;
|
||||||
|
|
||||||
gdb::optional<gdb::byte_vector> auxv = target_read_auxv_raw (target);
|
std::optional<gdb::byte_vector> auxv = target_read_auxv_raw (target);
|
||||||
CORE_ADDR hwcap = linux_get_hwcap (auxv, target, gdbarch);
|
CORE_ADDR hwcap = linux_get_hwcap (auxv, target, gdbarch);
|
||||||
|
|
||||||
features.isa205 = ppc_linux_has_isa205 (hwcap);
|
features.isa205 = ppc_linux_has_isa205 (hwcap);
|
||||||
|
|||||||
@@ -447,7 +447,7 @@ struct ppc_inferior_data
|
|||||||
/* This is an optional in case we add more fields to ppc_inferior_data, we
|
/* This is an optional in case we add more fields to ppc_inferior_data, we
|
||||||
don't want it instantiated as soon as we get the ppc_inferior_data for an
|
don't want it instantiated as soon as we get the ppc_inferior_data for an
|
||||||
inferior. */
|
inferior. */
|
||||||
gdb::optional<displaced_step_buffers> disp_step_buf;
|
std::optional<displaced_step_buffers> disp_step_buf;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern ppc_inferior_data * get_ppc_per_inferior (inferior *inf);
|
extern ppc_inferior_data * get_ppc_per_inferior (inferior *inf);
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
#include "gdbsupport/format.h"
|
#include "gdbsupport/format.h"
|
||||||
#include "source.h"
|
#include "source.h"
|
||||||
#include "gdbsupport/byte-vector.h"
|
#include "gdbsupport/byte-vector.h"
|
||||||
#include "gdbsupport/gdb_optional.h"
|
#include <optional>
|
||||||
#include "gdbsupport/gdb-safe-ctype.h"
|
#include "gdbsupport/gdb-safe-ctype.h"
|
||||||
#include "gdbsupport/rsp-low.h"
|
#include "gdbsupport/rsp-low.h"
|
||||||
#include "inferior.h"
|
#include "inferior.h"
|
||||||
@@ -435,7 +435,7 @@ print_scalar_formatted (const gdb_byte *valaddr, struct type *type,
|
|||||||
/* Some cases below will unpack the value again. In the biased
|
/* Some cases below will unpack the value again. In the biased
|
||||||
range case, we want to avoid this, so we store the unpacked value
|
range case, we want to avoid this, so we store the unpacked value
|
||||||
here for possible use later. */
|
here for possible use later. */
|
||||||
gdb::optional<LONGEST> val_long;
|
std::optional<LONGEST> val_long;
|
||||||
if ((is_fixed_point_type (type)
|
if ((is_fixed_point_type (type)
|
||||||
&& (options->format == 'o'
|
&& (options->format == 'o'
|
||||||
|| options->format == 'x'
|
|| options->format == 'x'
|
||||||
@@ -2521,7 +2521,7 @@ printf_wide_c_string (struct ui_file *stream, const char *format,
|
|||||||
struct type *wctype = lookup_typename (current_language,
|
struct type *wctype = lookup_typename (current_language,
|
||||||
"wchar_t", NULL, 0);
|
"wchar_t", NULL, 0);
|
||||||
int wcwidth = wctype->length ();
|
int wcwidth = wctype->length ();
|
||||||
gdb::optional<gdb::byte_vector> tem_str;
|
std::optional<gdb::byte_vector> tem_str;
|
||||||
|
|
||||||
if (value->lval () == lval_internalvar
|
if (value->lval () == lval_internalvar
|
||||||
&& c_is_string_type_p (value->type ()))
|
&& c_is_string_type_p (value->type ()))
|
||||||
|
|||||||
22
gdb/probe.c
22
gdb/probe.c
@@ -36,7 +36,7 @@
|
|||||||
#include "location.h"
|
#include "location.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "gdbsupport/gdb_optional.h"
|
#include <optional>
|
||||||
|
|
||||||
/* Class that implements the static probe methods for "any" probe. */
|
/* Class that implements the static probe methods for "any" probe. */
|
||||||
|
|
||||||
@@ -280,7 +280,7 @@ collect_probes (const std::string &objname, const std::string &provider,
|
|||||||
const std::string &probe_name, const static_probe_ops *spops)
|
const std::string &probe_name, const static_probe_ops *spops)
|
||||||
{
|
{
|
||||||
std::vector<bound_probe> result;
|
std::vector<bound_probe> result;
|
||||||
gdb::optional<compiled_regex> obj_pat, prov_pat, probe_pat;
|
std::optional<compiled_regex> obj_pat, prov_pat, probe_pat;
|
||||||
|
|
||||||
if (!provider.empty ())
|
if (!provider.empty ())
|
||||||
prov_pat.emplace (provider.c_str (), REG_NOSUB,
|
prov_pat.emplace (provider.c_str (), REG_NOSUB,
|
||||||
@@ -683,9 +683,9 @@ disable_probes_command (const char *arg, int from_tty)
|
|||||||
static bool ignore_probes_p = false;
|
static bool ignore_probes_p = false;
|
||||||
static bool ignore_probes_idx = 0;
|
static bool ignore_probes_idx = 0;
|
||||||
static bool ignore_probes_verbose_p;
|
static bool ignore_probes_verbose_p;
|
||||||
static gdb::optional<compiled_regex> ignore_probes_prov_pat[2];
|
static std::optional<compiled_regex> ignore_probes_prov_pat[2];
|
||||||
static gdb::optional<compiled_regex> ignore_probes_name_pat[2];
|
static std::optional<compiled_regex> ignore_probes_name_pat[2];
|
||||||
static gdb::optional<compiled_regex> ignore_probes_obj_pat[2];
|
static std::optional<compiled_regex> ignore_probes_obj_pat[2];
|
||||||
|
|
||||||
/* See comments in probe.h. */
|
/* See comments in probe.h. */
|
||||||
|
|
||||||
@@ -696,11 +696,11 @@ ignore_probe_p (const char *provider, const char *name,
|
|||||||
if (!ignore_probes_p)
|
if (!ignore_probes_p)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
gdb::optional<compiled_regex> &re_prov
|
std::optional<compiled_regex> &re_prov
|
||||||
= ignore_probes_prov_pat[ignore_probes_idx];
|
= ignore_probes_prov_pat[ignore_probes_idx];
|
||||||
gdb::optional<compiled_regex> &re_name
|
std::optional<compiled_regex> &re_name
|
||||||
= ignore_probes_name_pat[ignore_probes_idx];
|
= ignore_probes_name_pat[ignore_probes_idx];
|
||||||
gdb::optional<compiled_regex> &re_obj
|
std::optional<compiled_regex> &re_obj
|
||||||
= ignore_probes_obj_pat[ignore_probes_idx];
|
= ignore_probes_obj_pat[ignore_probes_idx];
|
||||||
|
|
||||||
bool res
|
bool res
|
||||||
@@ -755,11 +755,11 @@ ignore_probes_command (const char *arg, int from_tty)
|
|||||||
/* Parse the regular expressions, making sure that the old regular
|
/* Parse the regular expressions, making sure that the old regular
|
||||||
expressions are still valid if an exception is throw. */
|
expressions are still valid if an exception is throw. */
|
||||||
int new_ignore_probes_idx = 1 - ignore_probes_idx;
|
int new_ignore_probes_idx = 1 - ignore_probes_idx;
|
||||||
gdb::optional<compiled_regex> &re_prov
|
std::optional<compiled_regex> &re_prov
|
||||||
= ignore_probes_prov_pat[new_ignore_probes_idx];
|
= ignore_probes_prov_pat[new_ignore_probes_idx];
|
||||||
gdb::optional<compiled_regex> &re_name
|
std::optional<compiled_regex> &re_name
|
||||||
= ignore_probes_name_pat[new_ignore_probes_idx];
|
= ignore_probes_name_pat[new_ignore_probes_idx];
|
||||||
gdb::optional<compiled_regex> &re_obj
|
std::optional<compiled_regex> &re_obj
|
||||||
= ignore_probes_obj_pat[new_ignore_probes_idx];
|
= ignore_probes_obj_pat[new_ignore_probes_idx];
|
||||||
re_prov.reset ();
|
re_prov.reset ();
|
||||||
re_name.reset ();
|
re_name.reset ();
|
||||||
|
|||||||
@@ -3615,7 +3615,7 @@ procfs_target::make_corefile_notes (bfd *obfd, int *note_size)
|
|||||||
proc_iterate_over_threads (pi, procfs_corefile_thread_callback,
|
proc_iterate_over_threads (pi, procfs_corefile_thread_callback,
|
||||||
&thread_args);
|
&thread_args);
|
||||||
|
|
||||||
gdb::optional<gdb::byte_vector> auxv =
|
std::optional<gdb::byte_vector> auxv =
|
||||||
target_read_alloc (current_inferior ()->top_target (),
|
target_read_alloc (current_inferior ()->top_target (),
|
||||||
TARGET_OBJECT_AUXV, NULL);
|
TARGET_OBJECT_AUXV, NULL);
|
||||||
if (auxv && !auxv->empty ())
|
if (auxv && !auxv->empty ())
|
||||||
|
|||||||
@@ -1025,7 +1025,7 @@ psymbol_functions::expand_symtabs_matching
|
|||||||
for (partial_symtab *ps : partial_symbols (objfile))
|
for (partial_symtab *ps : partial_symbols (objfile))
|
||||||
ps->searched_flag = PST_NOT_SEARCHED;
|
ps->searched_flag = PST_NOT_SEARCHED;
|
||||||
|
|
||||||
gdb::optional<lookup_name_info> psym_lookup_name;
|
std::optional<lookup_name_info> psym_lookup_name;
|
||||||
if (lookup_name != nullptr)
|
if (lookup_name != nullptr)
|
||||||
psym_lookup_name = lookup_name->make_ignore_params ();
|
psym_lookup_name = lookup_name->make_ignore_params ();
|
||||||
|
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ private:
|
|||||||
/* The obstack where allocations are made. This is lazily allocated
|
/* The obstack where allocations are made. This is lazily allocated
|
||||||
so that we don't waste memory when there are no psymtabs. */
|
so that we don't waste memory when there are no psymtabs. */
|
||||||
|
|
||||||
gdb::optional<auto_obstack> m_obstack;
|
std::optional<auto_obstack> m_obstack;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* A partial_symbol records the name, domain, and address class of
|
/* A partial_symbol records the name, domain, and address class of
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ struct gdbpy_disassembler : public gdb_disassemble_info
|
|||||||
/* Return a reference to an optional that contains the address at which a
|
/* Return a reference to an optional that contains the address at which a
|
||||||
memory error occurred. The optional will only have a value if a
|
memory error occurred. The optional will only have a value if a
|
||||||
memory error actually occurred. */
|
memory error actually occurred. */
|
||||||
const gdb::optional<CORE_ADDR> &memory_error_address () const
|
const std::optional<CORE_ADDR> &memory_error_address () const
|
||||||
{ return m_memory_error_address; }
|
{ return m_memory_error_address; }
|
||||||
|
|
||||||
/* Return the content of the disassembler as a string. The contents are
|
/* Return the content of the disassembler as a string. The contents are
|
||||||
@@ -221,7 +221,7 @@ private:
|
|||||||
|
|
||||||
/* When the user indicates that a memory error has occurred then the
|
/* When the user indicates that a memory error has occurred then the
|
||||||
address of the memory error is stored in here. */
|
address of the memory error is stored in here. */
|
||||||
gdb::optional<CORE_ADDR> m_memory_error_address;
|
std::optional<CORE_ADDR> m_memory_error_address;
|
||||||
|
|
||||||
/* When the user calls the builtin_disassemble function, if they pass a
|
/* When the user calls the builtin_disassemble function, if they pass a
|
||||||
memory source object then a pointer to the object is placed in here,
|
memory source object then a pointer to the object is placed in here,
|
||||||
@@ -245,7 +245,7 @@ private:
|
|||||||
|
|
||||||
/* Store a single exception. This is used to pass Python exceptions back
|
/* Store a single exception. This is used to pass Python exceptions back
|
||||||
from ::memory_read to disasmpy_builtin_disassemble. */
|
from ::memory_read to disasmpy_builtin_disassemble. */
|
||||||
gdb::optional<gdbpy_err_fetch> m_stored_exception;
|
std::optional<gdbpy_err_fetch> m_stored_exception;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Return true if OBJ is still valid, otherwise, return false. A valid OBJ
|
/* Return true if OBJ is still valid, otherwise, return false. A valid OBJ
|
||||||
@@ -1215,7 +1215,7 @@ private:
|
|||||||
|
|
||||||
/* See python-internal.h. */
|
/* See python-internal.h. */
|
||||||
|
|
||||||
gdb::optional<int>
|
std::optional<int>
|
||||||
gdbpy_print_insn (struct gdbarch *gdbarch, CORE_ADDR memaddr,
|
gdbpy_print_insn (struct gdbarch *gdbarch, CORE_ADDR memaddr,
|
||||||
disassemble_info *info)
|
disassemble_info *info)
|
||||||
{
|
{
|
||||||
@@ -1294,7 +1294,7 @@ gdbpy_print_insn (struct gdbarch *gdbarch, CORE_ADDR memaddr,
|
|||||||
addr = disasm_info->address;
|
addr = disasm_info->address;
|
||||||
|
|
||||||
info->memory_error_func (-1, addr, info);
|
info->memory_error_func (-1, addr, info);
|
||||||
return gdb::optional<int> (-1);
|
return std::optional<int> (-1);
|
||||||
}
|
}
|
||||||
else if (PyErr_ExceptionMatches (gdbpy_gdberror_exc))
|
else if (PyErr_ExceptionMatches (gdbpy_gdberror_exc))
|
||||||
{
|
{
|
||||||
@@ -1302,12 +1302,12 @@ gdbpy_print_insn (struct gdbarch *gdbarch, CORE_ADDR memaddr,
|
|||||||
gdb::unique_xmalloc_ptr<char> msg = err.to_string ();
|
gdb::unique_xmalloc_ptr<char> msg = err.to_string ();
|
||||||
|
|
||||||
info->fprintf_func (info->stream, "%s", msg.get ());
|
info->fprintf_func (info->stream, "%s", msg.get ());
|
||||||
return gdb::optional<int> (-1);
|
return std::optional<int> (-1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gdbpy_print_stack ();
|
gdbpy_print_stack ();
|
||||||
return gdb::optional<int> (-1);
|
return std::optional<int> (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1326,7 +1326,7 @@ gdbpy_print_insn (struct gdbarch *gdbarch, CORE_ADDR memaddr,
|
|||||||
PyErr_SetString (PyExc_TypeError,
|
PyErr_SetString (PyExc_TypeError,
|
||||||
_("Result is not a DisassemblerResult."));
|
_("Result is not a DisassemblerResult."));
|
||||||
gdbpy_print_stack ();
|
gdbpy_print_stack ();
|
||||||
return gdb::optional<int> (-1);
|
return std::optional<int> (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The result from the Python disassembler has the correct type. Convert
|
/* The result from the Python disassembler has the correct type. Convert
|
||||||
@@ -1345,7 +1345,7 @@ gdbpy_print_insn (struct gdbarch *gdbarch, CORE_ADDR memaddr,
|
|||||||
(PyExc_ValueError,
|
(PyExc_ValueError,
|
||||||
_("Invalid length attribute: length must be greater than 0."));
|
_("Invalid length attribute: length must be greater than 0."));
|
||||||
gdbpy_print_stack ();
|
gdbpy_print_stack ();
|
||||||
return gdb::optional<int> (-1);
|
return std::optional<int> (-1);
|
||||||
}
|
}
|
||||||
if (length > max_insn_length)
|
if (length > max_insn_length)
|
||||||
{
|
{
|
||||||
@@ -1354,7 +1354,7 @@ gdbpy_print_insn (struct gdbarch *gdbarch, CORE_ADDR memaddr,
|
|||||||
_("Invalid length attribute: length %d greater than architecture maximum of %d"),
|
_("Invalid length attribute: length %d greater than architecture maximum of %d"),
|
||||||
length, max_insn_length);
|
length, max_insn_length);
|
||||||
gdbpy_print_stack ();
|
gdbpy_print_stack ();
|
||||||
return gdb::optional<int> (-1);
|
return std::optional<int> (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* It is impossible to create a DisassemblerResult object with an empty
|
/* It is impossible to create a DisassemblerResult object with an empty
|
||||||
@@ -1390,7 +1390,7 @@ gdbpy_print_insn (struct gdbarch *gdbarch, CORE_ADDR memaddr,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return gdb::optional<int> (length);
|
return std::optional<int> (length);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The tp_dealloc callback for the DisassemblerResult type. Takes care of
|
/* The tp_dealloc callback for the DisassemblerResult type. Takes care of
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
#include "demangle.h"
|
#include "demangle.h"
|
||||||
#include "mi/mi-cmds.h"
|
#include "mi/mi-cmds.h"
|
||||||
#include "python-internal.h"
|
#include "python-internal.h"
|
||||||
#include "gdbsupport/gdb_optional.h"
|
#include <optional>
|
||||||
#include "cli/cli-style.h"
|
#include "cli/cli-style.h"
|
||||||
|
|
||||||
enum mi_print_types
|
enum mi_print_types
|
||||||
@@ -322,7 +322,7 @@ py_print_single_arg (struct ui_out *out,
|
|||||||
else
|
else
|
||||||
val = fv;
|
val = fv;
|
||||||
|
|
||||||
gdb::optional<ui_out_emit_tuple> maybe_tuple;
|
std::optional<ui_out_emit_tuple> maybe_tuple;
|
||||||
|
|
||||||
/* MI has varying rules for tuples, but generally if there is only
|
/* MI has varying rules for tuples, but generally if there is only
|
||||||
one element in each item in the list, do not start a tuple. The
|
one element in each item in the list, do not start a tuple. The
|
||||||
@@ -562,7 +562,7 @@ enumerate_locals (PyObject *iter,
|
|||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
const struct block *sym_block;
|
const struct block *sym_block;
|
||||||
int local_indent = 8 + (8 * indent);
|
int local_indent = 8 + (8 * indent);
|
||||||
gdb::optional<ui_out_emit_tuple> tuple;
|
std::optional<ui_out_emit_tuple> tuple;
|
||||||
|
|
||||||
gdbpy_ref<> item (PyIter_Next (iter));
|
gdbpy_ref<> item (PyIter_Next (iter));
|
||||||
if (item == NULL)
|
if (item == NULL)
|
||||||
@@ -773,7 +773,7 @@ py_print_frame (PyObject *filter, frame_filter_flags flags,
|
|||||||
get_user_print_options (&opts);
|
get_user_print_options (&opts);
|
||||||
if (print_frame_info)
|
if (print_frame_info)
|
||||||
{
|
{
|
||||||
gdb::optional<enum print_what> user_frame_info_print_what;
|
std::optional<enum print_what> user_frame_info_print_what;
|
||||||
|
|
||||||
get_user_print_what_frame_info (&user_frame_info_print_what);
|
get_user_print_what_frame_info (&user_frame_info_print_what);
|
||||||
if (!out->is_mi_like_p () && user_frame_info_print_what.has_value ())
|
if (!out->is_mi_like_p () && user_frame_info_print_what.has_value ())
|
||||||
@@ -808,7 +808,7 @@ py_print_frame (PyObject *filter, frame_filter_flags flags,
|
|||||||
return EXT_LANG_BT_OK;
|
return EXT_LANG_BT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
gdb::optional<ui_out_emit_tuple> tuple;
|
std::optional<ui_out_emit_tuple> tuple;
|
||||||
|
|
||||||
/* -stack-list-locals does not require a
|
/* -stack-list-locals does not require a
|
||||||
wrapping frame attribute. */
|
wrapping frame attribute. */
|
||||||
|
|||||||
@@ -364,7 +364,7 @@ add_thread_object (struct thread_info *tp)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
delete_thread_object (thread_info *tp,
|
delete_thread_object (thread_info *tp,
|
||||||
gdb::optional<ULONGEST> /* exit_code */,
|
std::optional<ULONGEST> /* exit_code */,
|
||||||
bool /* silent */)
|
bool /* silent */)
|
||||||
{
|
{
|
||||||
if (!gdb_python_initialized)
|
if (!gdb_python_initialized)
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ private:
|
|||||||
|
|
||||||
/* If an error occurred, this holds the exception information for
|
/* If an error occurred, this holds the exception information for
|
||||||
use by the 'release' method. */
|
use by the 'release' method. */
|
||||||
gdb::optional<gdbpy_err_fetch> m_error;
|
std::optional<gdbpy_err_fetch> m_error;
|
||||||
|
|
||||||
/* Return a reference to the object under construction. */
|
/* Return a reference to the object under construction. */
|
||||||
object_desc ¤t ()
|
object_desc ¤t ()
|
||||||
|
|||||||
@@ -469,12 +469,12 @@ gdbpy_fix_doc_string_indentation (gdb::unique_xmalloc_ptr<char> doc)
|
|||||||
(user left a single stray space at the start of an otherwise blank
|
(user left a single stray space at the start of an otherwise blank
|
||||||
line), we don't consider lines without content when updating the
|
line), we don't consider lines without content when updating the
|
||||||
MIN_WHITESPACE value. */
|
MIN_WHITESPACE value. */
|
||||||
gdb::optional<int> min_whitespace;
|
std::optional<int> min_whitespace;
|
||||||
|
|
||||||
/* The index into WS_INFO at which the processing of DOC can be
|
/* The index into WS_INFO at which the processing of DOC can be
|
||||||
considered "all done", that is, after this point there are no further
|
considered "all done", that is, after this point there are no further
|
||||||
lines with useful content and we should just stop. */
|
lines with useful content and we should just stop. */
|
||||||
gdb::optional<size_t> all_done_idx;
|
std::optional<size_t> all_done_idx;
|
||||||
|
|
||||||
/* White-space information for each line in DOC. */
|
/* White-space information for each line in DOC. */
|
||||||
std::vector<line_whitespace> ws_info;
|
std::vector<line_whitespace> ws_info;
|
||||||
|
|||||||
@@ -732,7 +732,7 @@ class gdbpy_enter
|
|||||||
|
|
||||||
/* An optional is used here because we don't want to call
|
/* An optional is used here because we don't want to call
|
||||||
PyErr_Fetch too early. */
|
PyErr_Fetch too early. */
|
||||||
gdb::optional<gdbpy_err_fetch> m_error;
|
std::optional<gdbpy_err_fetch> m_error;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Like gdbpy_enter, but takes a varobj. This is a subclass just to
|
/* Like gdbpy_enter, but takes a varobj. This is a subclass just to
|
||||||
@@ -953,7 +953,7 @@ extern gdb::unique_xmalloc_ptr<char> gdbpy_fix_doc_string_indentation
|
|||||||
|
|
||||||
If no instruction can be disassembled then return an empty value. */
|
If no instruction can be disassembled then return an empty value. */
|
||||||
|
|
||||||
extern gdb::optional<int> gdbpy_print_insn (struct gdbarch *gdbarch,
|
extern std::optional<int> gdbpy_print_insn (struct gdbarch *gdbarch,
|
||||||
CORE_ADDR address,
|
CORE_ADDR address,
|
||||||
disassemble_info *info);
|
disassemble_info *info);
|
||||||
|
|
||||||
|
|||||||
@@ -121,9 +121,9 @@ static void gdbpy_set_quit_flag (const struct extension_language_defn *);
|
|||||||
static int gdbpy_check_quit_flag (const struct extension_language_defn *);
|
static int gdbpy_check_quit_flag (const struct extension_language_defn *);
|
||||||
static enum ext_lang_rc gdbpy_before_prompt_hook
|
static enum ext_lang_rc gdbpy_before_prompt_hook
|
||||||
(const struct extension_language_defn *, const char *current_gdb_prompt);
|
(const struct extension_language_defn *, const char *current_gdb_prompt);
|
||||||
static gdb::optional<std::string> gdbpy_colorize
|
static std::optional<std::string> gdbpy_colorize
|
||||||
(const std::string &filename, const std::string &contents);
|
(const std::string &filename, const std::string &contents);
|
||||||
static gdb::optional<std::string> gdbpy_colorize_disasm
|
static std::optional<std::string> gdbpy_colorize_disasm
|
||||||
(const std::string &content, gdbarch *gdbarch);
|
(const std::string &content, gdbarch *gdbarch);
|
||||||
|
|
||||||
/* The interface between gdb proper and loading of python scripts. */
|
/* The interface between gdb proper and loading of python scripts. */
|
||||||
@@ -1191,7 +1191,7 @@ gdbpy_before_prompt_hook (const struct extension_language_defn *extlang,
|
|||||||
|
|
||||||
/* This is the extension_language_ops.colorize "method". */
|
/* This is the extension_language_ops.colorize "method". */
|
||||||
|
|
||||||
static gdb::optional<std::string>
|
static std::optional<std::string>
|
||||||
gdbpy_colorize (const std::string &filename, const std::string &contents)
|
gdbpy_colorize (const std::string &filename, const std::string &contents)
|
||||||
{
|
{
|
||||||
if (!gdb_python_initialized)
|
if (!gdb_python_initialized)
|
||||||
@@ -1268,7 +1268,7 @@ gdbpy_colorize (const std::string &filename, const std::string &contents)
|
|||||||
|
|
||||||
/* This is the extension_language_ops.colorize_disasm "method". */
|
/* This is the extension_language_ops.colorize_disasm "method". */
|
||||||
|
|
||||||
static gdb::optional<std::string>
|
static std::optional<std::string>
|
||||||
gdbpy_colorize_disasm (const std::string &content, gdbarch *gdbarch)
|
gdbpy_colorize_disasm (const std::string &content, gdbarch *gdbarch)
|
||||||
{
|
{
|
||||||
if (!gdb_python_initialized)
|
if (!gdb_python_initialized)
|
||||||
|
|||||||
@@ -685,7 +685,7 @@ ravenscar_thread_target::fetch_registers (struct regcache *regcache,
|
|||||||
struct gdbarch *gdbarch = regcache->arch ();
|
struct gdbarch *gdbarch = regcache->arch ();
|
||||||
bool is_active = task_is_currently_active (ptid);
|
bool is_active = task_is_currently_active (ptid);
|
||||||
struct ravenscar_arch_ops *arch_ops = gdbarch_ravenscar_ops (gdbarch);
|
struct ravenscar_arch_ops *arch_ops = gdbarch_ravenscar_ops (gdbarch);
|
||||||
gdb::optional<fpu_state> fp_state;
|
std::optional<fpu_state> fp_state;
|
||||||
|
|
||||||
int low_reg = regnum == -1 ? 0 : regnum;
|
int low_reg = regnum == -1 ? 0 : regnum;
|
||||||
int high_reg = regnum == -1 ? gdbarch_num_regs (gdbarch) : regnum + 1;
|
int high_reg = regnum == -1 ? gdbarch_num_regs (gdbarch) : regnum + 1;
|
||||||
@@ -731,7 +731,7 @@ ravenscar_thread_target::store_registers (struct regcache *regcache,
|
|||||||
struct gdbarch *gdbarch = regcache->arch ();
|
struct gdbarch *gdbarch = regcache->arch ();
|
||||||
bool is_active = task_is_currently_active (ptid);
|
bool is_active = task_is_currently_active (ptid);
|
||||||
struct ravenscar_arch_ops *arch_ops = gdbarch_ravenscar_ops (gdbarch);
|
struct ravenscar_arch_ops *arch_ops = gdbarch_ravenscar_ops (gdbarch);
|
||||||
gdb::optional<fpu_state> fp_state;
|
std::optional<fpu_state> fp_state;
|
||||||
|
|
||||||
int low_reg = regnum == -1 ? 0 : regnum;
|
int low_reg = regnum == -1 ? 0 : regnum;
|
||||||
int high_reg = regnum == -1 ? gdbarch_num_regs (gdbarch) : regnum + 1;
|
int high_reg = regnum == -1 ? gdbarch_num_regs (gdbarch) : regnum + 1;
|
||||||
|
|||||||
@@ -758,8 +758,8 @@ btrace_find_line_range (CORE_ADDR pc)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
btrace_print_lines (struct btrace_line_range lines, struct ui_out *uiout,
|
btrace_print_lines (struct btrace_line_range lines, struct ui_out *uiout,
|
||||||
gdb::optional<ui_out_emit_tuple> *src_and_asm_tuple,
|
std::optional<ui_out_emit_tuple> *src_and_asm_tuple,
|
||||||
gdb::optional<ui_out_emit_list> *asm_list,
|
std::optional<ui_out_emit_list> *asm_list,
|
||||||
gdb_disassembly_flags flags)
|
gdb_disassembly_flags flags)
|
||||||
{
|
{
|
||||||
print_source_lines_flags psl_flags;
|
print_source_lines_flags psl_flags;
|
||||||
@@ -798,8 +798,8 @@ btrace_insn_history (struct ui_out *uiout,
|
|||||||
|
|
||||||
ui_out_emit_list list_emitter (uiout, "asm_insns");
|
ui_out_emit_list list_emitter (uiout, "asm_insns");
|
||||||
|
|
||||||
gdb::optional<ui_out_emit_tuple> src_and_asm_tuple;
|
std::optional<ui_out_emit_tuple> src_and_asm_tuple;
|
||||||
gdb::optional<ui_out_emit_list> asm_list;
|
std::optional<ui_out_emit_list> asm_list;
|
||||||
|
|
||||||
gdb_pretty_print_disassembler disasm (gdbarch, uiout);
|
gdb_pretty_print_disassembler disasm (gdbarch, uiout);
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user