aarch64_linux_core_read_description (struct gdbarch *gdbarch,
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 hwcap2 = linux_get_hwcap2 (auxv, target, gdbarch);
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)
{
gdb::byte_vector tags;
CORE_ADDR addr = value_as_address (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));
if (!atag.has_value ())
/* Remove the top byte. */
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 ())
return nullptr;
uiout->field_core_addr ("fault-addr", gdbarch, fault_addr);
uiout->text ("\n");
- gdb::optional<CORE_ADDR> atag
+ std::optional<CORE_ADDR> atag
= aarch64_mte_get_atag (gdbarch_remove_non_address_bits (gdbarch,
fault_addr));
gdb_byte ltag = aarch64_mte_get_ltag (fault_addr);
type0->dyn_prop (DYN_PROP_BYTE_STRIDE),
type0->field (0).bitsize ());
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;
low_pos = discrete_position (base_index_type, low);
(alloc, type->target_type (), index_type,
type->dyn_prop (DYN_PROP_BYTE_STRIDE),
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);
if (!discrete_type_p (type))
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 ())
error (_("enumeration value is invalid: can't find 'POS"));
if (strcasecmp (str, item.name) == 0)
return item.code;
- gdb::optional<int> found;
+ std::optional<int> found;
for (const auto &item : attributes)
if (subseqMatch (str, item.name))
{
case TYPE_CODE_ENUM:
{
- gdb::optional<LONGEST> posn = discrete_position (type, val);
+ std::optional<LONGEST> posn = discrete_position (type, val);
if (posn.has_value ())
fputs_styled (ada_enum_name (type->field (*posn).name ()),
variable_name_style.style (), stream);
int offset_aligned = ada_aligned_value_addr (type, valaddr) - valaddr;
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 ())
{
const char *name = ada_enum_name (type->field (*posn).name ());
ULONGEST offset, ULONGEST requested_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))
return beneath ()->xfer_partial (object, annex, readbuf, writebuf, offset,
amd_dbgapi_log_message_callback (amd_dbgapi_log_level_t level,
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 ())
{
static void
annotate_thread_exited (thread_info *t,
- gdb::optional<ULONGEST> exit_code,
+ std::optional<ULONGEST> exit_code,
bool /* silent */)
{
if (annotation_level > 1)
/* See arm-fbsd-tdep.h. */
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)
{
CORE_ADDR arm_hwcap = 0;
const struct target_desc *
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,
current_inferior ()->top_target (),
current_inferior ()->arch (),
{
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);
}
AUXV. */
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,
bool tls);
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 arm_hwcap = linux_get_hwcap (auxv, target, gdbarch);
if (arm_hwcap & HWCAP_VFP)
int framereg;
/* True if the return address is signed, false otherwise. */
- gdb::optional<bool> ra_signed_state;
+ std::optional<bool> ra_signed_state;
/* Saved register offsets. */
trad_frame_saved_reg *saved_regs;
while (start < limit)
{
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);
return;
}
- gdb::optional<open_script> opened = find_and_open_script (file,
+ std::optional<open_script> opened = find_and_open_script (file,
1 /*search_path*/);
if (opened)
overhead of transfering data from a remote target to the local host. */
struct auxv_info
{
- gdb::optional<gdb::byte_vector> data;
+ std::optional<gdb::byte_vector> data;
};
/* Per-inferior data key for auxv. */
/* See auxv.h. */
-const gdb::optional<gdb::byte_vector> &
+const std::optional<gdb::byte_vector> &
target_read_auxv ()
{
inferior *inf = current_inferior ();
/* See auxv.h. */
-gdb::optional<gdb::byte_vector>
+std::optional<gdb::byte_vector>
target_read_auxv_raw (target_ops *ops)
{
return target_read_alloc (ops, TARGET_OBJECT_AUXV, NULL);
int
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 ())
return -1;
gdbarch *gdbarch = current_inferior ()->arch ();
CORE_ADDR type, val;
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 ())
return -1;
/* 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. */
-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.
unsigned int val;
/* 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_OBJECT_AVR, "avr.io_reg");
#include <algorithm>
#include "progspace-and-thread.h"
#include "gdbsupport/array-view.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
#include "gdbsupport/common-utils.h"
/* Prototypes for local functions. */
if (b->disposition == disp_del_at_next_stop)
return;
- gdb::optional<scoped_restore_selected_frame> restore_frame;
+ std::optional<scoped_restore_selected_frame> restore_frame;
/* Determine if the watchpoint is within scope. */
if (b->exp_valid_block == NULL)
static void
remove_threaded_breakpoints (thread_info *tp,
- gdb::optional<ULONGEST> /* exit_code */,
+ std::optional<ULONGEST> /* exit_code */,
int /* silent */)
{
for (breakpoint &b : all_breakpoints_safe ())
(uiout->test_flags (fix_breakpoint_script_output)
|| fix_breakpoint_script_output_globally);
- gdb::optional<ui_out_emit_tuple> tuple_emitter;
- gdb::optional<ui_out_emit_list> list_emitter;
+ std::optional<ui_out_emit_tuple> tuple_emitter;
+ std::optional<ui_out_emit_list> list_emitter;
if (use_fixed_output)
list_emitter.emplace (uiout, "script");
= (uiout->test_flags (fix_multi_location_breakpoint_output)
|| 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,
allflag, false);
|| !b->first_loc ().enabled
|| 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
MI record. For later versions, place breakpoint locations in a
string_file stb;
- gdb::optional<ui_out_emit_tuple> tuple_emitter;
+ std::optional<ui_out_emit_tuple> tuple_emitter;
switch (this->type)
{
case bp_watchpoint:
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))
{
anyway. */
if (line == 0)
{
- gdb::optional<int> last_line;
+ std::optional<int> last_line;
while (!subfile->line_vector_entries.empty ())
{
If SEARCH_PATH is non-zero, and the file isn't found in cwd,
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)
{
int fd;
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));
if (file == NULL || *file == 0)
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)
{
/* The script wasn't found, or was otherwise inaccessible.
#define CLI_CLI_CMDS_H
#include "gdbsupport/filestuff.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
#include "completer.h"
/* Chain containing all defined commands. */
}
};
-extern gdb::optional<open_script>
+extern std::optional<open_script>
find_and_open_script (const char *file, int search_path);
/* Command tracing state. */
#include "cli/cli-cmds.h"
#include "cli/cli-decode.h"
#include "cli/cli-style.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
/* Prototypes for local functions. */
{
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)
restore_suppress.emplace (cmd->suppress_notification, true);
void (*destroyer) (struct cmd_list_element *self, void *context) = nullptr;
/* 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
argv). */
void *ctx;
/* The option's value, if any. */
- gdb::optional<option_value> value;
+ std::optional<option_value> value;
/* Constructor. */
option_def_and_value (const option_def &option_, void *ctx_,
- gdb::optional<option_value> &&value_ = {})
+ std::optional<option_value> &&value_ = {})
: option (option_),
ctx (ctx_),
value (std::move (value_))
allocated on the heap, so we must clear the pointer in the
source, to avoid a double free. */
static void clear_value (const option_def &option,
- gdb::optional<option_value> &value)
+ std::optional<option_value> &value)
{
if (value.has_value ())
{
}
};
-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. */
struct parse_option_completion_info
/* Parse ARGS, guided by OPTIONS_GROUP. HAVE_DELIMITER is true if the
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,
process_options_mode mode,
bool have_delimiter,
}
else if (**args == '-')
{
- gdb::optional<option_def_and_value> ov
+ std::optional<option_def_and_value> ov
= parse_option (options_group, mode, have_delimiter,
args, &completion_info);
if (!ov && !tracker.have_completions ())
/* Save the parsed value in the option's context. */
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)
{
#ifndef CLI_OPTION_H
#define CLI_OPTION_H 1
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
#include "gdbsupport/array-view.h"
#include "completer.h"
#include <string>
LONGEST use;
/* 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.
#include "osabi.h"
#include "gdbsupport/gdb_wait.h"
#include "valprint.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
#include "gdbsupport/gdb_unlinker.h"
#include "gdbsupport/pathstuff.h"
#include "gdbsupport/scoped_ignore_signal.h"
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");
const std::string &allargs,
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;
if (startup_with_shell && may_have_sip ())
#include <errno.h>
#include "gdbsupport/scoped_fd.h"
#include "debuginfod-support.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
#include "cli/cli-cmds.h"
#include "cli/cli-style.h"
#include "cli-out.h"
char *dname = nullptr;
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);
char *dname = nullptr;
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);
char *dname = nullptr;
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);
char *dname = nullptr;
std::string desc = std::string ("section ") + section_name + " for";
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);
#include "source.h"
#include "gdbsupport/gdb-safe-ctype.h"
#include <algorithm>
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
#include "valprint.h"
#include "cli/cli-style.h"
#include "objfiles.h"
ui_out_emit_list asm_insns_list (uiout, "asm_insns");
- gdb::optional<ui_out_emit_tuple> outer_tuple_emitter;
- gdb::optional<ui_out_emit_list> inner_list_emitter;
+ std::optional<ui_out_emit_tuple> outer_tuple_emitter;
+ std::optional<ui_out_emit_list> inner_list_emitter;
for (i = 0; i < newlines; i++)
{
ui_out_emit_list asm_insns_emitter (uiout, "asm_insns");
- gdb::optional<ui_out_emit_tuple> tuple_emitter;
- gdb::optional<ui_out_emit_list> list_emitter;
+ std::optional<ui_out_emit_tuple> tuple_emitter;
+ std::optional<ui_out_emit_list> list_emitter;
last_symtab = NULL;
last_line = 0;
struct disassemble_info *info)
{
/* 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 ())
return *length;
this output. */
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 ());
if (ext_contents.has_value ())
m_buffer = std::move (*ext_contents);
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
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. */
ui_file *m_dest;
#include "dwarf2.h"
#include "dwarf2/types.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
/* Blocks are a bunch of untyped bytes. */
struct dwarf_block
#include "buildsym.h"
#include "dwarf2/comp-unit-head.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
#include "language.h"
/* Type used for delaying computation of method physnames.
struct comp_unit_head header;
/* Base address of this compilation unit. */
- gdb::optional<unrelocated_addr> base_address;
+ std::optional<unrelocated_addr> base_address;
/* The language we are debugging. */
const struct language_defn *language_defn = nullptr;
/* 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. */
- gdb::optional<ULONGEST> addr_base;
+ std::optional<ULONGEST> addr_base;
/* The DW_AT_GNU_ranges_base attribute, if present.
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
.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. */
bool m_mark : 1;
/* Return the address base of the compile unit, which, if exists, is
stored either at the attribute DW_AT_GNU_addr_base, or
DW_AT_addr_base. */
- gdb::optional<ULONGEST> addr_base ()
+ std::optional<ULONGEST> addr_base ()
{
for (unsigned i = 0; i < num_attrs; ++i)
if (attrs[i].name == DW_AT_addr_base
complaint (_("address base attribute (offset %s) as wrong form"),
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,
std::string build_id_str;
/* 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. */
FILENAME_TEMP is unlinked, because on MS-Windows one cannot
delete a file that is still open. So, we wrap the unlinker in an
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;
};
? INDEX5_SUFFIX : INDEX4_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)
dwz_index_wip.emplace (dir, dwz_basename, index_suffix);
ULONGEST form = read_unsigned_leb128 (abfd, format, &bytes_read);
format += bytes_read;
- gdb::optional<const char *> string;
- gdb::optional<unsigned int> uint;
+ std::optional<const char *> string;
+ std::optional<unsigned int> uint;
switch (form)
{
unsigned int offset_size,
struct dwarf2_section_info *str_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)
{
struct objfile *objfile = per_objfile->objfile;
const struct line_header *lh, unsigned int offset_size,
unsigned int offset, struct dwarf2_section_info *str_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)
{
bfd *abfd;
unsigned int offset,
dwarf2_section_info *str_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);
#endif /* GDB_DWARF2_MACRO_H */
dwarf2_per_objfile *per_objfile;
/* If set, only look for symbols that match that block. Valid values are
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. */
domain_enum domain;
/* The list of CUs from the index entry of the symbol,
static void
dw2_symtab_iter_init (struct dw2_symtab_iterator *iter,
dwarf2_per_objfile *per_objfile,
- gdb::optional<block_enum> block_index,
+ std::optional<block_enum> block_index,
domain_enum domain, offset_type namei,
mapped_gdb_index &index)
{
#include "build-id.h"
#include "namespace.h"
#include "gdbsupport/function-view.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
#include "gdbsupport/underlying.h"
#include "gdbsupport/hash_enum.h"
#include "filename-seen-cache.h"
/* 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
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)
{
if (cu->header.version >= 5)
struct attribute *attr;
attr = dwarf2_attr (comp_unit_die, DW_AT_GNU_dwo_id, cu);
if (attr == nullptr || !attr->form_is_unsigned ())
- return gdb::optional<ULONGEST> ();
+ return std::optional<ULONGEST> ();
return attr->as_unsigned ();
}
dwo_unit = lookup_dwo_type_unit (cu, dwo_name, comp_dir);
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 ())
error (_("Dwarf Error: missing dwo_id for dwo_name %s"
sect_offset sect_off = cu->per_cu->sect_off;
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 ())
{
complaint (_("Dwarf Error: debug entry at offset %s is missing"
struct objfile *objfile = per_objfile->objfile;
bfd *obfd = objfile->obfd.get ();
/* Base address selection entry. */
- gdb::optional<unrelocated_addr> base;
+ std::optional<unrelocated_addr> base;
const gdb_byte *buffer;
bool overflow = false;
ULONGEST addr_index;
unsigned int addr_size = cu_header->addr_size;
CORE_ADDR mask = ~(~(CORE_ADDR)1 << (addr_size * 8 - 1));
/* Base address selection entry. */
- gdb::optional<unrelocated_addr> base;
+ std::optional<unrelocated_addr> base;
unsigned int dummy;
const gdb_byte *buffer;
bool is_declaration = false;
sect_offset origin_offset {};
- gdb::optional<unrelocated_addr> low_pc;
- gdb::optional<unrelocated_addr> high_pc;
+ std::optional<unrelocated_addr> low_pc;
+ std::optional<unrelocated_addr> high_pc;
bool high_pc_relative = false;
for (int i = 0; i < abbrev->num_attrs; ++i)
static unrelocated_addr
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;
bfd *abfd = objfile->obfd.get ();
unsigned int addr_index)
{
struct dwarf2_cu *cu = per_objfile->get_cu (per_cu);
- gdb::optional<ULONGEST> addr_base;
+ std::optional<ULONGEST> addr_base;
int addr_size;
/* We need addr_base and addr_size.
struct dwarf2_section_info *str_offsets_section;
struct dwarf2_section_info *str_section;
- gdb::optional<ULONGEST> str_offsets_base;
+ std::optional<ULONGEST> str_offsets_base;
if (cu->dwo_unit != nullptr)
{
/* The shared '.dwz' file, if one exists. This is used when the
original data was compressed using 'dwz -m'. */
- gdb::optional<std::unique_ptr<struct dwz_file>> dwz_file;
+ std::optional<std::unique_ptr<struct dwz_file>> dwz_file;
/* Whether copy relocations are supported by this object format. */
bool can_copy;
dwarf2_cu *sym_cu = nullptr;
/* CUs that are queued to be read. */
- gdb::optional<std::queue<dwarf2_queue_item>> queue;
+ std::optional<std::queue<dwarf2_queue_item>> queue;
private:
/* Hold the corresponding compunit_symtab for each CU or TU. This
struct value *
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
&& language_defn->la_language == language_cplus
&& !thread_stack_temporaries_enabled_p (inferior_thread ()))
gdb_rl_deprep_term_function (void)
{
#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))
{
#include "serial.h"
#include "gdbthread.h"
#include "ui.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
static void
print_flush (void)
if (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 ())
{
term_state.emplace ();
CONTENTS is the contents of the file. This should either return
colorized (using ANSI terminal escapes) version of the contents,
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);
/* Colorize a single line of disassembler output, CONTENT. This should
either return colorized (using ANSI terminal escapes) version of the
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);
/* Print a single instruction from ADDRESS in architecture GDBARCH. INFO
If no instruction can be disassembled then return an empty value and
other extension languages will get a chance to perform the
disassembly. */
- gdb::optional<int> (*print_insn) (struct gdbarch *gdbarch,
+ std::optional<int> (*print_insn) (struct gdbarch *gdbarch,
CORE_ADDR address,
struct disassemble_info *info);
/* See extension.h. */
-gdb::optional<std::string>
+std::optional<std::string>
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)
{
/* See extension.h. */
-gdb::optional<std::string>
+std::optional<std::string>
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)
{
/* See extension.h. */
-gdb::optional<int>
+std::optional<int>
ext_lang_print_insn (struct gdbarch *gdbarch, CORE_ADDR address,
struct disassemble_info *info)
{
if (extlang->ops == nullptr
|| extlang->ops->print_insn == nullptr)
continue;
- gdb::optional<int> length
+ std::optional<int> length
= extlang->ops->print_insn (gdbarch, address, info);
if (length.has_value ())
return length;
#include "mi/mi-cmds.h"
#include "gdbsupport/array-view.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
struct breakpoint;
struct command_line;
either a colorized (using ANSI terminal escapes) version of the
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);
/* Try to colorize a single line of disassembler output, CONTENT for
escapes) version of CONTENT, or an empty value if colorizing could not
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);
/* Calls extension_language_ops::print_insn for each extension language,
All arguments are forwarded to extension_language_ops::print_insn, see
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);
/* When GDB calls into an extension language because an objfile was
/* Set and reset to handle removing intermediate values from the
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
/* 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)
{
for (auto it = m_pending_events.begin (); it != m_pending_events.end (); it++)
target_options_to_string (target_options).c_str ());
/* 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 ())
{
/* Stop any other inferiors currently running. */
while (1)
{
- gdb::optional<pending_event> event = take_pending_event (ptid);
+ std::optional<pending_event> event = take_pending_event (ptid);
if (!event.has_value ())
break;
#ifndef FBSD_NAT_H
#define FBSD_NAT_H
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
#include "inf-ptrace.h"
#include "regcache.h"
#include "regset.h"
FILTER. If there is a matching event, the event is removed from
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. */
the data is prefixed with a 32-bit integer size to match the format
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)
{
- gdb::optional<gdb::byte_vector> buf =
+ std::optional<gdb::byte_vector> buf =
target_read_alloc (current_inferior ()->top_target (), object, NULL);
if (!buf || buf->empty ())
return {};
/* Auxiliary vector. */
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);
if (note_desc && !note_desc->empty ())
{
else
{
/* 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_OBJECT_FREEBSD_VMMAP, nullptr);
if (!buf || buf->empty ())
- If the thread is running, then this field has its value removed by
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
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. */
available. If SILENT, then don't inform the CLI about the
exit. */
extern void set_thread_exited (thread_info *tp,
- gdb::optional<ULONGEST> exit_code = {},
+ std::optional<ULONGEST> exit_code = {},
bool silent = false);
/* Delete a step_resume_breakpoint from the thread database. */
exception if !FLAGS.SILENT and !FLAGS.CONT and CMD fails. */
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 qcs_flags &flags);
/* See gdbtypes.h. */
-gdb::optional<LONGEST>
+std::optional<LONGEST>
get_discrete_low_bound (struct type *type)
{
type = check_typedef (type);
if (type->target_type ()->code () == TYPE_CODE_ENUM)
{
- gdb::optional<LONGEST> low_pos
+ std::optional<LONGEST> low_pos
= discrete_position (type->target_type (), low);
if (low_pos.has_value ())
/* See gdbtypes.h. */
-gdb::optional<LONGEST>
+std::optional<LONGEST>
get_discrete_high_bound (struct type *type)
{
type = check_typedef (type);
if (type->target_type ()->code () == TYPE_CODE_ENUM)
{
- gdb::optional<LONGEST> high_pos
+ std::optional<LONGEST> high_pos
= discrete_position (type->target_type (), high);
if (high_pos.has_value ())
bool
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 ())
return false;
- gdb::optional<LONGEST> high = get_discrete_high_bound (type);
+ std::optional<LONGEST> high = get_discrete_high_bound (type);
if (!high.has_value ())
return false;
in which case the value of POS is unmodified.
*/
-gdb::optional<LONGEST>
+std::optional<LONGEST>
discrete_position (struct type *type, LONGEST val)
{
if (type->code () == TYPE_CODE_RANGE)
std::vector<bool> &flags)
{
/* Evaluate the discriminant. */
- gdb::optional<ULONGEST> discr_value;
+ std::optional<ULONGEST> discr_value;
if (part.discriminant_index != -1)
{
int idx = part.discriminant_index;
if (!is_dynamic_type_internal (real_type, top_level))
return type;
- gdb::optional<CORE_ADDR> type_length;
+ std::optional<CORE_ADDR> type_length;
prop = TYPE_DYNAMIC_LENGTH (type);
if (prop != NULL
&& dwarf2_evaluate_property (prop, frame, addr_stack, &value))
#include "hashtab.h"
#include "gdbsupport/array-view.h"
#include "gdbsupport/gdb-hashtab.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
#include "gdbsupport/offset-type.h"
#include "gdbsupport/enum-flags.h"
#include "gdbsupport/underlying.h"
/* 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. */
-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
and lower bound. Save the low bound into LOW_BOUND if not NULL.
extern bool get_array_bounds (struct type *type, LONGEST *low_bound,
LONGEST *high_bound);
-extern gdb::optional<LONGEST> discrete_position (struct type *type,
+extern std::optional<LONGEST> discrete_position (struct type *type,
LONGEST val);
extern int class_types_same_p (const struct type *, const struct type *);
#include "ui.h"
#include "target.h"
#include "guile-internal.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
#ifdef HAVE_POLL
#if defined (HAVE_POLL_H)
? &gdb_stderr : &gdb_stdout);
{
- gdb::optional<ui_out_redirect_pop> redirect_popper;
+ std::optional<ui_out_redirect_pop> redirect_popper;
if (oport == GDB_STDERR)
gdb_stderr = port_file.get ();
else
};
static struct ia64_table_entry *ktab = NULL;
-static gdb::optional<gdb::byte_vector> ktab_buf;
+static std::optional<gdb::byte_vector> ktab_buf;
#endif
}
/* Call low-level function to access the kernel unwind table. */
-static gdb::optional<gdb::byte_vector>
+static std::optional<gdb::byte_vector>
getunwind_table ()
{
/* FIXME drow/2005-09-10: This code used to call
/* Implementation of to_fileio_readlink. */
-gdb::optional<std::string>
+std::optional<std::string>
inf_child_target::fileio_readlink (struct inferior *inf, const char *filename,
fileio_error *target_errno)
{
int fileio_unlink (struct inferior *inf,
const char *filename,
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,
fileio_error *target_errno) override;
bool use_agent (bool use) override;
#include "ui.h"
#include "interps.h"
#include "skip.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
#include "source.h"
#include "cli/cli-style.h"
#include "dwarf2/loc.h"
enum attach_post_wait_mode mode
= 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)
restore_thread.emplace ();
/* See regcache.h. */
-gdb::optional<scoped_restore_current_thread>
+std::optional<scoped_restore_current_thread>
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 ())
{
maybe_restore_thread.emplace ();
If the current inferior was changed, return an RAII object that will
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);
/* Info about an inferior's target description. There's one of these
we save our handlers in these two variables and set SIGINT and SIGQUIT
to SIG_IGN. */
-static gdb::optional<sighandler_t> sigint_ours;
+static std::optional<sighandler_t> sigint_ours;
#ifdef SIGQUIT
-static gdb::optional<sighandler_t> sigquit_ours;
+static std::optional<sighandler_t> sigquit_ours;
#endif
/* The name of the tty (from the `tty' command) that we're giving to
#include "thread-fsm.h"
#include "gdbsupport/enum-flags.h"
#include "progspace-and-thread.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
#include "arch-utils.h"
#include "gdbsupport/scope-exit.h"
#include "gdbsupport/forward-scope-exit.h"
{
/* If FOLLOW_CHILD, we leave CHILD_INF 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)
maybe_restore.emplace ();
debugging. If we're looking at traceframes while the target is
running, we're going to need to get back to that mode after
handling the event. */
- gdb::optional<scoped_restore_current_traceframe> maybe_restore_traceframe;
+ std::optional<scoped_restore_current_traceframe> maybe_restore_traceframe;
if (non_stop)
{
maybe_restore_traceframe.emplace ();
|| (target_is_non_stop_p ()
&& 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 ())
restore_operation_disable.emplace
decr_pc = gdbarch_decr_pc_after_break (gdbarch);
if (decr_pc != 0)
{
- gdb::optional<scoped_restore_tmpl<int>>
+ std::optional<scoped_restore_tmpl<int>>
restore_operation_disable;
if (record_full_is_used ())
&& last.kind () != TARGET_WAITKIND_THREAD_EXITED)
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)
{
maybe_finish_thread_state.emplace
void
interps_notify_thread_exited (thread_info *t,
- gdb::optional<ULONGEST> exit_code,
+ std::optional<ULONGEST> exit_code,
int silent)
{
interps_notify (&interp::on_thread_exited, t, exit_code, silent);
/* Notify the interpreter that thread T has exited. */
virtual void on_thread_exited (thread_info *,
- gdb::optional<ULONGEST> exit_code,
+ std::optional<ULONGEST> exit_code,
int silent) {}
/* Notify the interpreter that inferior INF was added. */
/* Notify all interpreters that thread T has exited. */
extern void interps_notify_thread_exited (thread_info *t,
- gdb::optional<ULONGEST> exit_code,
+ std::optional<ULONGEST> exit_code,
int silent);
/* Notify all interpreters that inferior INF was added. */
inferior *inf = current_inferior ();
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. */
for (objfile *obj : inf->pspace->objfiles ())
/* If LP has a pending fork/vfork/clone status, return it. */
-static gdb::optional<target_waitstatus>
+static std::optional<target_waitstatus>
get_pending_child_status (lwp_info *lp)
{
LINUX_NAT_SCOPED_DEBUG_ENTER_EXIT;
event, there is a process/thread GDB is attached to that the core
of GDB doesn't know about. Detach from it. */
- gdb::optional<target_waitstatus> ws = get_pending_child_status (lp);
+ std::optional<target_waitstatus> ws = get_pending_child_status (lp);
if (ws.has_value ())
detach_one_pid (ws->child_ptid ().lwp (), 0);
static int
kill_unfollowed_child_callback (lwp_info *lp)
{
- gdb::optional<target_waitstatus> ws = get_pending_child_status (lp);
+ std::optional<target_waitstatus> ws = get_pending_child_status (lp);
if (ws.has_value ())
{
ptid_t child_ptid = ws->child_ptid ();
static bool
proc_mem_file_is_writable ()
{
- static gdb::optional<bool> writable;
+ static std::optional<bool> writable;
if (writable.has_value ())
return *writable;
/* Implementation of to_fileio_readlink. */
-gdb::optional<std::string>
+std::optional<std::string>
linux_nat_target::fileio_readlink (struct inferior *inf, const char *filename,
fileio_error *target_errno)
{
int flags, int mode, int warn_if_slow,
fileio_error *target_errno) override;
- gdb::optional<std::string>
+ std::optional<std::string>
fileio_readlink (struct inferior *inf,
const char *filename,
fileio_error *target_errno) override;
#include "gdbcmd.h"
#include "gdbsupport/gdb_regex.h"
#include "gdbsupport/enum-flags.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
#include "gcore.h"
#include "gcore-elf.h"
#include "solib-svr4.h"
int vsyscall_range_p = 0;
/* 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. */
static int
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;
if (!init_regex_p)
if (cwd_f)
{
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);
if (contents.has_value ())
gdb_printf ("cwd = '%s'\n", contents->c_str ());
if (exe_f)
{
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);
if (contents.has_value ())
gdb_printf ("exe = '%s'\n", contents->c_str ());
return NULL;
/* Auxillary vector. */
- gdb::optional<gdb::byte_vector> auxv =
+ std::optional<gdb::byte_vector> auxv =
target_read_alloc (current_inferior ()->top_target (),
TARGET_OBJECT_AUXV, NULL);
if (auxv && !auxv->empty ())
/* Helper for linux_get_hwcap and linux_get_hwcap2. */
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)
{
CORE_ADDR field;
/* See linux-tdep.h. */
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)
{
return linux_get_hwcap_helper (auxv, target, gdbarch, AT_HWCAP);
/* See linux-tdep.h. */
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)
{
return linux_get_hwcap_helper (auxv, target, gdbarch, AT_HWCAP2);
parse auxv entries.
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);
/* Same as the above, but obtain all the inputs from the current inferior. */
parse auxv entries.
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);
/* Same as the above, but obtain all the inputs from the current inferior. */
/* Cached thread state. */
td_thrhandle_t th {};
thread_t tid {};
- gdb::optional<gdb::byte_vector> thread_handle;
+ std::optional<gdb::byte_vector> thread_handle;
};
static thread_db_thread_info *
{
/* Cache the file lookup object so we only actually search for the files
once. */
- static gdb::optional<gdb_initfile_finder> init_files;
+ static std::optional<gdb_initfile_finder> init_files;
if (!init_files.has_value ())
init_files.emplace (GDBINIT, SYSTEM_GDBINIT, SYSTEM_GDBINIT_RELOCATABLE,
SYSTEM_GDBINIT_DIR, SYSTEM_GDBINIT_DIR_RELOCATABLE,
{
/* Cache the file lookup object so we only actually search for the files
once. */
- static gdb::optional<gdb_initfile_finder> init_files;
+ static std::optional<gdb_initfile_finder> init_files;
if (!init_files.has_value ())
init_files.emplace (GDBEARLYINIT, nullptr, false, nullptr, false, false);
#include "extension.h"
#include <ctype.h>
#include "mi-parse.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
#include "gdbsupport/gdb-safe-ctype.h"
#include "inferior.h"
#include "observable.h"
arg->val->type ()->length ()))))
return;
- gdb::optional<ui_out_emit_tuple> tuple_emitter;
+ std::optional<ui_out_emit_tuple> tuple_emitter;
if (values != PRINT_NO_VALUES || what == all)
tuple_emitter.emplace (uiout, nullptr);
#include "mi-getopt.h"
#include "gdbthread.h"
#include "mi-parse.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
#include "inferior.h"
static void varobj_update_one (struct varobj *var,
/* See mi-cmds.h. */
-gdb::optional<scoped_restore_tmpl<int>>
+std::optional<scoped_restore_tmpl<int>>
mi_command::do_suppress_notification () const
{
if (m_suppress_notification != nullptr)
#define MI_MI_CMDS_H
#include "gdbsupport/function-view.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
#include "mi/mi-main.h"
enum print_values {
/* If this command was created with a suppress notifications pointer,
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.
If this command was created without a suppress notifications points,
- then this function returns an empty gdb::optional. */
- gdb::optional<scoped_restore_tmpl<int>> do_suppress_notification () const;
+ then this function returns an empty std::optional. */
+ std::optional<scoped_restore_tmpl<int>> do_suppress_notification () const;
private:
void
mi_interp::on_thread_exited (thread_info *t,
- gdb::optional<ULONGEST> /* exit_code */,
+ std::optional<ULONGEST> /* exit_code */,
int /* silent */)
{
target_terminal::scoped_restore_terminal_state term_state;
void on_command_error () override;
void on_user_selected_context_changed (user_selected_what selection) 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;
void on_inferior_added (inferior *inf) override;
void on_inferior_appeared (inferior *inf) override;
#include "extension.h"
#include "gdbcmd.h"
#include "observable.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
#include "gdbsupport/byte-vector.h"
#include <ctype.h>
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)
{
thread_info *tp = find_thread_global_id (parse->thread);
switch_to_thread (tp);
}
- gdb::optional<scoped_restore_selected_frame> frame_saver;
+ std::optional<scoped_restore_selected_frame> frame_saver;
if (parse->frame != -1)
{
frame_info_ptr fid;
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)
{
lang_saver.emplace ();
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->invoke (parse);
else
val = expr->evaluate ();
- gdb::optional<ui_out_emit_tuple> tuple_emitter;
+ std::optional<ui_out_emit_tuple> tuple_emitter;
if (values != PRINT_NO_VALUES)
tuple_emitter.emplace (uiout, nullptr);
uiout->field_string ("name", expression);
sprintf (filename, "/proc/%lld/task/%lld/stat",
(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 ())
return -1;
/* 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 ()
{
- gdb::optional<std::string> possible
+ std::optional<std::string> possible
= read_text_file_to_string ("/sys/devices/system/cpu/possible");
if (!possible.has_value ())
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
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 ())
return *count;
/* See nat/windows-nat.h. */
-gdb::optional<pending_stop>
+std::optional<pending_stop>
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 ();
iter != pending_stops.end ();
++iter)
InitializeProcThreadAttributeList (info_ex.lpAttributeList,
1, 0, &size);
- gdb::optional<BOOL> return_value;
+ std::optional<BOOL> return_value;
DWORD attr_flags = relocate_aslr_flags;
if (!UpdateProcThreadAttribute (info_ex.lpAttributeList, 0,
mitigation_policy,
#include <psapi.h>
#include <vector>
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
#include "target/waitstatus.h"
#define STATUS_WX86_BREAKPOINT 0x4000001F
remove it from the list of pending stops, set 'current_event', and
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);
removing the thread from its tables without wanting to notify the
CLI about it. */
extern observable<thread_info */* t */,
- gdb::optional<ULONGEST> /* exit_code */,
+ std::optional<ULONGEST> /* exit_code */,
bool /* silent */> thread_exit;
/* An explicit stop request was issued to PTID. If PTID equals
get_osdata (const char *type)
{
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)
{
#include "objfiles.h"
#include "user-regs.h"
#include <algorithm>
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
#include "c-exp.h"
static unsigned int expressiondebug = 0;
expression_up
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)
{
lang_saver.emplace ();
};
/* 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
valid if we determined that the interface is HWDEBUG. */
/* The watchpoint value that GDB requested for this process.
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
if (vsx)
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);
features.isa205 = ppc_linux_has_isa205 (hwcap);
/* 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
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);
#include "gdbsupport/format.h"
#include "source.h"
#include "gdbsupport/byte-vector.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
#include "gdbsupport/gdb-safe-ctype.h"
#include "gdbsupport/rsp-low.h"
#include "inferior.h"
/* Some cases below will unpack the value again. In the biased
range case, we want to avoid this, so we store the unpacked value
here for possible use later. */
- gdb::optional<LONGEST> val_long;
+ std::optional<LONGEST> val_long;
if ((is_fixed_point_type (type)
&& (options->format == 'o'
|| options->format == 'x'
struct type *wctype = lookup_typename (current_language,
"wchar_t", NULL, 0);
int wcwidth = wctype->length ();
- gdb::optional<gdb::byte_vector> tem_str;
+ std::optional<gdb::byte_vector> tem_str;
if (value->lval () == lval_internalvar
&& c_is_string_type_p (value->type ()))
#include "location.h"
#include <ctype.h>
#include <algorithm>
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
/* Class that implements the static probe methods for "any" probe. */
const std::string &probe_name, const static_probe_ops *spops)
{
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 ())
prov_pat.emplace (provider.c_str (), REG_NOSUB,
static bool ignore_probes_p = false;
static bool ignore_probes_idx = 0;
static bool ignore_probes_verbose_p;
-static gdb::optional<compiled_regex> ignore_probes_prov_pat[2];
-static gdb::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_prov_pat[2];
+static std::optional<compiled_regex> ignore_probes_name_pat[2];
+static std::optional<compiled_regex> ignore_probes_obj_pat[2];
/* See comments in probe.h. */
if (!ignore_probes_p)
return false;
- gdb::optional<compiled_regex> &re_prov
+ std::optional<compiled_regex> &re_prov
= 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];
- gdb::optional<compiled_regex> &re_obj
+ std::optional<compiled_regex> &re_obj
= ignore_probes_obj_pat[ignore_probes_idx];
bool res
/* Parse the regular expressions, making sure that the old regular
expressions are still valid if an exception is throw. */
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];
- gdb::optional<compiled_regex> &re_name
+ std::optional<compiled_regex> &re_name
= 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];
re_prov.reset ();
re_name.reset ();
proc_iterate_over_threads (pi, procfs_corefile_thread_callback,
&thread_args);
- gdb::optional<gdb::byte_vector> auxv =
+ std::optional<gdb::byte_vector> auxv =
target_read_alloc (current_inferior ()->top_target (),
TARGET_OBJECT_AUXV, NULL);
if (auxv && !auxv->empty ())
for (partial_symtab *ps : partial_symbols (objfile))
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)
psym_lookup_name = lookup_name->make_ignore_params ();
/* The obstack where allocations are made. This is lazily allocated
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
/* 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 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 the content of the disassembler as a string. The contents are
/* When the user indicates that a memory error has occurred then the
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
memory source object then a pointer to the object is placed in here,
/* Store a single exception. This is used to pass Python exceptions back
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
/* See python-internal.h. */
-gdb::optional<int>
+std::optional<int>
gdbpy_print_insn (struct gdbarch *gdbarch, CORE_ADDR memaddr,
disassemble_info *info)
{
addr = disasm_info->address;
info->memory_error_func (-1, addr, info);
- return gdb::optional<int> (-1);
+ return std::optional<int> (-1);
}
else if (PyErr_ExceptionMatches (gdbpy_gdberror_exc))
{
gdb::unique_xmalloc_ptr<char> msg = err.to_string ();
info->fprintf_func (info->stream, "%s", msg.get ());
- return gdb::optional<int> (-1);
+ return std::optional<int> (-1);
}
else
{
gdbpy_print_stack ();
- return gdb::optional<int> (-1);
+ return std::optional<int> (-1);
}
}
PyErr_SetString (PyExc_TypeError,
_("Result is not a DisassemblerResult."));
gdbpy_print_stack ();
- return gdb::optional<int> (-1);
+ return std::optional<int> (-1);
}
/* The result from the Python disassembler has the correct type. Convert
(PyExc_ValueError,
_("Invalid length attribute: length must be greater than 0."));
gdbpy_print_stack ();
- return gdb::optional<int> (-1);
+ return std::optional<int> (-1);
}
if (length > max_insn_length)
{
_("Invalid length attribute: length %d greater than architecture maximum of %d"),
length, max_insn_length);
gdbpy_print_stack ();
- return gdb::optional<int> (-1);
+ return std::optional<int> (-1);
}
/* It is impossible to create a DisassemblerResult object with an empty
}
}
- return gdb::optional<int> (length);
+ return std::optional<int> (length);
}
/* The tp_dealloc callback for the DisassemblerResult type. Takes care of
#include "demangle.h"
#include "mi/mi-cmds.h"
#include "python-internal.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
#include "cli/cli-style.h"
enum mi_print_types
else
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
one element in each item in the list, do not start a tuple. The
struct symbol *sym;
const struct block *sym_block;
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));
if (item == NULL)
get_user_print_options (&opts);
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);
if (!out->is_mi_like_p () && user_frame_info_print_what.has_value ())
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
wrapping frame attribute. */
static void
delete_thread_object (thread_info *tp,
- gdb::optional<ULONGEST> /* exit_code */,
+ std::optional<ULONGEST> /* exit_code */,
bool /* silent */)
{
if (!gdb_python_initialized)
/* If an error occurred, this holds the exception information for
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. */
object_desc ¤t ()
(user left a single stray space at the start of an otherwise blank
line), we don't consider lines without content when updating the
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
considered "all done", that is, after this point there are no further
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. */
std::vector<line_whitespace> ws_info;
/* An optional is used here because we don't want to call
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
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,
disassemble_info *info);
static int gdbpy_check_quit_flag (const struct extension_language_defn *);
static enum ext_lang_rc gdbpy_before_prompt_hook
(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);
-static gdb::optional<std::string> gdbpy_colorize_disasm
+static std::optional<std::string> gdbpy_colorize_disasm
(const std::string &content, gdbarch *gdbarch);
static ext_lang_missing_debuginfo_result gdbpy_handle_missing_debuginfo
(const struct extension_language_defn *extlang, struct objfile *objfile);
/* 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)
{
if (!gdb_python_initialized)
/* 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)
{
if (!gdb_python_initialized)
struct gdbarch *gdbarch = regcache->arch ();
bool is_active = task_is_currently_active (ptid);
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 high_reg = regnum == -1 ? gdbarch_num_regs (gdbarch) : regnum + 1;
struct gdbarch *gdbarch = regcache->arch ();
bool is_active = task_is_currently_active (ptid);
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 high_reg = regnum == -1 ? gdbarch_num_regs (gdbarch) : regnum + 1;
static void
btrace_print_lines (struct btrace_line_range lines, struct ui_out *uiout,
- gdb::optional<ui_out_emit_tuple> *src_and_asm_tuple,
- gdb::optional<ui_out_emit_list> *asm_list,
+ std::optional<ui_out_emit_tuple> *src_and_asm_tuple,
+ std::optional<ui_out_emit_list> *asm_list,
gdb_disassembly_flags flags)
{
print_source_lines_flags psl_flags;
ui_out_emit_list list_emitter (uiout, "asm_insns");
- gdb::optional<ui_out_emit_tuple> src_and_asm_tuple;
- gdb::optional<ui_out_emit_list> asm_list;
+ std::optional<ui_out_emit_tuple> src_and_asm_tuple;
+ std::optional<ui_out_emit_list> asm_list;
gdb_pretty_print_disassembler disasm (gdbarch, uiout);
if (get_register_status (regnum) == REG_UNKNOWN)
{
- gdb::optional<scoped_restore_current_thread> maybe_restore_thread
+ std::optional<scoped_restore_current_thread> maybe_restore_thread
= maybe_switch_inferior (m_inf_for_target_calls);
target_fetch_registers (this, regnum);
m_descr->sizeof_register[regnum]) == 0))
return;
- gdb::optional<scoped_restore_current_thread> maybe_restore_thread
+ std::optional<scoped_restore_current_thread> maybe_restore_thread
= maybe_switch_inferior (m_inf_for_target_calls);
target_prepare_to_store (this);
const char *filename,
fileio_error *target_errno) override;
- gdb::optional<std::string>
+ std::optional<std::string>
fileio_readlink (struct inferior *inf,
const char *filename,
fileio_error *target_errno) override;
#if defined(HAVE_LIBEXPAT)
if (m_features.packet_support (PACKET_qXfer_threads) == PACKET_ENABLE)
{
- gdb::optional<gdb::char_vector> xml
+ std::optional<gdb::char_vector> xml
= target_read_stralloc (this, TARGET_OBJECT_THREADS, NULL);
if (xml && (*xml)[0] != '\0')
remote_target::memory_map ()
{
std::vector<mem_region> result;
- gdb::optional<gdb::char_vector> text
+ std::optional<gdb::char_vector> text
= target_read_stralloc (current_inferior ()->top_target (),
TARGET_OBJECT_MEMORY_MAP, NULL);
/* Implementation of to_fileio_readlink. */
-gdb::optional<std::string>
+std::optional<std::string>
remote_target::fileio_readlink (struct inferior *inf, const char *filename,
fileio_error *remote_errno)
{
traceframe_info_up
remote_target::traceframe_info ()
{
- gdb::optional<gdb::char_vector> text
+ std::optional<gdb::char_vector> text
= target_read_stralloc (current_inferior ()->top_target (),
TARGET_OBJECT_TRACEFRAME_INFO,
NULL);
scoped_restore_current_thread restore_thread;
switch_to_thread (tp);
- gdb::optional<gdb::char_vector> xml
+ std::optional<gdb::char_vector> xml
= target_read_stralloc (current_inferior ()->top_target (),
TARGET_OBJECT_BTRACE_CONF, "");
if (xml)
(unsigned int) type);
}
- gdb::optional<gdb::char_vector> xml
+ std::optional<gdb::char_vector> xml
= target_read_stralloc (current_inferior ()->top_target (),
TARGET_OBJECT_BTRACE, annex);
if (!xml)
const char *
remote_target::pid_to_exec_file (int pid)
{
- static gdb::optional<gdb::char_vector> filename;
+ static std::optional<gdb::char_vector> filename;
char *annex = NULL;
if (m_features.packet_support (PACKET_qXfer_exec_file) != PACKET_ENABLE)
passed, is the value to place in rs1, otherwise rd is duplicated into
rs1. */
void decode_ci_type_insn (enum opcode opcode, ULONGEST ival,
- gdb::optional<int> rs1_regnum = {})
+ std::optional<int> rs1_regnum = {})
{
m_opcode = opcode;
m_rd = decode_register_index (ival, OP_SH_CRS1S);
struct target_ops *target, bfd *abfd)
{
asection *section = bfd_get_section_by_name (abfd, ".reg");
- 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);
bool high_gprs, v1, v2, te, vx, gs;
#include "filenames.h"
#include "fnmatch.h"
#include "gdbsupport/gdb_regex.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
#include <list>
#include "cli/cli-style.h"
#include "gdbsupport/buildargv.h"
std::string m_function;
/* If this is a function regexp, the compiled form. */
- gdb::optional<compiled_regex> m_compiled_function_regexp;
+ std::optional<compiled_regex> m_compiled_function_regexp;
/* Enabled/disabled state. */
bool m_enabled = true;
the same principles applied to shared libraries also apply
to the main executable. So it's simpler to keep it as part
of this list. */
- gdb::optional<std::vector<lm_info_aix>> library_list;
+ std::optional<std::vector<lm_info_aix>> library_list;
};
/* Key to our per-inferior data. */
/* Dummy implementation if XML support is not compiled in. */
-static gdb::optional<std::vector<lm_info_aix>>
+static std::optional<std::vector<lm_info_aix>>
solib_aix_parse_libraries (const char *library)
{
static int have_warned;
Return an empty option if the parsing failed. */
-static gdb::optional<std::vector<lm_info_aix>>
+static std::optional<std::vector<lm_info_aix>>
solib_aix_parse_libraries (const char *library)
{
std::vector<lm_info_aix> result;
is not NULL, then print a warning including WARNING_MSG and
a description of the error. */
-static gdb::optional<std::vector<lm_info_aix>> &
+static std::optional<std::vector<lm_info_aix>> &
solib_aix_get_library_list (struct inferior *inf, const char *warning_msg)
{
struct solib_aix_inferior_data *data;
if (data->library_list.has_value ())
return data->library_list;
- gdb::optional<gdb::char_vector> library_document
+ std::optional<gdb::char_vector> library_document
= target_read_stralloc (current_inferior ()->top_target (),
TARGET_OBJECT_LIBRARIES_AIX,
NULL);
/* We need to relocate the main executable... */
- gdb::optional<std::vector<lm_info_aix>> &library_list
+ std::optional<std::vector<lm_info_aix>> &library_list
= solib_aix_get_library_list (current_inferior (), warning_msg);
if (!library_list.has_value ())
return; /* Warning already printed. */
static intrusive_list<shobj>
solib_aix_current_sos ()
{
- gdb::optional<std::vector<lm_info_aix>> &library_list
+ std::optional<std::vector<lm_info_aix>> &library_list
= solib_aix_get_library_list (current_inferior (), NULL);
if (!library_list.has_value ())
return {};
dsbt_get_initial_loadmaps (void)
{
dsbt_info *info = get_dsbt_info (current_program_space);
- gdb::optional<gdb::byte_vector> buf
+ std::optional<gdb::byte_vector> buf
= target_read_alloc (current_inferior ()->top_target (),
TARGET_OBJECT_FDPIC, "exec");
architecture size (32-bit or 64-bit) is returned to *P_ARCH_SIZE. Likewise,
the base address of the section is returned in *BASE_ADDR. */
-static gdb::optional<gdb::byte_vector>
+static std::optional<gdb::byte_vector>
read_program_header (int type, int *p_arch_size, CORE_ADDR *base_addr)
{
bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ());
/* Return program interpreter string. */
-static gdb::optional<gdb::byte_vector>
+static std::optional<gdb::byte_vector>
find_program_interpreter (void)
{
/* If we have a current exec_bfd, use its section table. */
CORE_ADDR base_addr;
/* Read in .dynamic section. */
- gdb::optional<gdb::byte_vector> ph_data
+ std::optional<gdb::byte_vector> ph_data
= read_program_header (PT_DYNAMIC, &arch_size, &base_addr);
if (!ph_data)
return 0;
gdb_assert (annex == NULL || target_augmented_libraries_svr4_read ());
/* Fetch the list of shared libraries. */
- gdb::optional<gdb::char_vector> svr4_library_document
+ std::optional<gdb::char_vector> svr4_library_document
= target_read_stralloc (current_inferior ()->top_target (),
TARGET_OBJECT_LIBRARIES_SVR4,
annex);
/* Find the program interpreter; if not found, warn the user and drop
into the old breakpoint at symbol code. */
- gdb::optional<gdb::byte_vector> interp_name_holder
+ std::optional<gdb::byte_vector> interp_name_holder
= find_program_interpreter ();
if (interp_name_holder)
{
/* Read the ELF program headers from ABFD. */
-static gdb::optional<gdb::byte_vector>
+static std::optional<gdb::byte_vector>
read_program_headers_from_bfd (bfd *abfd)
{
Elf_Internal_Ehdr *ehdr = elf_elfheader (abfd);
really do not match. */
int arch_size;
- gdb::optional<gdb::byte_vector> phdrs_target
+ std::optional<gdb::byte_vector> phdrs_target
= read_program_header (-1, &arch_size, NULL);
- gdb::optional<gdb::byte_vector> phdrs_binary
+ std::optional<gdb::byte_vector> phdrs_binary
= read_program_headers_from_bfd (current_program_space->exec_bfd ());
if (phdrs_target && phdrs_binary)
{
intrusive_list<shobj> sos;
/* Fetch the list of shared libraries. */
- gdb::optional<gdb::char_vector> library_document
+ std::optional<gdb::char_vector> library_document
= target_read_stralloc (current_inferior ()->top_target (),
TARGET_OBJECT_LIBRARIES, NULL);
if (!library_document)
if (!already_styled)
{
- gdb::optional<std::string> ext_contents;
+ std::optional<std::string> ext_contents;
ext_contents = ext_lang_colorize (fullname, contents);
if (ext_contents.has_value ())
{
/* print_frame_info_print_what[i] maps a choice to the corresponding
print_what enum. */
-static const gdb::optional<enum print_what> print_frame_info_print_what[] =
+static const std::optional<enum print_what> print_frame_info_print_what[] =
{{}, /* Empty value for "auto". */
SRC_LINE, LOCATION, SRC_AND_LOC, LOC_AND_ADDRESS, SHORT_LOCATION};
Value not present indicates to the caller to use default values
specific to the command being executed. */
-static gdb::optional<enum print_what>
+static std::optional<enum print_what>
print_frame_info_to_print_what (const char *print_frame_info)
{
for (int i = 0; print_frame_info_choices[i] != NULL; i++)
/* See stack.h. */
void
-get_user_print_what_frame_info (gdb::optional<enum print_what> *what)
+get_user_print_what_frame_info (std::optional<enum print_what> *what)
{
*what
= print_frame_info_to_print_what
struct print_variable_and_value_data
{
- gdb::optional<compiled_regex> preg;
- gdb::optional<compiled_regex> treg;
+ std::optional<compiled_regex> preg;
+ std::optional<compiled_regex> treg;
struct frame_id frame_id;
int num_tabs;
struct ui_file *stream;
If REGEXP is NULL, it results in an empty regular expression. */
static void
-prepare_reg (const char *regexp, gdb::optional<compiled_regex> *reg)
+prepare_reg (const char *regexp, std::optional<compiled_regex> *reg)
{
if (regexp != NULL)
{
struct print_variable_and_value_data cb_data;
struct symbol *func;
CORE_ADDR pc;
- gdb::optional<compiled_regex> preg;
- gdb::optional<compiled_regex> treg;
+ std::optional<compiled_regex> preg;
+ std::optional<compiled_regex> treg;
if (!get_frame_pc_if_available (frame, &pc))
{
information to print, otherwise the printing function should print
the relevant information. */
-void get_user_print_what_frame_info (gdb::optional<enum print_what> *what);
+void get_user_print_what_frame_info (std::optional<enum print_what> *what);
/* Return true if we should display the address in addition to the location,
because we are in the middle of a statement. */
/* Make sure that partially constructed symbol tables will be cleaned up
if an error occurs during symbol reading. */
- gdb::optional<clear_symtab_users_cleanup> defer_clear_users;
+ std::optional<clear_symtab_users_cleanup> defer_clear_users;
objfile_up objfile_holder (objfile);
#include "parser-defs.h"
#include "completer.h"
#include "progspace-and-thread.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
#include "filename-seen-cache.h"
#include "arch-utils.h"
#include <algorithm>
general_symbol_info::compute_and_set_names (gdb::string_view linkage_name,
bool copy_name,
objfile_per_bfd_storage *per_bfd,
- gdb::optional<hashval_t> hash)
+ std::optional<hashval_t> hash)
{
struct demangled_name_entry **slot;
the function starting at FUNC_ADDR which has prologue_end set to true if
such entry exist, otherwise return an empty optional. */
-static gdb::optional<CORE_ADDR>
+static std::optional<CORE_ADDR>
skip_prologue_using_linetable (CORE_ADDR func_addr)
{
CORE_ADDR start_pc, end_pc;
be placed to skip the prologue. */
if (!ignore_prologue_end_flag && skip)
{
- gdb::optional<CORE_ADDR> linetable_pc
+ std::optional<CORE_ADDR> linetable_pc
= skip_prologue_using_linetable (pc);
if (linetable_pc)
{
output_source_filename_data data (uiout, filter);
ui_out_emit_list results_emitter (uiout, "files");
- gdb::optional<ui_out_emit_tuple> output_tuple;
- gdb::optional<ui_out_emit_list> sources_list;
+ std::optional<ui_out_emit_tuple> output_tuple;
+ std::optional<ui_out_emit_list> sources_list;
gdb_assert (group_by_objfile || uiout->is_mi_like_p ());
bool
global_symbol_searcher::expand_symtabs
- (objfile *objfile, const gdb::optional<compiled_regex> &preg) const
+ (objfile *objfile, const std::optional<compiled_regex> &preg) const
{
enum search_domain kind = m_kind;
bool found_msymbol = false;
bool
global_symbol_searcher::add_matching_symbols
(objfile *objfile,
- const gdb::optional<compiled_regex> &preg,
- const gdb::optional<compiled_regex> &treg,
+ const std::optional<compiled_regex> &preg,
+ const std::optional<compiled_regex> &treg,
std::set<symbol_search> *result_set) const
{
enum search_domain kind = m_kind;
bool
global_symbol_searcher::add_matching_msymbols
- (objfile *objfile, const gdb::optional<compiled_regex> &preg,
+ (objfile *objfile, const std::optional<compiled_regex> &preg,
std::vector<symbol_search> *results) const
{
enum search_domain kind = m_kind;
std::vector<symbol_search>
global_symbol_searcher::search () const
{
- gdb::optional<compiled_regex> preg;
- gdb::optional<compiled_regex> treg;
+ std::optional<compiled_regex> preg;
+ std::optional<compiled_regex> treg;
gdb_assert (m_kind != ALL_DOMAIN);
#include "gdbsupport/gdb_regex.h"
#include "gdbsupport/enum-flags.h"
#include "gdbsupport/function-view.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
#include "gdbsupport/gdb_string_view.h"
#include "gdbsupport/next-iterator.h"
#include "gdbsupport/iterator-range.h"
around by const reference (see intro), and they're conceptually
"cache" that can always be reconstructed from the non-mutable
fields. */
- mutable gdb::optional<ada_lookup_name_info> m_ada;
- mutable gdb::optional<demangle_for_lookup_info> m_cplus;
- mutable gdb::optional<demangle_for_lookup_info> m_d;
- mutable gdb::optional<demangle_for_lookup_info> m_go;
+ mutable std::optional<ada_lookup_name_info> m_ada;
+ mutable std::optional<demangle_for_lookup_info> m_cplus;
+ mutable std::optional<demangle_for_lookup_info> m_d;
+ mutable std::optional<demangle_for_lookup_info> m_go;
/* The demangled hashes. Stored in an array with one entry for each
possible language. The second array records whether we've
copy_name must be set to true. */
void compute_and_set_names (gdb::string_view linkage_name, bool copy_name,
struct objfile_per_bfd_storage *per_bfd,
- gdb::optional<hashval_t> hash
- = gdb::optional<hashval_t> ());
+ std::optional<hashval_t> hash
+ = std::optional<hashval_t> ());
CORE_ADDR value_address () const
{
true if any msymbols were seen that we should later consider adding to
the results list. */
bool expand_symtabs (objfile *objfile,
- const gdb::optional<compiled_regex> &preg) const;
+ const std::optional<compiled_regex> &preg) const;
/* Add symbols from symtabs in OBJFILE that match PREG, and TREG, and are
of type M_KIND, to the results set RESULTS_SET. Return false if we
Returning true does not indicate that any results were added, just
that we didn't _not_ add a result due to reaching MAX_SEARCH_RESULTS. */
bool add_matching_symbols (objfile *objfile,
- const gdb::optional<compiled_regex> &preg,
- const gdb::optional<compiled_regex> &treg,
+ const std::optional<compiled_regex> &preg,
+ const std::optional<compiled_regex> &treg,
std::set<symbol_search> *result_set) const;
/* Add msymbols from OBJFILE that match PREG and M_KIND, to the results
does not indicate that any results were added, just that we didn't
_not_ add a result due to reaching MAX_SEARCH_RESULTS. */
bool add_matching_msymbols (objfile *objfile,
- const gdb::optional<compiled_regex> &preg,
+ const std::optional<compiled_regex> &preg,
std::vector<symbol_search> *results) const;
/* Return true if MSYMBOL is of type KIND. */
/* A compiled version of M_REGEXP. This object is only given a value if
M_REGEXP is not nullptr and is not the empty string. */
- gdb::optional<compiled_regex> m_c_regexp;
+ std::optional<compiled_regex> m_c_regexp;
};
/* Perform the core of the 'info sources' command.
for details. */
template <typename T>
-gdb::optional<gdb::def_vector<T>>
+std::optional<gdb::def_vector<T>>
target_read_alloc_1 (struct target_ops *ops, enum target_object object,
const char *annex)
{
/* See target.h */
-gdb::optional<gdb::byte_vector>
+std::optional<gdb::byte_vector>
target_read_alloc (struct target_ops *ops, enum target_object object,
const char *annex)
{
/* See target.h. */
-gdb::optional<gdb::char_vector>
+std::optional<gdb::char_vector>
target_read_stralloc (struct target_ops *ops, enum target_object object,
const char *annex)
{
- gdb::optional<gdb::char_vector> buf
+ std::optional<gdb::char_vector> buf
= target_read_alloc_1<char> (ops, object, annex);
if (!buf)
/* See target.h. */
-gdb::optional<gdb::char_vector>
+std::optional<gdb::char_vector>
target_get_osdata (const char *type)
{
struct target_ops *t;
return -1;
}
-gdb::optional<std::string>
+std::optional<std::string>
target_ops::fileio_readlink (struct inferior *inf, const char *filename,
fileio_error *target_errno)
{
/* See target.h. */
-gdb::optional<std::string>
+std::optional<std::string>
target_fileio_readlink (struct inferior *inf, const char *filename,
fileio_error *target_errno)
{
for (target_ops *t = default_fileio_target (); t != NULL; t = t->beneath ())
{
- gdb::optional<std::string> ret
+ std::optional<std::string> ret
= t->fileio_readlink (inf, filename, target_errno);
if (!ret.has_value () && *target_errno == FILEIO_ENOSYS)
size is known in advance. Don't try to read TARGET_OBJECT_MEMORY
through this function. */
-extern gdb::optional<gdb::byte_vector> target_read_alloc
+extern std::optional<gdb::byte_vector> target_read_alloc
(struct target_ops *ops, enum target_object object, const char *annex);
/* Read OBJECT/ANNEX using OPS. The result is a NUL-terminated character vector
the returned vector is guaranteed to have at least one element. A warning is
issued if the result contains any embedded NUL bytes. */
-extern gdb::optional<gdb::char_vector> target_read_stralloc
+extern std::optional<gdb::char_vector> target_read_stralloc
(struct target_ops *ops, enum target_object object, const char *annex);
/* See target_ops->to_xfer_partial. */
seen by the debugger (GDB or, for remote targets, the remote
stub). Return a string, or an empty optional if an error
occurs (and set *TARGET_ERRNO). */
- virtual gdb::optional<std::string> fileio_readlink (struct inferior *inf,
+ virtual std::optional<std::string> fileio_readlink (struct inferior *inf,
const char *filename,
fileio_error *target_errno);
by the debugger (GDB or, for remote targets, the remote stub).
Return a null-terminated string allocated via xmalloc, or NULL if
an error occurs (and set *TARGET_ERRNO). */
-extern gdb::optional<std::string> target_fileio_readlink
+extern std::optional<std::string> target_fileio_readlink
(struct inferior *inf, const char *filename, fileio_error *target_errno);
/* Read target file FILENAME, in the filesystem as seen by INF. If
/* Read OS data object of type TYPE from the target, and return it in XML
format. The return value follows the same rules as target_read_stralloc. */
-extern gdb::optional<gdb::char_vector> target_get_osdata (const char *type);
+extern std::optional<gdb::char_vector> target_get_osdata (const char *type);
/* Stuff that should be shared among the various remote targets. */
#include "thread-fsm.h"
#include "tid-parse.h"
#include <algorithm>
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
#include "inline-frame.h"
#include "stack.h"
#include "interps.h"
/* Notify interpreters and observers that thread T has exited. */
static void
-notify_thread_exited (thread_info *t, gdb::optional<ULONGEST> exit_code,
+notify_thread_exited (thread_info *t, std::optional<ULONGEST> exit_code,
int silent)
{
if (!silent && print_thread_events)
/* See gdbthread.h. */
void
-set_thread_exited (thread_info *tp, gdb::optional<ULONGEST> exit_code,
+set_thread_exited (thread_info *tp, std::optional<ULONGEST> exit_code,
bool silent)
{
/* Dead threads don't need to step-over. Remove from chain. */
/* Helper for the different delete_thread variants. */
static void
-delete_thread_1 (thread_info *thr, gdb::optional<ULONGEST> exit_code,
+delete_thread_1 (thread_info *thr, std::optional<ULONGEST> exit_code,
bool silent)
{
gdb_assert (thr != nullptr);
/* For backward compatibility, we make a list for MI. A table is
preferable for the CLI, though, because it shows table
headers. */
- gdb::optional<ui_out_emit_list> list_emitter;
- gdb::optional<ui_out_emit_table> table_emitter;
+ std::optional<ui_out_emit_list> list_emitter;
+ std::optional<ui_out_emit_table> table_emitter;
/* We'll be switching threads temporarily below. */
scoped_restore_current_thread restore_thread;
/* See gdbthread.h. */
void
-thread_try_catch_cmd (thread_info *thr, gdb::optional<int> ada_task,
+thread_try_catch_cmd (thread_info *thr, std::optional<int> ada_task,
const char *cmd, int from_tty,
const qcs_flags &flags)
{
struct tfile_trace_file_writer *writer
= (struct tfile_trace_file_writer *) self;
- gdb::optional<std::string> tdesc
+ std::optional<std::string> tdesc
= target_fetch_description_xml (current_inferior ()->top_target ());
if (!tdesc)
void *ignore)
{
/* We need to read the whole object before we know its size. */
- gdb::optional<gdb::byte_vector> buf
+ std::optional<gdb::byte_vector> buf
= target_read_alloc (current_inferior ()->top_target (),
TARGET_OBJECT_STATIC_TRACE_DATA,
NULL);
promising starting point then we record it in this structure. If
the next address we try is not a suitable starting point then we
will fall back to the address held here. */
- gdb::optional<CORE_ADDR> possible_new_low;
+ std::optional<CORE_ADDR> possible_new_low;
/* The previous value of NEW_LOW so we know if the new value is
different or not. */
};
/* This is given a value only if we fix the size of the cmd window. */
- gdb::optional<old_size_info> old_cmd_info;
+ std::optional<old_size_info> old_cmd_info;
std::vector<size_info> info (m_splits.size ());
#define VERIFY SELF_CHECK
/* Used to disable testing features not supported by
- gdb::optional. */
+ std::optional. */
#define GDB_OPTIONAL
namespace selftests {
copied over from libstdc++'s testsuite. To preserve the structure
and help with comparison with the original tests, the file names
have been preserved, and only minimal modification was done to have
- them compile against gdb::optional instead of std::optional:
+ them compile against std::optional instead of std::optional:
- std::optional->gdb:optional, etc.
- ATTRIBUTE_UNUSED in a few places
#include "gdbsupport/gdb_regex.h"
#include "gdbsupport/job-control.h"
#include "gdbsupport/selftest.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
#include "cp-support.h"
#include <algorithm>
#include "gdbsupport/pathstuff.h"
(*deprecated_warning_hook) (string, args);
else
{
- 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 ())
{
term_state.emplace ();
}
/* Try to get the message out and at the start of a new line. */
- 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 ())
{
term_state.emplace ();
|| tarray->code () == TYPE_CODE_STRING)
{
struct type *range_type = tarray->index_type ();
- gdb::optional<LONGEST> lowerbound = get_discrete_low_bound (range_type);
+ std::optional<LONGEST> lowerbound = get_discrete_low_bound (range_type);
if (!lowerbound.has_value ())
lowerbound = 0;
if (array->lval () != lval_memory)
return value_subscripted_rvalue (array, index, *lowerbound);
- gdb::optional<LONGEST> upperbound
+ std::optional<LONGEST> upperbound
= get_discrete_high_bound (range_type);
if (!upperbound.has_value ())
struct type *, int);
static struct value *search_struct_method (const char *, struct value **,
- gdb::optional<gdb::array_view<value *>>,
+ std::optional<gdb::array_view<value *>>,
LONGEST, int *, struct type *);
static int find_oload_champ_namespace (gdb::array_view<value *> args,
static struct value *
search_struct_method (const char *name, struct value **arg1p,
- gdb::optional<gdb::array_view<value *>> args,
+ std::optional<gdb::array_view<value *>> args,
LONGEST offset, int *static_memfuncp,
struct type *type)
{
struct value *
value_struct_elt (struct value **argp,
- gdb::optional<gdb::array_view<value *>> args,
+ std::optional<gdb::array_view<value *>> args,
const char *name, int *static_memfuncp, const char *err)
{
struct type *t;
/* When this has a value, it is used to limit the number of array elements
of an array that are loaded into memory when an array value is made
non-lazy. */
-static gdb::optional<int> array_length_limiting_element_count;
+static std::optional<int> array_length_limiting_element_count;
/* See value.h. */
scoped_array_length_limiting::scoped_array_length_limiting (int elements)
extern struct value *value_complement (struct value *arg1);
extern struct value *value_struct_elt (struct value **argp,
- gdb::optional<gdb::array_view <value *>> args,
+ std::optional<gdb::array_view <value *>> args,
const char *name, int *static_memfuncp,
const char *err);
private:
/* Used to hold the previous array value element limit. */
- gdb::optional<int> m_old_value;
+ std::optional<int> m_old_value;
};
#endif /* !defined (VALUE_H) */
th->suspend ();
}
- gdb::optional<unsigned> err;
+ std::optional<unsigned> err;
do_synchronously ([&] ()
{
if (!continue_last_debug_event (continue_status, debug_events))
/* If there is a relevant pending stop, report it now. See the
comment by the definition of "pending_stops" for details on why
this is needed. */
- gdb::optional<pending_stop> stop
+ std::optional<pending_stop> stop
= windows_process.fetch_pending_stop (debug_events);
if (stop.has_value ())
{
windows_init_thread_list ();
windows_process.saw_create = 0;
- gdb::optional<unsigned> err;
+ std::optional<unsigned> err;
do_synchronously ([&] ()
{
BOOL ok = DebugActiveProcess (pid);
{
windows_continue (DBG_CONTINUE, -1, 0, true);
- gdb::optional<unsigned> err;
+ std::optional<unsigned> err;
do_synchronously ([&] ()
{
if (!DebugActiveProcessStop (windows_process.current_event.dwProcessId))
#endif /* !__CYGWIN__ */
const char *allargs = origallargs.c_str ();
PROCESS_INFORMATION pi;
- gdb::optional<unsigned> ret;
+ std::optional<unsigned> ret;
DWORD flags = 0;
const std::string &inferior_tty = current_inferior ()->tty ();
gdb_xml_error (parser, _("Maximum XInclude depth (%d) exceeded"),
MAX_XINCLUDE_DEPTH);
- gdb::optional<gdb::char_vector> text = data->fetcher (href);
+ std::optional<gdb::char_vector> text = data->fetcher (href);
if (!text)
gdb_xml_error (parser, _("Could not load XML document \"%s\""), href);
gdb_printf (file, _("XML debugging is %s.\n"), value);
}
-gdb::optional<gdb::char_vector>
+std::optional<gdb::char_vector>
xml_fetch_content_from_file (const char *filename, const char *dirname)
{
gdb_file_up file;
#include "gdbsupport/gdb_obstack.h"
#include "gdbsupport/xml-utils.h"
#include "gdbsupport/byte-vector.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
#include "gdbsupport/function-view.h"
struct gdb_xml_parser;
/* Callback to fetch a new XML file, based on the provided HREF. */
-using xml_fetch_another = gdb::function_view<gdb::optional<gdb::char_vector>
+using xml_fetch_another = gdb::function_view<std::optional<gdb::char_vector>
(const char * /* href */)>;
/* Append the expansion of TEXT after processing <xi:include> tags in
the text. If something goes wrong, return an uninstantiated optional
and warn. */
-extern gdb::optional<gdb::char_vector> xml_fetch_content_from_file
+extern std::optional<gdb::char_vector> xml_fetch_content_from_file
(const char *filename, const char *dirname);
#endif
static struct syscalls_info *
xml_init_syscalls_info (const char *filename)
{
- gdb::optional<gdb::char_vector> full_file
+ std::optional<gdb::char_vector> full_file
= xml_fetch_content_from_file (filename,
const_cast<char *>(gdb_datadir.c_str ()));
if (!full_file)
const struct target_desc *
file_read_description_xml (const char *filename)
{
- gdb::optional<gdb::char_vector> tdesc_str
+ std::optional<gdb::char_vector> tdesc_str
= xml_fetch_content_from_file (filename, NULL);
if (!tdesc_str)
{
is "target.xml". Other calls may be performed for the DTD or
for <xi:include>. */
-static gdb::optional<gdb::char_vector>
+static std::optional<gdb::char_vector>
fetch_available_features_from_target (const char *name, target_ops *ops)
{
/* Read this object as a string. This ensures that a NUL
const struct target_desc *
target_read_description_xml (struct target_ops *ops)
{
- gdb::optional<gdb::char_vector> tdesc_str
+ std::optional<gdb::char_vector> tdesc_str
= fetch_available_features_from_target ("target.xml", ops);
if (!tdesc_str)
return NULL;
includes, but not parsing it. Used to dump whole tdesc
as a single XML file. */
-gdb::optional<std::string>
+std::optional<std::string>
target_fetch_description_xml (struct target_ops *ops)
{
#if !defined(HAVE_LIBEXPAT)
return {};
#else
- gdb::optional<gdb::char_vector>
+ std::optional<gdb::char_vector>
tdesc_str = fetch_available_features_from_target ("target.xml", ops);
if (!tdesc_str)
return {};
return tdesc_parse_xml (xml, [] (const char *href)
{
error (_("xincludes are unsupported with this method"));
- return gdb::optional<gdb::char_vector> ();
+ return std::optional<gdb::char_vector> ();
});
}
#ifndef XML_TDESC_H
#define XML_TDESC_H
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
#include <string>
struct target_ops;
but not parsing it. Used to dump whole tdesc as a single XML file.
Returns the description on success, and a disengaged optional
otherwise. */
-gdb::optional<std::string> target_fetch_description_xml (target_ops *ops);
+std::optional<std::string> target_fetch_description_xml (target_ops *ops);
/* Take an xml string, parse it, and return the parsed description. Does not
handle a string containing includes. */
collect_register (regcache, tls_regnum, tls_buf);
/* Read TPIDR2, if it exists. */
- gdb::optional<int> regnum = find_regno_no_throw (regcache->tdesc, "tpidr2");
+ std::optional<int> regnum = find_regno_no_throw (regcache->tdesc, "tpidr2");
if (regnum.has_value ())
collect_register (regcache, *regnum, tls_buf + sizeof (uint64_t));
supply_register (regcache, tls_regnum, tls_buf);
/* Write TPIDR2, if it exists. */
- gdb::optional<int> regnum = find_regno_no_throw (regcache->tdesc, "tpidr2");
+ std::optional<int> regnum = find_regno_no_throw (regcache->tdesc, "tpidr2");
if (regnum.has_value ())
supply_register (regcache, *regnum, tls_buf + sizeof (uint64_t));
/* See regcache.h */
-gdb::optional<int>
+std::optional<int>
find_regno_no_throw (const struct target_desc *tdesc, const char *name)
{
for (int i = 0; i < tdesc->reg_defs.size (); ++i)
int
find_regno (const struct target_desc *tdesc, const char *name)
{
- gdb::optional<int> regnum = find_regno_no_throw (tdesc, name);
+ std::optional<int> regnum = find_regno_no_throw (tdesc, name);
if (regnum.has_value ())
return *regnum;
/* No throw version of find_regno. If NAME is not a known register, return
an empty value. */
-gdb::optional<int> find_regno_no_throw (const struct target_desc *tdesc,
+std::optional<int> find_regno_no_throw (const struct target_desc *tdesc,
const char *name);
int find_regno (const struct target_desc *tdesc, const char *name);
windows_process.attaching = 0;
{
- gdb::optional<pending_stop> stop
+ std::optional<pending_stop> stop
= windows_process.fetch_pending_stop (debug_threads);
if (stop.has_value ())
{
#ifndef COMMON_COMMON_DEBUG_H
#define COMMON_COMMON_DEBUG_H
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
#include "gdbsupport/preprocessor.h"
#include <stdarg.h>
const char *m_end_prefix;
/* The result of formatting the format string in the constructor. */
- gdb::optional<std::string> m_msg;
+ std::optional<std::string> m_msg;
/* True is a non-nullptr format was passed to the constructor. */
bool m_with_format;
#include <sys/types.h>
#include "gdbsupport/gdb_sys_time.h"
#include "gdbsupport/gdb_select.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
#include "gdbsupport/scope-exit.h"
/* See event-loop.h. */
When the timeout is reached, events are not monitored again:
they already have been checked in the loop above. */
- gdb::optional<int> timer_id;
+ std::optional<int> timer_id;
SCOPE_EXIT
{
timer_id = create_timer (mstimeout,
[] (gdb_client_data arg)
{
- ((gdb::optional<int> *) arg)->reset ();
+ ((std::optional<int> *) arg)->reset ();
},
&timer_id);
return gdb_wait_for_event (1);
/* See gdbsupport/filestuff.h. */
-gdb::optional<std::string>
+std::optional<std::string>
read_text_file_to_string (const char *path)
{
gdb_file_up file = gdb_fopen_cloexec (path, "r");
/* Read the entire content of file PATH into an std::string. */
-extern gdb::optional<std::string> read_text_file_to_string (const char *path);
+extern std::optional<std::string> read_text_file_to_string (const char *path);
#endif /* COMMON_FILESTUFF_H */
obj.release (); // Optional cancel if needed.
forward_scope_exit is also handy when you would need to wrap a
- scope_exit in a gdb::optional:
+ scope_exit in a std::optional:
- gdb::optional<longjmp_breakpoint_cleanup> cleanup;
+ std::optional<longjmp_breakpoint_cleanup> cleanup;
if (some condition)
cleanup.emplace (thread);
...
cleanup->release ();
since with scope exit, you would have to know the scope_exit's
- callable template type when you create the gdb::optional:
+ callable template type when you create the std::optional:
gdb:optional<scope_exit<what goes here?>>
/* The current iterator into one of the vector ranges. If no
value then this (outer) iterator is at the end of the overall
range. */
- gdb::optional<typename Range::iterator> m_current;
+ std::optional<typename Range::iterator> m_current;
/* Vector of ranges. */
const std::vector<Range> &m_ranges;
};
#ifdef SIGTTOU
/* Simple wrapper that allows lazy initialization / destruction of T.
- Slightly more efficient than gdb::optional, because it doesn't
+ Slightly more efficient than std::optional, because it doesn't
carry storage to track whether the object has been initialized. */
template<typename T>
class lazy_init
while (true)
{
- optional<task_t> t;
+ std::optional<task_t> t;
{
/* We want to hold the lock while examining the task list, but
#include <condition_variable>
#include <future>
#endif
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
namespace gdb
{
to represent a task. If the optional is empty, then this means
that the receiving thread should terminate. If the optional is
non-empty, then it is an actual task to evaluate. */
- std::queue<optional<task_t>> m_tasks;
+ std::queue<std::optional<task_t>> m_tasks;
/* A condition variable and mutex that are used for communication
between the main thread and the worker threads. */