From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19809 invoked by alias); 14 Sep 2010 11:44:49 -0000 Received: (qmail 19796 invoked by uid 22791); 14 Sep 2010 11:44:48 -0000 X-SWARE-Spam-Status: No, hits=-1.2 required=5.0 tests=AWL,BAYES_00,MSGID_MULTIPLE_AT,TW_BJ X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.157) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 14 Sep 2010 11:44:43 +0000 Received: from md2.u-strasbg.fr (md2.u-strasbg.fr [IPv6:2001:660:2402::187]) by mailhost.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id o8EBiH4i061620 ; Tue, 14 Sep 2010 13:44:18 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from mailserver.u-strasbg.fr (ms5.u-strasbg.fr [IPv6:2001:660:2402:d::14]) by md2.u-strasbg.fr (8.14.4/jtpda-5.5pre1) with ESMTP id o8EBiH2T025604 ; Tue, 14 Sep 2010 13:44:17 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from d620muller (gw-ics.u-strasbg.fr [130.79.210.225]) (user=mullerp mech=LOGIN) by mailserver.u-strasbg.fr (8.14.4/jtpda-5.5pre1) with ESMTP id o8EBiGjY015746 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) ; Tue, 14 Sep 2010 13:44:16 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) From: "Pierre Muller" To: "'Joel Brobecker'" Cc: References: <004201cb50f2$18d8f310$4a8ad930$@muller@ics-cnrs.unistra.fr> <20100913181100.GC3845@adacore.com> <000c01cb53e1$56476e60$02d64b20$@muller@ics-cnrs.unistra.fr> In-Reply-To: <000c01cb53e1$56476e60$02d64b20$@muller@ics-cnrs.unistra.fr> Subject: [RFC] hpux code fix ( was [RFA 5/5] New patches to support --enable-targets=all for mingw64) Date: Tue, 14 Sep 2010 15:24:00 -0000 Message-ID: <004001cb5402$2ba93b90$82fbb2b0$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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: 2010-09/txt/msg00265.txt.bz2 I finally wrote a patch that moves the OS specific uname call to hppa-hpux-nat.c and adds a new set/show command allowing to override the default hpux_major_release version (that I set to 11). The only trouble is that I have no way to test this patch for the native part... The compilation with --enable-targets=all works and the tdep parts seem to work as expected. Could someone test this out? Comments welcome, Pierre Muller Pascal language support maintainer for GDB ChangeLog entry: 2010-09-14 Pierre Muller * solib-som.h (hpux_major_release): Declare new external variable. * hppa-hpux-nat.c: Add sys/utsname.h include. (_initialize_hppa_hpux_nat): Set default value of hpux_major_release to ouptut of uname call. * solib-som.c: Remove HPUX specific code. (DEFAULT_HPUX_MAJOR_RELEASE): New macro. (hpux_major_release): New global variable. (show_hpux_major_release): New function. (get_hpux_major_release): Simply return current HPUX_MAJOR_RELEASE. (_initialize_som_solib): Add new set/show commands hpux-major-release. Index: solib-som.h =================================================================== RCS file: /cvs/src/src/gdb/solib-som.h,v retrieving revision 1.8 diff -u -p -r1.8 solib-som.h --- solib-som.h 1 Jan 2010 07:31:41 -0000 1.8 +++ solib-som.h 14 Sep 2010 10:37:04 -0000 @@ -24,6 +24,8 @@ struct objfile; struct section_offsets; struct gdbarch; +extern int hpux_major_release; + void som_solib_select (struct gdbarch *gdbarch); int som_solib_section_offsets (struct objfile *objfile, Index: hppa-hpux-nat.c =================================================================== RCS file: /cvs/src/src/gdb/hppa-hpux-nat.c,v retrieving revision 1.20 diff -u -p -r1.20 hppa-hpux-nat.c --- hppa-hpux-nat.c 1 Jan 2010 07:31:33 -0000 1.20 +++ hppa-hpux-nat.c 14 Sep 2010 10:37:04 -0000 @@ -25,6 +25,7 @@ #include "gdb_assert.h" #include +#include #include #ifdef HAVE_TTRACE @@ -32,6 +33,7 @@ #endif #include "hppa-tdep.h" +#include "solib-som.h" #include "inf-ptrace.h" #include "inf-ttrace.h" @@ -254,7 +256,12 @@ void _initialize_hppa_hpux_nat (void) { struct target_ops *t; + struct utsname x; + char *p; + uname (&x); + p = strchr (x.release, '.'); + hpux_major_release = p ? atoi (p + 1) : 11; #ifdef HAVE_TTRACE t = inf_ttrace_target (); #else Index: solib-som.c =================================================================== RCS file: /cvs/src/src/gdb/solib-som.c,v retrieving revision 1.29 diff -u -p -r1.29 solib-som.c --- solib-som.c 16 May 2010 23:49:58 -0000 1.29 +++ solib-som.c 14 Sep 2010 10:37:04 -0000 @@ -26,13 +26,14 @@ #include "gdbcore.h" #include "target.h" #include "inferior.h" +#include "command.h" +#include "gdbcmd.h" #include "hppa-tdep.h" #include "solist.h" #include "solib.h" #include "solib-som.h" -#include #include #undef SOLIB_SOM_DBG @@ -133,21 +134,22 @@ som_relocate_section_addresses (struct s /* Get HP-UX major release number. Returns zero if the release is not known. */ +#define DEFAULT_HPUX_MAJOR_RELEASE 11 +int +hpux_major_release = DEFAULT_HPUX_MAJOR_RELEASE; + +static void +show_hpux_major_release (struct ui_file *file, int from_tty, + struct cmd_list_element *c, const char *value) +{ + fprintf_filtered (file, _("\ +Currently assumed major release version for HPUX is %d.\n"), + hpux_major_release); +} + static int get_hpux_major_release (void) { - static int hpux_major_release = -1; - - if (hpux_major_release == -1) - { - struct utsname x; - char *p; - - uname (&x); - p = strchr (x.release, '.'); - hpux_major_release = p ? atoi (p + 1) : 0; - } - return hpux_major_release; } @@ -810,6 +812,13 @@ _initialize_som_solib (void) som_so_ops.open_symbol_file_object = som_open_symbol_file_object; som_so_ops.in_dynsym_resolve_code = som_in_dynsym_resolve_code; som_so_ops.bfd_open = solib_bfd_open; + add_setshow_integer_cmd ("hpux-major-release", class_support, + &hpux_major_release, _("\ +Set assumed HPUX major release version."), _("\ +Show assumed HPUX major release version."), NULL, + NULL, + show_hpux_major_release, + &setlist, &showlist); } void