* Support debugging using native MACH primitives on hppa*-*-osf*.

* configure.in: hppa*-*-osf* != hppa*-*-bsd* anymore.
	* config/pa/hppaosf.mh: New file.
	* config/pa/nm-hppao.h: Likewise.
	* hppam3-nat.c: Likewise.
	* config/pa/tm-hppao.h (PSW_SS): Define for single-stepping.
	(MACHINE_CPROC_*_OFFSET): Define.
	(TRACE_*): Define.
	(START_INFERIOR_TRAPS_EXPECTED): Delete definition.
This commit is contained in:
Jeff Law 1995-05-12 01:10:28 +00:00
parent 511cd41cc1
commit 2d2959e852
8 changed files with 241 additions and 4 deletions

View File

@ -159,6 +159,7 @@ hp300ux-nat.c
hppa-tdep.c
hppab-nat.c
hppah-nat.c
hppam3-nat.c
hpread.c
i386-stub.c
i386-tdep.c

View File

@ -1,3 +1,15 @@
Thu May 11 19:01:37 1995 Jeff Law (law@snake.cs.utah.edu)
* Support debugging using native MACH primitives on hppa*-*-osf*.
* configure.in: hppa*-*-osf* != hppa*-*-bsd* anymore.
* config/pa/hppaosf.mh: New file.
* config/pa/nm-hppao.h: Likewise.
* hppam3-nat.c: Likewise.
* config/pa/tm-hppao.h (PSW_SS): Define for single-stepping.
(MACHINE_CPROC_*_OFFSET): Define.
(TRACE_*): Define.
(START_INFERIOR_TRAPS_EXPECTED): Delete definition.
Wed May 10 18:59:26 1995 Stu Grossman (grossman@andros.cygnus.com)
* hppa-tdep.c (read_unwind_info): Cosmetic cleanup.

View File

@ -25,10 +25,12 @@ hppabsd.mh
hppabsd.mt
hppahpux.mh
hppahpux.mt
hppaosf.mh
hppaosf.mt
hppapro.mt
nm-hppab.h
nm-hppah.h
nm-hppao.h
tm-hppa.h
tm-hppab.h
tm-hppah.h

6
gdb/config/pa/hppaosf.mh Normal file
View File

@ -0,0 +1,6 @@
# Host: Hewlett-Packard PA-RISC machine, running BSD
XDEPFILES=
XM_FILE= xm-hppab.h
NAT_FILE= nm-hppao.h
NATDEPFILES= fork-child.o m3-nat.o hppam3-nat.o somread.o hpread.o somsolib.o
NAT_CLIBS= -lmachid -lnetname -lmach

56
gdb/config/pa/nm-hppao.h Normal file
View File

@ -0,0 +1,56 @@
/* HPPA PA-RISC machine native support for Lites, for GDB.
Copyright 1995 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 2 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, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "nm-m3.h"
#define U_REGS_OFFSET 0
#define KERNEL_U_ADDR 0
/* What a coincidence! */
#define REGISTER_U_ADDR(addr, blockend, regno) \
{ addr = (int)(blockend) + REGISTER_BYTE (regno);}
/* This macro defines the register numbers (from REGISTER_NAMES) that
are effectively unavailable to the user through ptrace(). It allows
us to include the whole register set in REGISTER_NAMES (inorder to
better support remote debugging). If it is used in
fetch/store_inferior_registers() gdb will not complain about I/O errors
on fetching these registers. If all registers in REGISTER_NAMES
are available, then return false (0). */
#define CANNOT_STORE_REGISTER(regno) \
((regno) == 0) || \
((regno) == PCSQ_HEAD_REGNUM) || \
((regno) >= PCSQ_TAIL_REGNUM && (regno) < IPSW_REGNUM) || \
((regno) > IPSW_REGNUM && (regno) < FP4_REGNUM)
/* fetch_inferior_registers is in hppab-nat.c. */
#define FETCH_INFERIOR_REGISTERS
/* attach/detach works to some extent under BSD and HPUX. So long
as the process you're attaching to isn't blocked waiting on io,
blocked waiting on a signal, or in a system call things work
fine. (The problems in those cases are related to the fact that
the kernel can't provide complete register information for the
target process... Which really pisses off GDB.) */
#define ATTACH_DETACH
#define EMULATOR_BASE 0x90100000
#define EMULATOR_END 0x90200000

View File

@ -2,6 +2,28 @@
Contributed by the Center for Software Science at the
University of Utah (pa-gdb-bugs@cs.utah.edu). */
/* Define offsets to access CPROC stack when it does not have
* a kernel thread.
*/
#define MACHINE_CPROC_SP_OFFSET 20
#define MACHINE_CPROC_PC_OFFSET 16
#define MACHINE_CPROC_FP_OFFSET 12
/*
* Software defined PSW masks.
*/
#define PSW_SS 0x10000000 /* Kernel managed single step */
/* Thread flavors used in re-setting the T bit.
* @@ this is also bad for cross debugging.
*/
#define TRACE_FLAVOR HP800_THREAD_STATE
#define TRACE_FLAVOR_SIZE HP800_THREAD_STATE_COUNT
#define TRACE_SET(x,state) \
((struct hp800_thread_state *)state)->cr22 |= PSW_SS
#define TRACE_CLEAR(x,state) \
((((struct hp800_thread_state *)state)->cr22 &= ~PSW_SS), 1)
/* For OSF1 (Should be close if not identical to BSD, but I haven't
tested it yet):
@ -44,9 +66,6 @@
} \
}
/* OSF1 needs an extra trap. I assume for the emulator startup (?!?) */
#define START_INFERIOR_TRAPS_EXPECTED 3
/* OSF1 does not need the pc space queue restored. */
#define NO_PC_SPACE_QUEUE_RESTORE

View File

@ -43,7 +43,7 @@ c[12]-*-*) gdb_host=convex ;;
hppa*-*-bsd*) gdb_host=hppabsd ;;
hppa*-*-hiux*) gdb_host=hppahpux ;;
hppa*-*-hpux*) gdb_host=hppahpux ;;
hppa*-*-osf*) gdb_host=hppabsd ;;
hppa*-*-osf*) gdb_host=hppaosf ;;
i[345]86-ncr-*) gdb_host=ncr3000 ;;
i[345]86-sequent-bsd*) gdb_host=symmetry ;; # dynix

141
gdb/hppam3-nat.c Normal file
View File

@ -0,0 +1,141 @@
/* Low level interface to HP800 running mach 4.0.
Copyright (C) 1995 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 2 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, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "defs.h"
#include "inferior.h"
#include "floatformat.h"
#include <stdio.h>
#include <mach.h>
#include <mach/message.h>
#include <mach/exception.h>
#include <mach_error.h>
#include <target.h>
/*
* Fetch inferiors registers for gdb.
* REGNO specifies which (as gdb views it) register, -1 for all.
*/
void
fetch_inferior_registers (regno)
int regno;
{
kern_return_t ret;
thread_state_data_t state;
unsigned int stateCnt = HP800_THREAD_STATE_COUNT;
int index;
if (! MACH_PORT_VALID (current_thread))
error ("fetch inferior registers: Invalid thread");
if (must_suspend_thread)
setup_thread (current_thread, 1);
ret = thread_get_state (current_thread,
HP800_THREAD_STATE,
state,
&stateCnt);
if (ret != KERN_SUCCESS)
warning ("fetch_inferior_registers: %s ",
mach_error_string (ret));
else
{
for (index = 0; index < NUM_REGS; index++)
supply_register (index,&state[index]);
}
if (must_suspend_thread)
setup_thread (current_thread, 0);
}
/* Store our register values back into the inferior.
* If REGNO is -1, do this for all registers.
* Otherwise, REGNO specifies which register
*
* On mach3 all registers are always saved in one call.
*/
void
store_inferior_registers (regno)
int regno;
{
kern_return_t ret;
thread_state_data_t state;
unsigned int stateCnt = HP800_THREAD_STATE_COUNT;
register int index;
if (! MACH_PORT_VALID (current_thread))
error ("store inferior registers: Invalid thread");
if (must_suspend_thread)
setup_thread (current_thread, 1);
/* Fetch the state of the current thread */
ret = thread_get_state (current_thread,
HP800_THREAD_STATE,
state,
&stateCnt);
if (ret != KERN_SUCCESS)
{
warning ("store_inferior_registers (get): %s",
mach_error_string (ret));
if (must_suspend_thread)
setup_thread (current_thread, 0);
return;
}
/* move gdb's registers to thread's state
*
* Since we save all registers anyway, save the ones
* that gdb thinks are valid (e.g. ignore the regno
* parameter)
*/
if (regno > 0 && regno < NUM_REGS )
{
memcpy(&state[regno], &registers[REGISTER_BYTE (regno)],
REGISTER_RAW_SIZE(regno));
}
else
{
for (index = 0; index < NUM_REGS; index++)
memcpy(&state[index], &registers[REGISTER_BYTE (index)],
REGISTER_RAW_SIZE(index));
/* state[index] = registers[REGISTER_BYTE (index)];*/
}
/* Write gdb's current view of register to the thread
*/
ret = thread_set_state (current_thread,
HP800_THREAD_STATE,
state,
HP800_THREAD_STATE_COUNT);
if (ret != KERN_SUCCESS)
warning ("store_inferior_registers (set): %s",
mach_error_string (ret));
if (must_suspend_thread)
setup_thread (current_thread, 0);
}