aboutsummaryrefslogtreecommitdiff
path: root/gdb/nat
diff options
context:
space:
mode:
authorLancelot Six <lancelot.six@amd.com>2023-10-13 09:27:48 +0000
committerLancelot Six <lancelot.six@amd.com>2023-11-21 11:52:35 +0000
commit6b09f1342cf2d8e2b13a0d634acc3bcf2852a73b (patch)
tree07259601270022a6cbeb89826560262f015e1589 /gdb/nat
parent6b62451ad08056f0ba02e192ec34ef67c4294ef4 (diff)
downloadbinutils-6b09f1342cf2d8e2b13a0d634acc3bcf2852a73b.zip
binutils-6b09f1342cf2d8e2b13a0d634acc3bcf2852a73b.tar.gz
binutils-6b09f1342cf2d8e2b13a0d634acc3bcf2852a73b.tar.bz2
gdb: Replace gdb::optional with std::optional
Since GDB now requires C++17, we don't need the internally maintained gdb::optional implementation. This patch does the following replacing: - gdb::optional -> std::optional - gdb::in_place -> std::in_place - #include "gdbsupport/gdb_optional.h" -> #include <optional> This change has mostly been done automatically. One exception is gdbsupport/thread-pool.* which did not use the gdb:: prefix as it already lives in the gdb namespace. Change-Id: I19a92fa03e89637bab136c72e34fd351524f65e9 Approved-By: Tom Tromey <tom@tromey.com> Approved-By: Pedro Alves <pedro@palves.net>
Diffstat (limited to 'gdb/nat')
-rw-r--r--gdb/nat/linux-osdata.c8
-rw-r--r--gdb/nat/windows-nat.c6
-rw-r--r--gdb/nat/windows-nat.h4
3 files changed, 9 insertions, 9 deletions
diff --git a/gdb/nat/linux-osdata.c b/gdb/nat/linux-osdata.c
index 103b7ab..e853846 100644
--- a/gdb/nat/linux-osdata.c
+++ b/gdb/nat/linux-osdata.c
@@ -66,7 +66,7 @@ linux_common_core_of_thread (ptid_t ptid)
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;
@@ -257,10 +257,10 @@ get_cores_used_by_process (PID_T pid, int *cores, const int num_cores)
/* get_core_array_size helper that uses /sys/devices/system/cpu/possible. */
-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 ())
@@ -310,7 +310,7 @@ get_core_array_size ()
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;
diff --git a/gdb/nat/windows-nat.c b/gdb/nat/windows-nat.c
index 8028494..bf4c438 100644
--- a/gdb/nat/windows-nat.c
+++ b/gdb/nat/windows-nat.c
@@ -698,10 +698,10 @@ windows_process_info::matching_pending_stop (bool debug_events)
/* 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)
@@ -818,7 +818,7 @@ create_process_wrapper (FUNC *do_create_process, const CHAR *image,
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,
diff --git a/gdb/nat/windows-nat.h b/gdb/nat/windows-nat.h
index e3ea7db..0dc37b2 100644
--- a/gdb/nat/windows-nat.h
+++ b/gdb/nat/windows-nat.h
@@ -23,7 +23,7 @@
#include <psapi.h>
#include <vector>
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
#include "target/waitstatus.h"
#define STATUS_WX86_BREAKPOINT 0x4000001F
@@ -246,7 +246,7 @@ struct windows_process_info
remove it from the list of pending stops, set 'current_event', and
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);