Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
To: "'Joel Brobecker'" <brobecker@adacore.com>
Cc: <gdb-patches@sourceware.org>
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	[thread overview]
Message-ID: <004001cb5402$2ba93b90$82fbb2b0$@muller@ics-cnrs.unistra.fr> (raw)
In-Reply-To: <000c01cb53e1$56476e60$02d64b20$@muller@ics-cnrs.unistra.fr>

  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  <muller@ics.u-strasbg.fr>

	* 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 <sys/ptrace.h>
+#include <sys/utsname.h>
 #include <machine/save_state.h>
 
 #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 <sys/utsname.h>
 #include <string.h>
 
 #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


  reply	other threads:[~2010-09-14 11:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-10 15:43 [RFA 5/5] New patches to support --enable-targets=all for mingw64 Pierre Muller
2010-09-13 19:14 ` Joel Brobecker
2010-09-14 11:44   ` Pierre Muller
2010-09-14 15:24     ` Pierre Muller [this message]
2010-09-27 17:34       ` [PING][RFC] hpux code fix ( was [RFA 5/5] New patches to support --enable-targets=all for mingw64) Pierre Muller
2010-09-27 17:43         ` Pedro Alves
2010-09-14 19:39     ` [RFA 5/5] New patches to support --enable-targets=all for mingw64 Joel Brobecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='004001cb5402$2ba93b90$82fbb2b0$@muller@ics-cnrs.unistra.fr' \
    --to=pierre.muller@ics-cnrs.unistra.fr \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox