From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6780 invoked by alias); 24 Jul 2011 15:59:59 -0000 Received: (qmail 6769 invoked by uid 22791); 24 Jul 2011 15:59:57 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_SOFTFAIL X-Spam-Check-By: sourceware.org Received: from mail-pz0-f52.google.com (HELO mail-pz0-f52.google.com) (209.85.210.52) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 24 Jul 2011 15:59:42 +0000 Received: by pzd13 with SMTP id 13so6313462pzd.25 for ; Sun, 24 Jul 2011 08:59:42 -0700 (PDT) Received: by 10.68.32.202 with SMTP id l10mr6277833pbi.138.1311523181849; Sun, 24 Jul 2011 08:59:41 -0700 (PDT) Received: from localhost.localdomain ([203.110.240.178]) by mx.google.com with ESMTPS id p7sm3758423pbn.65.2011.07.24.08.59.38 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 24 Jul 2011 08:59:41 -0700 (PDT) From: Sanjoy Das To: gdb-patches@sourceware.org Cc: Sanjoy Das Subject: [PATCH 1/4] Adds a new header file, jit-reader.h.in. Date: Sun, 24 Jul 2011 16:00:00 -0000 Message-Id: <1311523427-20501-2-git-send-email-sanjoy@playingwithpointers.com> In-Reply-To: <1311523427-20501-1-git-send-email-sanjoy@playingwithpointers.com> References: <1311523427-20501-1-git-send-email-sanjoy@playingwithpointers.com> X-IsSubscribed: yes 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 X-SW-Source: 2011-07/txt/msg00667.txt.bz2 jit-reader.h.in will host the interface to be implemented and the API to be used by the reader. The file needs to be processed by ./configure to get the correct typedef for GDB_CORE_ADDR. This commit also adds a #define to config.in - GDB_JIT_READER_PATH. This is the default location in the filesystem from which the readers are loaded. The configure script is also modified to replace HOST_U_64_BIT with a correct data-type in jit-reader.h.in. gdb/ChangeLog * jit-reader.h.in: New header. * config.in: Add GDB_JIT_READER_PATH. * configure.ac: Compute HOST_U_64_BIT (jit-reader.h.in) and GDB_JIT_READER_PATH. --- gdb/ChangeLog | 6 ++ gdb/Makefile.in | 13 ++++-- gdb/config.in | 3 + gdb/configure | 132 +++++++++++++++++++++++++++++++++++++++++++++++++++ gdb/configure.ac | 27 ++++++++++ gdb/jit-reader.h.in | 53 ++++++++++++++++++++ 6 files changed, 230 insertions(+), 4 deletions(-) create mode 100644 gdb/jit-reader.h.in diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3ba870b..2cc82bc 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2011-07-24 Sanjoy Das + + * jit-reader.h.in: New header. + * config.in: Add HAVE_LIBDL and GDB_JIT_READER_PATH. + * configure.ac: Check for libdl. Compute HOST_U_64_BIT (jit-reader.h.in) and GDB_JIT_READER_PATH. + 2011-07-23 Paul Pluzhnikov * elfread.c (elf_rel_plt_read): Fix off-by-one bug. diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 46593e3..7ed6136 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -824,7 +824,7 @@ common/linux-osdata.h # Header files that already have srcdir in them, or which are in objdir. -HFILES_WITH_SRCDIR = ../bfd/bfd.h +HFILES_WITH_SRCDIR = ../bfd/bfd.h jit-reader.h # GDB "info" files, which should be included in their entirety @@ -941,7 +941,7 @@ DISTSTUFF = $(YYFILES) # All generated files which can be included by another file. -generated_files = config.h observer.h observer.inc ada-lex.c \ +generated_files = config.h observer.h observer.inc ada-lex.c jit-reader.h \ $(GNULIB_H) $(NAT_GENERATED_FILES) .c.o: @@ -1026,7 +1026,9 @@ install-only: $(CONFIG_INSTALL) $(SHELL) $(srcdir)/../mkinstalldirs \ $(DESTDIR)$(man1dir) ; \ $(INSTALL_DATA) $(srcdir)/gdb.1 \ - $(DESTDIR)$(man1dir)/$$transformed_name.1 + $(DESTDIR)$(man1dir)/$$transformed_name.1 ; \ + $(SHELL) $(srcdir)/../mkinstalldirs $(includedir)/gdb ; \ + $(INSTALL_DATA) jit-reader.h $(includedir)/gdb/jit-reader.h @$(MAKE) DO=install "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do .PHONY: install-tui install-tui: @@ -1254,7 +1256,7 @@ distclean: clean rm -f gdbserver/config.status gdbserver/config.log rm -f gdbserver/tm.h gdbserver/xm.h gdbserver/nm.h rm -f gdbserver/Makefile gdbserver/config.cache - rm -f nm.h config.status config.h stamp-h .gdbinit + rm -f nm.h config.status config.h stamp-h .gdbinit jit-reader.h rm -f y.output yacc.acts yacc.tmp y.tab.h rm -f config.log config.cache rm -f Makefile @@ -1320,6 +1322,9 @@ data-directory/Makefile: data-directory/Makefile.in config.status @frags@ CONFIG_LINKS= \ $(SHELL) config.status +jit-reader.h: $(srcdir)/jit-reader.h.in + $(SHELL) config.status $@ + config.h: stamp-h ; @true stamp-h: $(srcdir)/config.in config.status CONFIG_HEADERS=config.h:config.in \ diff --git a/gdb/config.in b/gdb/config.in index c1d7c68..8862144 100644 --- a/gdb/config.in +++ b/gdb/config.in @@ -982,3 +982,6 @@ /* Define as `fork' if `vfork' does not work. */ #undef vfork + +/* The directory to search for JIT debug info reader plugins. */ +#undef GDB_JIT_READER_PATH diff --git a/gdb/configure b/gdb/configure index ac143e4..3d984c7 100755 --- a/gdb/configure +++ b/gdb/configure @@ -666,6 +666,7 @@ python_prog_path LTLIBEXPAT LIBEXPAT HAVE_LIBEXPAT +HOST_U_64_BIT READLINE_TEXI_INCFLAG READLINE_CFLAGS READLINE_DEPS @@ -9807,6 +9808,136 @@ fi +# Generate jit-reader.h + +# This is typedeffed to GDB_CORE_ADDR in jit-reader.h +HOST_U_64_BIT= + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of unsigned long long" >&5 +$as_echo_n "checking size of unsigned long long... " >&6; } +if test "${ac_cv_sizeof_unsigned_long_long+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (unsigned long long))" "ac_cv_sizeof_unsigned_long_long" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_unsigned_long_long" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ as_fn_set_status 77 +as_fn_error "cannot compute sizeof (unsigned long long) +See \`config.log' for more details." "$LINENO" 5; }; } + else + ac_cv_sizeof_unsigned_long_long=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_unsigned_long_long" >&5 +$as_echo "$ac_cv_sizeof_unsigned_long_long" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_UNSIGNED_LONG_LONG $ac_cv_sizeof_unsigned_long_long +_ACEOF + + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of unsigned long" >&5 +$as_echo_n "checking size of unsigned long... " >&6; } +if test "${ac_cv_sizeof_unsigned_long+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (unsigned long))" "ac_cv_sizeof_unsigned_long" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_unsigned_long" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ as_fn_set_status 77 +as_fn_error "cannot compute sizeof (unsigned long) +See \`config.log' for more details." "$LINENO" 5; }; } + else + ac_cv_sizeof_unsigned_long=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_unsigned_long" >&5 +$as_echo "$ac_cv_sizeof_unsigned_long" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_UNSIGNED_LONG $ac_cv_sizeof_unsigned_long +_ACEOF + + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of unsigned __int128" >&5 +$as_echo_n "checking size of unsigned __int128... " >&6; } +if test "${ac_cv_sizeof_unsigned___int128+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (unsigned __int128))" "ac_cv_sizeof_unsigned___int128" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_unsigned___int128" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ as_fn_set_status 77 +as_fn_error "cannot compute sizeof (unsigned __int128) +See \`config.log' for more details." "$LINENO" 5; }; } + else + ac_cv_sizeof_unsigned___int128=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_unsigned___int128" >&5 +$as_echo "$ac_cv_sizeof_unsigned___int128" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_UNSIGNED___INT128 $ac_cv_sizeof_unsigned___int128 +_ACEOF + + + +if test "x${ac_cv_sizeof_unsigned_long}" = "x8"; then + HOST_U_64_BIT="unsigned long" +elif test "x${ac_cv_sizeof_unsigned_long_long}" = "x8"; then + HOST_U_64_BIT="unsigned long long" +elif test "x${ac_cv_sizeof_unsigned___int128}" = "x16"; then + HOST_U_64_BIT="unsigned __int128" +else + as_fn_error "could not find a 64 bit integer type" "$LINENO" 5 +fi + +# The default path from which to load readers +GDB_JIT_READER_PATH="${prefix}/lib/gdb" + +cat >>confdefs.h <<_ACEOF +#define GDB_JIT_READER_PATH "$GDB_JIT_READER_PATH" +_ACEOF + + + +ac_config_files="$ac_config_files jit-reader.h:jit-reader.h.in" + + # Check whether --with-expat was given. if test "${with_expat+set}" = set; then : @@ -16717,6 +16848,7 @@ do "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h:config.in" ;; "depdir") CONFIG_COMMANDS="$CONFIG_COMMANDS depdir" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "jit-reader.h") CONFIG_FILES="$CONFIG_FILES jit-reader.h:jit-reader.h.in" ;; "$ac_config_links_1") CONFIG_LINKS="$CONFIG_LINKS $ac_config_links_1" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; ".gdbinit") CONFIG_FILES="$CONFIG_FILES .gdbinit:gdbinit.in" ;; diff --git a/gdb/configure.ac b/gdb/configure.ac index 8c12a44..19263c1 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -573,6 +573,33 @@ AC_SUBST(READLINE_DEPS) AC_SUBST(READLINE_CFLAGS) AC_SUBST(READLINE_TEXI_INCFLAG) +# Generate jit-reader.h + +# This is typedeffed to GDB_CORE_ADDR in jit-reader.h +HOST_U_64_BIT= + +AC_CHECK_SIZEOF(unsigned long long) +AC_CHECK_SIZEOF(unsigned long) +AC_CHECK_SIZEOF(unsigned __int128) + +if test "x${ac_cv_sizeof_unsigned_long}" = "x8"; then + HOST_U_64_BIT="unsigned long" +elif test "x${ac_cv_sizeof_unsigned_long_long}" = "x8"; then + HOST_U_64_BIT="unsigned long long" +elif test "x${ac_cv_sizeof_unsigned___int128}" = "x16"; then + HOST_U_64_BIT="unsigned __int128" +else + AC_MSG_ERROR([could not find a 64 bit integer type]) +fi + +# The default path from which to load readers +GDB_JIT_READER_PATH="${prefix}/lib/gdb" +AC_DEFINE_UNQUOTED(GDB_JIT_READER_PATH, "$GDB_JIT_READER_PATH", + [The directory to look for JIT debug info readers]) + +AC_SUBST(HOST_U_64_BIT) +AC_CONFIG_FILES([jit-reader.h:jit-reader.h.in]) + AC_ARG_WITH(expat, AS_HELP_STRING([--with-expat], [include expat support (auto/yes/no)]), [], [with_expat=auto]) diff --git a/gdb/jit-reader.h.in b/gdb/jit-reader.h.in new file mode 100644 index 0000000..94f9a95 --- /dev/null +++ b/gdb/jit-reader.h.in @@ -0,0 +1,53 @@ +/* JIT declarations for GDB, the GNU Debugger. + + Copyright (C) 2011 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#ifndef GDB_JIT_READER_H +#define GDB_JIT_READER_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* For the reader to be correctly loaded and used, some versioning information + needs to be added to the shared object. This is done by invoking the macro + GDB_DECLARE_READER_INTERFACE_VERSION in a source file. */ +#define GDB_READER_INTERFACE_VERSION 1 +#define GDB_DECLARE_READER_INTERFACE_VERSION \ + extern int __gdb_reader_interface_version (void) \ + { \ + return GDBJIT_INTERFACE_VERSION; \ + } + +/* Readers must be released under a GPL compatible license. To declare that the + reader is indeed released under a GPL compatible license, invoke the macro + GDB_DECLARE_GPL_COMPATIBLE in a source file. */ +#define GDB_DECLARE_GPL_COMPATIBLE_READER \ + extern int plugin_is_GPL_compatible (void) \ + { \ + return 0; \ + } \ + +/* Represents an address on the target system. */ +typedef @HOST_U_64_BIT@ GDB_CORE_ADDR; + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif -- 1.7.5.4