From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10164 invoked by alias); 9 Feb 2015 23:20:54 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 10144 invoked by uid 89); 9 Feb 2015 23:20:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 09 Feb 2015 23:20:49 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t19NKmHs011441 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 9 Feb 2015 18:20:48 -0500 Received: from brno.lan (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t19NKkuP026307 for ; Mon, 9 Feb 2015 18:20:47 -0500 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 00/36] Support building GDB as a C++ program Date: Mon, 09 Feb 2015 23:20:00 -0000 Message-Id: <1423524046-20605-1-git-send-email-palves@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SW-Source: 2015-02/txt/msg00202.txt.bz2 I'm glad to announce that the global maintainers have reached consensus on converting GDB to use C++ as implementation language. See the project page here: https://sourceware.org/gdb/wiki/cxx-conversion This series implements the first parts of the transition plan described in that page. Namely: - Add a --enable-build-with-cxx option (default: no) to compile GDB and GDBserver with a C++ compiler, keeping the support for building with a C compiler. - Modify GDB and GDBserver so they can be compiled in C++ mode, using G++'s '-fpermissive' option as shortcut. - Split the TRY_CATCH macro into TRY/CATCH macros to better map to C++'s 'throw'/'try...catch' in C++ mode, and eliminate all the volatile gdb_exception objects. Some of the patches in the series are generated with scripts. You'll find those here: git@github.com:palves/gdb-refactoring-scripts.git master Web browsable here: https://github.com/palves/gdb-refactoring-scripts I have regtested/built this on x86_64 Fedora 20 (only). Known problems: . Other hosts/native targets will naturally stumble on more host-specific code that needs converting, which I can't easily test. Help very much welcome! . '--enable-targets=all' doesn't link yet in C++ mode. This just more extern "C" problems. These are the kinds of things that we can fix incrementally in mainline. Tested on x86_64 Fedora 20, native and gdbserver, both C and C++ modes. For convenience, you can also find this series here: git@github.com:palves/gdb.git palves/cxx-conversion-attempt Web version: https://github.com/palves/gdb/commits/palves/cxx-conversion-attempt I wrote a second series a few months ago that built on an older version of this one and fixes all the '-fpermissive' errors/warnings, until GDB and GDBserver build cleanly with -Werror, on x86_64 Fedora. It's naturally rotten in a few places by now, and in need of some further cleaning up but it shouldn't be that far off. You can find it here: https://github.com/palves/gdb/commits/palves/cxx-conversion-attempt-part-2-no-fpermissive git@github.com:palves/gdb.git palves/cxx-conversion-attempt-part-2-no-fpermissive Pedro Alves (31): Create libiberty/libiberty.m4 Add --enable-build-with-cxx configure switch C++ keyword cleanliness, mostly auto-generated record-btrace.c: Remove redefinitions Make array object extern elf-bfd.h: Wrap in extern "C". floatformat.h: Wrap in extern "C". Add extern "C" to declarations of C symbols Make functions and variables exported by the IPA be extern "C" proc-service, extern "C" target.h: Include infrun.h Don't forward declare enum target_hw_bp_type x86 Linux/ptrace: fix offsetof usage in C++ mode mi/mi-cmd-stack.c|frame filters: print_values <-> ext_lang_frame_args Exported const objects gdbserver/tracepoint: Add cast sockaddr_un/sockaddr cast opcodes/microblaze: Rename 'or', 'and', 'xor' to avoid C++ conflict Remove duplicate const gdbarch.h: include regcache.h breakpoint.h: move enum ‘print_stop_action’ python/python-internal.h: enum ‘ext_lang_rc’ not defined Adjust self tests to cope with GDB built as a C++ program catch_command_errors: Remove 'mask' parameter Move exception_none to common code, and use it Normalize TRY_CATCH exception handling block Split TRY_CATCH into TRY + CATCH TRY_CATCH -> TRY+CATCH+END_CATCH everywhere TRY_CATCH -> TRY+CATCH+END_CATCH, the manual conversions more making TRY/CATCH callers look more like real C++ try/catch blocks kill volatile struct gdb_exception Make TRY/CATCH use real C++ try/catch in C++ mode Tom Tromey (5): Fix struct, union, and enum nesting in C++ Fix redefinition errors in C++ mode Do not do arithmetic on enum types Rename struct lzma_stream to avoid clash with system header quit_force: Replace TRY_CATCH wrapper macros bfd/elf-bfd.h | 7 + gdb/Makefile.in | 17 +- gdb/acinclude.m4 | 6 + gdb/ada-lang.c | 94 ++-- gdb/ada-lang.h | 2 +- gdb/ada-typeprint.c | 11 +- gdb/ada-valprint.c | 7 +- gdb/addrmap.c | 56 +-- gdb/aix-thread.c | 32 +- gdb/amd64-tdep.c | 109 +++-- gdb/arm-tdep.c | 8 +- gdb/bcache.c | 14 +- gdb/block.c | 10 +- gdb/block.h | 6 +- gdb/break-catch-throw.c | 51 +- gdb/breakpoint.c | 123 ++--- gdb/breakpoint.h | 40 +- gdb/btrace.c | 18 +- gdb/build-with-cxx.m4 | 40 ++ gdb/buildsym.c | 18 +- gdb/c-exp.y | 42 +- gdb/c-varobj.c | 38 +- gdb/cli-out.c | 4 +- gdb/cli/cli-decode.c | 110 ++--- gdb/cli/cli-decode.h | 2 +- gdb/cli/cli-interp.c | 9 +- gdb/cli/cli-script.c | 27 +- gdb/cli/cli-setshow.c | 20 +- gdb/coffread.c | 38 +- gdb/command.h | 24 +- gdb/common/agent.h | 3 +- gdb/common/cleanups.c | 12 +- gdb/common/common-defs.h | 10 + gdb/common/common-exceptions.c | 143 ++++-- gdb/common/common-exceptions.h | 102 +++- gdb/common/filestuff.c | 10 +- gdb/common/filestuff.h | 4 +- gdb/compile/compile-c-symbols.c | 47 +- gdb/compile/compile-object-run.c | 19 +- gdb/completer.c | 25 +- gdb/config.in | 45 ++ gdb/configure | 640 ++++++++++++++++++++++--- gdb/configure.ac | 36 +- gdb/continuations.c | 12 +- gdb/corelow.c | 19 +- gdb/cp-abi.c | 33 +- gdb/cp-name-parser.y | 20 +- gdb/cp-namespace.c | 63 +-- gdb/cp-support.c | 82 ++-- gdb/cp-support.h | 2 +- gdb/cp-valprint.c | 43 +- gdb/d-exp.y | 8 +- gdb/darwin-nat-info.c | 22 +- gdb/darwin-nat.c | 124 ++--- gdb/dbxread.c | 41 +- gdb/defs.h | 2 +- gdb/dwarf2-frame-tailcall.c | 6 +- gdb/dwarf2-frame.c | 56 ++- gdb/dwarf2loc.c | 17 +- gdb/dwarf2read.c | 162 ++++--- gdb/elfread.c | 8 +- gdb/environ.c | 6 +- gdb/eval.c | 33 +- gdb/event-loop.c | 7 +- gdb/event-top.c | 12 +- gdb/exceptions.c | 20 +- gdb/exceptions.h | 3 - gdb/f-exp.y | 16 +- gdb/f-valprint.c | 11 +- gdb/features/feature_to_c.sh | 8 +- gdb/frame-unwind.c | 27 +- gdb/frame.c | 47 +- gdb/gcore.c | 13 +- gdb/gdb_proc_service.h | 11 + gdb/gdbarch.c | 22 +- gdb/gdbarch.h | 2 + gdb/gdbarch.sh | 24 +- gdb/gdbserver/Makefile.in | 16 +- gdb/gdbserver/acinclude.m4 | 6 + gdb/gdbserver/config.in | 41 ++ gdb/gdbserver/configure | 708 +++++++++++++++++++++++++++- gdb/gdbserver/configure.ac | 34 +- gdb/gdbserver/gdb_proc_service.h | 79 ++++ gdb/gdbserver/inferiors.h | 2 +- gdb/gdbserver/linux-aarch64-low.c | 4 +- gdb/gdbserver/linux-amd64-ipa.c | 2 +- gdb/gdbserver/linux-arm-low.c | 10 +- gdb/gdbserver/linux-i386-ipa.c | 2 +- gdb/gdbserver/linux-low.c | 20 +- gdb/gdbserver/linux-mips-low.c | 58 +-- gdb/gdbserver/linux-x86-low.c | 28 +- gdb/gdbserver/lynx-low.c | 12 +- gdb/gdbserver/proc-service.c | 4 +- gdb/gdbserver/server.c | 38 +- gdb/gdbserver/thread-db.c | 42 +- gdb/gdbserver/tracepoint.c | 188 ++++---- gdb/gdbserver/tracepoint.h | 50 +- gdb/gdbthread.h | 2 +- gdb/gdbtypes.c | 62 +-- gdb/gdbtypes.h | 573 +++++++++++----------- gdb/gnu-v3-abi.c | 44 +- gdb/go-exp.y | 8 +- gdb/guile/guile-internal.h | 6 +- gdb/guile/guile.c | 20 +- gdb/guile/scm-block.c | 9 +- gdb/guile/scm-breakpoint.c | 79 +++- gdb/guile/scm-cmd.c | 9 +- gdb/guile/scm-disasm.c | 9 +- gdb/guile/scm-frame.c | 169 ++++--- gdb/guile/scm-lazy-string.c | 15 +- gdb/guile/scm-math.c | 38 +- gdb/guile/scm-param.c | 19 +- gdb/guile/scm-ports.c | 9 +- gdb/guile/scm-pretty-print.c | 7 +- gdb/guile/scm-symbol.c | 68 ++- gdb/guile/scm-symtab.c | 9 +- gdb/guile/scm-type.c | 105 +++-- gdb/guile/scm-utils.c | 12 +- gdb/guile/scm-value.c | 244 +++++++--- gdb/hppa-linux-tdep.c | 14 +- gdb/i386-tdep.c | 36 +- gdb/ia64-tdep.c | 30 +- gdb/inf-loop.c | 15 +- gdb/inf-ttrace.c | 32 +- gdb/infcall.c | 13 +- gdb/infcmd.c | 21 +- gdb/inferior.c | 2 +- gdb/inferior.h | 2 +- gdb/infrun.c | 23 +- gdb/jit.c | 32 +- gdb/jv-exp.y | 24 +- gdb/linespec.c | 21 +- gdb/linux-nat.c | 6 +- gdb/linux-tdep.c | 12 +- gdb/linux-thread-db.c | 73 +-- gdb/m32c-tdep.c | 35 +- gdb/macrotab.c | 14 +- gdb/main.c | 101 ++-- gdb/maint.c | 10 +- gdb/mdebugread.c | 54 +-- gdb/memattr.c | 24 +- gdb/mi/mi-cmd-stack.c | 48 +- gdb/mi/mi-cmd-var.c | 14 +- gdb/mi/mi-interp.c | 24 +- gdb/mi/mi-main.c | 15 +- gdb/minidebug.c | 22 +- gdb/minsyms.c | 20 +- gdb/nat/linux-ptrace.c | 2 +- gdb/nat/x86-dregs.c | 4 +- gdb/nat/x86-dregs.h | 3 +- gdb/nto-procfs.c | 16 +- gdb/nto-tdep.c | 6 +- gdb/objc-lang.c | 68 +-- gdb/p-exp.y | 10 +- gdb/p-valprint.c | 24 +- gdb/parse.c | 27 +- gdb/parser-defs.h | 2 +- gdb/ppc-linux-tdep.c | 10 +- gdb/ppcnbsd-tdep.c | 4 +- gdb/printcmd.c | 64 +-- gdb/prologue-value.h | 41 +- gdb/psymtab.c | 22 +- gdb/python/py-arch.c | 10 +- gdb/python/py-block.c | 13 +- gdb/python/py-bpevent.c | 5 +- gdb/python/py-breakpoint.c | 60 ++- gdb/python/py-cmd.c | 11 +- gdb/python/py-continueevent.c | 5 +- gdb/python/py-event.h | 5 +- gdb/python/py-evtregistry.c | 4 +- gdb/python/py-exitedevent.c | 5 +- gdb/python/py-finishbreakpoint.c | 51 +- gdb/python/py-frame.c | 162 ++++--- gdb/python/py-framefilter.c | 134 +++--- gdb/python/py-function.c | 4 +- gdb/python/py-gdb-readline.c | 19 +- gdb/python/py-inferior.c | 47 +- gdb/python/py-infevents.c | 20 +- gdb/python/py-infthread.c | 13 +- gdb/python/py-lazy-string.c | 13 +- gdb/python/py-linetable.c | 21 +- gdb/python/py-newobjfileevent.c | 10 +- gdb/python/py-objfile.c | 22 +- gdb/python/py-param.c | 11 +- gdb/python/py-prettyprint.c | 16 +- gdb/python/py-progspace.c | 4 +- gdb/python/py-signalevent.c | 5 +- gdb/python/py-stopevent.c | 3 +- gdb/python/py-symbol.c | 67 ++- gdb/python/py-symtab.c | 8 +- gdb/python/py-threadevent.c | 3 +- gdb/python/py-type.c | 164 ++++--- gdb/python/py-utils.c | 9 +- gdb/python/py-value.c | 228 ++++++--- gdb/python/python-internal.h | 1 + gdb/python/python.c | 89 ++-- gdb/record-btrace.c | 100 ++-- gdb/remote-mips.c | 4 +- gdb/remote.c | 97 ++-- gdb/rs6000-aix-tdep.c | 7 +- gdb/rs6000-tdep.c | 13 +- gdb/s390-linux-tdep.c | 19 +- gdb/solib-darwin.c | 20 +- gdb/solib-dsbt.c | 8 +- gdb/solib-frv.c | 8 +- gdb/solib-ia64-hpux.c | 26 +- gdb/solib-pa64.c | 28 +- gdb/solib-som.c | 58 +-- gdb/solib-spu.c | 30 +- gdb/solib-svr4.c | 104 ++-- gdb/solib.c | 58 ++- gdb/sparc-sol2-tdep.c | 2 +- gdb/stabsread.c | 100 ++-- gdb/stack.c | 135 +++--- gdb/stap-probe.c | 4 +- gdb/symfile-debug.c | 6 +- gdb/symfile.h | 20 +- gdb/symtab.c | 118 ++--- gdb/target-descriptions.c | 54 ++- gdb/target.c | 6 +- gdb/target.h | 2 + gdb/testsuite/gdb.gdb/complaints.exp | 6 +- gdb/testsuite/gdb.gdb/python-interrupts.exp | 2 +- gdb/testsuite/gdb.gdb/python-selftest.exp | 2 +- gdb/testsuite/gdb.gdb/selftest.exp | 6 +- gdb/thread.c | 10 +- gdb/top.c | 43 +- gdb/tracefile-tfile.c | 6 +- gdb/tui/tui-data.c | 4 +- gdb/tui/tui-data.h | 8 +- gdb/tui/tui-layout.c | 8 +- gdb/tui/tui-win.c | 8 +- gdb/tui/tui-windata.c | 2 +- gdb/tui/tui-wingeneral.c | 2 +- gdb/tui/tui.c | 6 +- gdb/typeprint.c | 24 +- gdb/ui-file.h | 2 +- gdb/valarith.c | 6 +- gdb/valops.c | 13 +- gdb/valprint.c | 10 +- gdb/value.c | 140 +++--- gdb/varobj.c | 99 ++-- gdb/varobj.h | 4 +- gdb/x86-linux-nat.c | 17 +- gdb/xcoffread.c | 30 +- gdb/xml-support.c | 12 +- gdb/xtensa-tdep.h | 14 +- include/floatformat.h | 8 + libiberty/libiberty.m4 | 33 ++ opcodes/microblaze-opc.h | 6 +- opcodes/microblaze-opcm.h | 4 +- 251 files changed, 6281 insertions(+), 3484 deletions(-) create mode 100644 gdb/build-with-cxx.m4 mode change 100644 => 100755 gdb/features/feature_to_c.sh create mode 100644 libiberty/libiberty.m4 -- 1.9.3