aboutsummaryrefslogtreecommitdiff
path: root/gdbsupport/gdb_optional.h
AgeCommit message (Collapse)AuthorFilesLines
2023-11-21gdbsupport: remove gdb::optionalLancelot Six1-233/+0
The previous patch migrated all the uses of gdb::optional to use std::optional instead, so gdb::optional can be removed entirely as well as the self-tests which came with it. Change-Id: I96ecd67b850b01be10ef00eb85a78ac647d5adc7 Approved-By: Tom Tromey <tom@tromey.com> Approved-By: Pedro Alves <pedro@palves.net>
2023-01-01Update copyright year range in header of all files managed by GDBJoel Brobecker1-1/+1
This commit is the result of running the gdb/copyright.py script, which automated the update of the copyright year range for all source files managed by the GDB project to be updated to include year 2023.
2022-08-26gdbsupport: fix gdb::optional compilation with C++11 && _GLIBCXX_DEBUGSimon Marchi1-2/+2
Similar to 911438f9f4 ("gdbsupport: fix array-view compilation with c++11 && _GLIBCXX_DEBUG"), but for gdb::optional. I get this error when building with Clang 14 and -std=c++11: CXX agent.o In file included from /home/simark/src/binutils-gdb/gdbsupport/agent.cc:20: In file included from /home/simark/src/binutils-gdb/gdbsupport/common-defs.h:210: In file included from /home/simark/src/binutils-gdb/gdbsupport/common-debug.h:23: /home/simark/src/binutils-gdb/gdbsupport/../gdbsupport/gdb_optional.h:213:5: error: use of this statement in a constexpr function is a C++14 extension [-Werror,-Wc++14-extensions] gdb_assert (this->has_value ()); ^ /home/simark/src/binutils-gdb/gdbsupport/gdb_assert.h:35:3: note: expanded from macro 'gdb_assert' ((void) ((expr) ? 0 : \ ^ Change-Id: If0cf55607fc9dbd1925ccb97cd9abbf8993ff264
2022-01-01Automatic Copyright Year update after running gdb/copyright.pyJoel Brobecker1-1/+1
This commit brings all the changes made by running gdb/copyright.py as per GDB's Start of New Year Procedure. For the avoidance of doubt, all changes in this commits were performed by the script.
2021-08-03gdbsupport: add debug assertions in gdb::optional::getSimon Marchi1-2/+14
The libstdc++ version of optional contains some runtime checks enabled when _GLIBCXX_DEBUG is defined. I think it would be useful if our version contained similar checks. Add checks in the two `get` methods, also conditional on _GLIBCXX_DEBUG. I think it's simpler to use that macro rather than introducing a new GDB-specific one, as I think that if somebody is interested in enabling these runtime checks, they'll also be interested in enabling the libstdc++ runtime checks (and vice-versa). I implemented these checks using gdb_assert. Note that gdb_assert throws (after querying the user), and we are in noexcept methods. That means that std::terminate / abort will immediately be called. I think this is ok, since if those were "real" _GLIBCXX_DEBUG checks, abort would be called straight away. If I add a dummy failure, it looks like so: $ ./gdb -q -nx --data-directory=data-directory /home/simark/src/binutils-gdb/gdb/../gdbsupport/gdb_optional.h:206: internal-error: T& gdb::optional<T>::get() [with T = int]: Assertion `this->has_value ()' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) n [1] 658767 abort (core dumped) ./gdb -q -nx --data-directory=data-directory Change-Id: Iadfdcd131425bd2ca6a2de30d7b22e9b3cc67793
2021-01-01Update copyright year range in all GDB filesJoel Brobecker1-1/+1
This commits the result of running gdb/copyright.py as per our Start of New Year procedure... gdb/ChangeLog Update copyright year range in copyright header of all GDB files.
2020-07-28[gdb/build] Fix Wmaybe-uninitialized in gdb_optional.hTom de Vries1-0/+2
When building with CFLAGS/CXXFLAGS="-O2 -g -Wall", we run into: ... In file included from src/gdb/exceptions.h:23, from src/gdb/utils.h:24, from src/gdb/defs.h:630, from src/gdb/record-btrace.c:22: src/gdb/ui-out.h: In function 'void btrace_insn_history(ui_out*, \ const btrace_thread_info*, const btrace_insn_iterator*, \ const btrace_insn_iterator*, gdb_disassembly_flags)': src/gdb/ui-out.h:352:18: warning: \ 'asm_list.ui_out_emit_type<ui_out_type_list>::m_uiout' may be used \ uninitialized in this function [-Wmaybe-uninitialized] 352 | m_uiout->end (Type); | ~~~~~~~~~~~~~^~~~~~ src/gdb/record-btrace.c:795:35: note: \ 'asm_list.ui_out_emit_type<ui_out_type_list>::m_uiout' was declared here 795 | gdb::optional<ui_out_emit_list> asm_list; | ^~~~~~~~ ... This is reported as PR gcc/80635 - "[8/9/10/11 regression] std::optional and bogus -Wmaybe-uninitialized warning". Silence the warning by using the workaround suggested here ( https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80635#c53 ): ... union { struct { } m_dummy; T m_item; + volatile char dont_use; // Silences -Wmaybe-uninitialized warning. }; ... Build on x86_64-linux. gdbsupport/ChangeLog: 2020-07-28 Tom de Vries <tdevries@suse.de> PR build/26281 * gdb_optional.h (class optional): Add volatile member to union contaning m_dummy and m_item.
2020-01-14Move gdbsupport to the top levelTom Tromey1-0/+219
This patch moves the gdbsupport directory to the top level. This is the next step in the ongoing project to move gdbserver to the top level. The bulk of this patch was created by "git mv gdb/gdbsupport gdbsupport". This patch then adds a build system to gdbsupport and wires it into the top level. Then it changes gdb to use the top-level build. gdbserver, on the other hand, is not yet changed. It still does its own build of gdbsupport. ChangeLog 2020-01-14 Tom Tromey <tom@tromey.com> * src-release.sh (GDB_SUPPORT_DIRS): Add gdbsupport. * MAINTAINERS: Add gdbsupport. * configure: Rebuild. * configure.ac (configdirs): Add gdbsupport. * gdbsupport: New directory, move from gdb/gdbsupport. * Makefile.def (host_modules, dependencies): Add gnulib. * Makefile.in: Rebuild. gdb/ChangeLog 2020-01-14 Tom Tromey <tom@tromey.com> * nat/x86-linux-dregs.c: Include configh.h. * nat/linux-ptrace.c: Include configh.h. * nat/linux-btrace.c: Include configh.h. * defs.h: Include config.h, bfd.h. * configure.ac: Don't source common.host. (CONFIG_OBS, CONFIG_SRCS): Remove gdbsupport files. * configure: Rebuild. * acinclude.m4: Update path. * Makefile.in (SUPPORT, LIBSUPPORT, INCSUPPORT): New variables. (CONFIG_SRC_SUBDIR): Remove gdbsupport. (INTERNAL_CFLAGS_BASE): Add INCSUPPORT. (CLIBS): Add LIBSUPPORT. (CDEPS): Likewise. (COMMON_SFILES): Remove gdbsupport files. (HFILES_NO_SRCDIR): Likewise. (stamp-version): Update path to create-version.sh. (ALLDEPFILES): Remove gdbsupport files. gdb/gdbserver/ChangeLog 2020-01-14 Tom Tromey <tom@tromey.com> * server.h: Include config.h. * gdbreplay.c: Include config.h. * configure: Rebuild. * configure.ac: Don't source common.host. * acinclude.m4: Update path. * Makefile.in (INCSUPPORT): New variable. (INCLUDE_CFLAGS): Add INCSUPPORT. (SFILES): Update paths. (version-generated.c): Update path to create-version.sh. (gdbsupport/%-ipa.o, gdbsupport/%.o): Update paths. gdbsupport/ChangeLog 2020-01-14 Tom Tromey <tom@tromey.com> * common-defs.h: Add GDBSERVER case. Update includes. * acinclude.m4, aclocal.m4, config.in, configure, configure.ac, Makefile.am, Makefile.in, README: New files. * Moved from ../gdb/gdbsupport/ Change-Id: I07632e7798635c1bab389bf885971e584fb4bb78