* solib-som.h (hpux_major_release): Declare variable here.

* solib-som.c:  Remove <sys/utsname.h> header.
	(DEFAULT_HPUX_MAJOR_RELEASE): New macro.
	(hpux_major_release): Make global, change default value to
	DEFAULT_HPUX_MAJOR_RELEASE.
	(get_hpux_major_release): Simply return HPUX_MAJOR_RELEASE.
	* hppa-hpux-nat.c: Add <sys/utsname.h> include.
	Add "solib-som.h" header.
	(set_hpux_major_release): New function.
	(_initialize_hppa_hpux_nat): Call set_hpux_major_release.
This commit is contained in:
Pierre Muller 2011-01-14 18:39:31 +00:00
parent 4e18c05334
commit 7b64a93b03
4 changed files with 47 additions and 15 deletions

View File

@ -1,3 +1,16 @@
2011-01-14 Pierre Muller <muller@ics.u-strasbg.fr>
* solib-som.h (hpux_major_release): Declare variable here.
* solib-som.c: Remove <sys/utsname.h> header.
(DEFAULT_HPUX_MAJOR_RELEASE): New macro.
(hpux_major_release): Make global, change default value to
DEFAULT_HPUX_MAJOR_RELEASE.
(get_hpux_major_release): Simply return HPUX_MAJOR_RELEASE.
* hppa-hpux-nat.c: Add <sys/utsname.h> include.
Add "solib-som.h" header.
(set_hpux_major_release): New function.
(_initialize_hppa_hpux_nat): Call set_hpux_major_release.
2011-01-14 Mike Frysinger <vapier@gentoo.org>
* configure.tgt (*-*-uclinux*): Match more Linux os targets

View File

@ -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"
@ -233,6 +235,21 @@ hppa_hpux_store_inferior_registers (struct target_ops *ops,
hppa_hpux_store_register (regcache, regnum);
}
/* Set hpux_major_release variable to the value retrieved from a call to
uname function. */
static void
set_hpux_major_release (void)
{
struct utsname x;
char *p;
uname (&x);
p = strchr (x.release, '.');
if (p)
hpux_major_release = atoi (p + 1);
}
/* Prevent warning from -Wmissing-prototypes. */
@ -243,6 +260,8 @@ _initialize_hppa_hpux_nat (void)
{
struct target_ops *t;
set_hpux_major_release ();
#ifdef HAVE_TTRACE
t = inf_ttrace_target ();
#else

View File

@ -32,7 +32,6 @@
#include "solib.h"
#include "solib-som.h"
#include <sys/utsname.h>
#include <string.h>
#undef SOLIB_SOM_DBG
@ -131,24 +130,23 @@ som_relocate_section_addresses (struct so_list *so,
;
}
/* Get HP-UX major release number. Returns zero if the
release is not known. */
/* Variable storing HP-UX major release number.
On non-native system, simply assume that the major release number
is 11. On native systems, hppa-hpux-nat.c initialization code
sets this number to the real one on startup.
We cannot compute this value here, because we need to make a native
call to "uname". We are are not allowed to do that from here, as
this file is used for both native and cross debugging. */
#define DEFAULT_HPUX_MAJOR_RELEASE 11
int hpux_major_release = DEFAULT_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;
}

View File

@ -25,6 +25,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,