* m3-nat.c, i386m3-nat.c, config/i386/i386m3.mh: Many minor

changes to make it compile (it doesn't link yet).
This commit is contained in:
Jim Kingdon 1994-03-26 04:20:44 +00:00
parent 8babef8561
commit 493424b108
4 changed files with 93 additions and 40 deletions

View File

@ -1,5 +1,14 @@
Fri Mar 25 12:40:41 1994 Jim Kingdon (kingdon@lioth.cygnus.com) Fri Mar 25 12:40:41 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
* m3-nat.c, i386m3-nat.c, config/i386/i386m3.mh: Many minor
changes to make it compile (it doesn't link yet).
* buildsym.c (start_subfile, patch_subfile_names), demangle.c
(set_demangling_style, set_demangling_command): Use savestring not
strdup. We were not dealing properly with a NULL return from
strdup, and were not declaring strdup (the system header may or
may not have it).
* valprint.c (val_print): Remove inaccurate comment about what * valprint.c (val_print): Remove inaccurate comment about what
types can be stub types. types can be stub types.

View File

@ -1,7 +1,8 @@
# Host: Intel 386 running Mach3 # Host: Intel 386 running Mach3
XDEPFILES= i387-tdep.o coredep.o XDEPFILES= i387-tdep.o coredep.o
NATDEPFILES= i386m3-nat.o m3-nat.o NATDEPFILES= i386m3-nat.o m3-nat.o fork-child.o
NAT_CLIBS= -lmach
XM_FILE= xm-i386m3.h XM_FILE= xm-i386m3.h
NAT_FILE= nm-m3.h NAT_FILE= nm-m3.h

View File

@ -120,7 +120,7 @@ fetch_inferior_registers (regno)
&stateCnt); &stateCnt);
if (ret != KERN_SUCCESS) if (ret != KERN_SUCCESS)
message ("fetch_inferior_registers: %s ", warning ("fetch_inferior_registers: %s ",
mach_error_string (ret)); mach_error_string (ret));
#if 0 #if 0
/* It may be more effective to store validate all of them, /* It may be more effective to store validate all of them,
@ -168,7 +168,7 @@ store_inferior_registers (regno)
if (ret != KERN_SUCCESS) if (ret != KERN_SUCCESS)
{ {
message ("store_inferior_registers (get): %s", warning ("store_inferior_registers (get): %s",
mach_error_string (ret)); mach_error_string (ret));
if (must_suspend_thread) if (must_suspend_thread)
setup_thread (current_thread, 0); setup_thread (current_thread, 0);
@ -199,7 +199,7 @@ store_inferior_registers (regno)
i386_THREAD_STATE_COUNT); i386_THREAD_STATE_COUNT);
if (ret != KERN_SUCCESS) if (ret != KERN_SUCCESS)
message ("store_inferior_registers (set): %s", warning ("store_inferior_registers (set): %s",
mach_error_string (ret)); mach_error_string (ret));
if (must_suspend_thread) if (must_suspend_thread)
@ -362,7 +362,7 @@ get_i387_state (fstate)
if (ret != KERN_SUCCESS) if (ret != KERN_SUCCESS)
{ {
message ("Can not get live floating point state: %s", warning ("Can not get live floating point state: %s",
mach_error_string (ret)); mach_error_string (ret));
return FALSE; return FALSE;
} }
@ -411,7 +411,7 @@ i386_mach3_float_info()
if (!valid) if (!valid)
{ {
message("no floating point status saved"); warning ("no floating point status saved");
return; return;
} }

View File

@ -54,8 +54,14 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "target.h" #include "target.h"
#include "wait.h" #include "wait.h"
#include "gdbcmd.h" #include "gdbcmd.h"
#include "gdbcore.h"
#if 0
#include <servers/machid_lib.h> #include <servers/machid_lib.h>
#else
#define MACH_TYPE_TASK 1
#define MACH_TYPE_THREAD 2
#endif
/* Included only for signal names and NSIG /* Included only for signal names and NSIG
* *
@ -253,6 +259,8 @@ int must_suspend_thread = 0;
#define NULL_CLEANUP (struct cleanup *)0 #define NULL_CLEANUP (struct cleanup *)0
struct cleanup *cleanup_step = NULL_CLEANUP; struct cleanup *cleanup_step = NULL_CLEANUP;
extern struct target_ops m3_ops;
#if 0 #if 0
#define MACH_TYPE_EXCEPTION_PORT -1 #define MACH_TYPE_EXCEPTION_PORT -1
@ -986,7 +994,7 @@ select_thread (task, thread_id, flag)
if (ret != KERN_SUCCESS) if (ret != KERN_SUCCESS)
{ {
warning ("Can not select a thread from a dead task"); warning ("Can not select a thread from a dead task");
kill_inferior (); m3_kill_inferior ();
return KERN_FAILURE; return KERN_FAILURE;
} }
@ -1784,7 +1792,7 @@ mach3_read_inferior (addr, myaddr, length)
if (! port_valid (inferior_task, MACH_PORT_TYPE_SEND)) if (! port_valid (inferior_task, MACH_PORT_TYPE_SEND))
{ {
kill_inferior (); m3_kill_inferior ();
error ("Inferior killed (task port invalid)"); error ("Inferior killed (task port invalid)");
} }
else else
@ -2133,7 +2141,7 @@ fetch_thread_info (task, mthreads_out)
{ {
warning ("Error getting inferior's thread list:%s", warning ("Error getting inferior's thread list:%s",
mach_error_string(ret)); mach_error_string(ret));
kill_inferior (); m3_kill_inferior ();
return -1; return -1;
} }
@ -2279,6 +2287,8 @@ map_cprocs_to_kernel_threads (cprocs, mthreads, thread_count)
int index; int index;
gdb_thread_t scan; gdb_thread_t scan;
boolean_t all_mapped = TRUE; boolean_t all_mapped = TRUE;
LONGEST stack_base;
LONGEST stack_size;
for (scan = cprocs; scan; scan = scan->next) for (scan = cprocs; scan; scan = scan->next)
{ {
@ -2288,11 +2298,11 @@ map_cprocs_to_kernel_threads (cprocs, mthreads, thread_count)
/* Check if the cproc is found by its stack */ /* Check if the cproc is found by its stack */
for (index = 0; index < thread_count; index++) for (index = 0; index < thread_count; index++)
{ {
LONGEST stack_base = stack_base =
extract_signed_integer (scan.raw_cproc + CPROC_BASE_OFFSET, extract_signed_integer (scan->raw_cproc + CPROC_BASE_OFFSET,
CPROC_BASE_SIZE); CPROC_BASE_SIZE);
LONGEST stack_size = stack_size =
extract_signed_integer (scan.raw_cproc + CPROC_SIZE_OFFSET, extract_signed_integer (scan->raw_cproc + CPROC_SIZE_OFFSET,
CPROC_SIZE_SIZE); CPROC_SIZE_SIZE);
if ((mthreads + index)->sp > stack_base && if ((mthreads + index)->sp > stack_base &&
(mthreads + index)->sp <= stack_base + stack_size) (mthreads + index)->sp <= stack_base + stack_size)
@ -2353,13 +2363,23 @@ map_cprocs_to_kernel_threads (cprocs, mthreads, thread_count)
* the user stack pointer saved in the * the user stack pointer saved in the
* emulator. * emulator.
*/ */
if (scan->reverse_map == -1 && if (scan->reverse_map == -1)
usp > scan->stack_base &&
usp <= scan->stack_base + scan->stack_size)
{ {
mthread->cproc = scan; stack_base =
scan->reverse_map = index; extract_signed_integer
break; (scan->raw_cproc + CPROC_BASE_OFFSET,
CPROC_BASE_SIZE);
stack_size =
extract_signed_integer
(scan->raw_cproc + CPROC_SIZE_OFFSET,
CPROC_SIZE_SIZE);
if (usp > stack_base &&
usp <= stack_base + stack_size)
{
mthread->cproc = scan;
scan->reverse_map = index;
break;
}
} }
} }
} }
@ -2422,7 +2442,7 @@ lookup_address_of_variable (name)
msymbol = lookup_minimal_symbol (name, (struct objfile *) NULL); msymbol = lookup_minimal_symbol (name, (struct objfile *) NULL);
if (msymbol && msymbol->type == mst_data) if (msymbol && msymbol->type == mst_data)
symaddr = msymbol->address; symaddr = SYMBOL_VALUE_ADDRESS (msymbol);
} }
return symaddr; return symaddr;
@ -2485,16 +2505,15 @@ get_cprocs()
sizeof (struct gdb_thread)); sizeof (struct gdb_thread));
if (!mach3_read_inferior (their_cprocs, if (!mach3_read_inferior (their_cprocs,
&cproc_copy.raw_cproc[0], &cproc_copy->raw_cproc[0],
CPROC_SIZE)) CPROC_SIZE))
error("Can't read next cproc at 0x%x.", their_cprocs); error("Can't read next cproc at 0x%x.", their_cprocs);
cproc_copy = extract_address (buf, TARGET_PTR_BIT / HOST_CHAR_BIT);
their_cprocs = their_cprocs =
extract_address (cproc_copy.raw_cproc + CPROC_LIST_OFFSET, extract_address (cproc_copy->raw_cproc + CPROC_LIST_OFFSET,
CPROC_LIST_SIZE); CPROC_LIST_SIZE);
cproc_copy_incarnation = cproc_copy_incarnation =
extract_address (cproc_copy.raw_cproc + CPROC_INCARNATION_OFFSET, extract_address (cproc_copy->raw_cproc + CPROC_INCARNATION_OFFSET,
CPROC_INCARNATION_SIZE); CPROC_INCARNATION_SIZE);
if (cproc_copy_incarnation == (CORE_ADDR)0) if (cproc_copy_incarnation == (CORE_ADDR)0)
@ -2549,12 +2568,14 @@ mach3_cproc_state (mthread)
{ {
int context; int context;
if (! mthread || !mthread->cproc || !mthread->cproc->context) if (! mthread || !mthread->cproc)
return -1; return -1;
context = extract_signed_integer context = extract_signed_integer
(mthread->cproc->raw_cproc + CPROC_CONTEXT_OFFSET, (mthread->cproc->raw_cproc + CPROC_CONTEXT_OFFSET,
CPROC_CONTEXT_SIZE); CPROC_CONTEXT_SIZE);
if (context == 0)
return -1;
mthread->sp = context + MACHINE_CPROC_SP_OFFSET; mthread->sp = context + MACHINE_CPROC_SP_OFFSET;
@ -2625,6 +2646,9 @@ thread_list_command()
int mid; int mid;
char buf[10]; char buf[10];
char slot[3]; char slot[3];
int cproc_state =
extract_signed_integer
(scan->raw_cproc + CPROC_STATE_OFFSET, CPROC_STATE_SIZE);
selected = ' '; selected = ' ';
@ -2687,7 +2711,7 @@ thread_list_command()
kthread->in_emulator ? "E" : "", kthread->in_emulator ? "E" : "",
translate_state (ths.run_state), translate_state (ths.run_state),
buf, buf,
translate_cstate (scan->state), translate_cstate (cproc_state),
wired); wired);
print_tl_address (gdb_stdout, kthread->pc); print_tl_address (gdb_stdout, kthread->pc);
} }
@ -2715,7 +2739,7 @@ thread_list_command()
"", "",
"-", /* kernel state */ "-", /* kernel state */
"", "",
translate_cstate (scan->state), translate_cstate (cproc_state),
""); "");
state.cproc = scan; state.cproc = scan;
@ -2919,7 +2943,7 @@ suspend_all_threads (from_tty)
if (ret != KERN_SUCCESS) if (ret != KERN_SUCCESS)
{ {
warning ("Could not suspend inferior threads."); warning ("Could not suspend inferior threads.");
kill_inferior (); m3_kill_inferior ();
return_to_top_level (); return_to_top_level ();
} }
@ -3022,7 +3046,7 @@ resume_all_threads (from_tty)
ret = task_threads (inferior_task, &thread_list, &thread_count); ret = task_threads (inferior_task, &thread_list, &thread_count);
if (ret != KERN_SUCCESS) if (ret != KERN_SUCCESS)
{ {
kill_inferior (); m3_kill_inferior ();
error("task_threads", mach_error_string( ret)); error("task_threads", mach_error_string( ret));
} }
@ -3466,7 +3490,7 @@ mach3_exception_actions (w, force_print_only, who)
if (exception_map[stop_exception].print || force_print) if (exception_map[stop_exception].print || force_print)
{ {
int giveback = grab_terminal (); target_terminal_ours ();
printf_filtered ("\n%s received %s exception : ", printf_filtered ("\n%s received %s exception : ",
who, who,
@ -3503,9 +3527,6 @@ mach3_exception_actions (w, force_print_only, who)
default: default:
fatal ("Unknown exception"); fatal ("Unknown exception");
} }
if (giveback)
terminal_inferior ();
} }
} }
@ -3879,7 +3900,7 @@ m3_create_inferior (exec_file, allargs, env)
char *allargs; char *allargs;
char **env; char **env;
{ {
fork_inferior (exec_file, allargs, env, m3_trace_m3, m3_trace_him, NULL); fork_inferior (exec_file, allargs, env, m3_trace_me, m3_trace_him, NULL);
/* We are at the first instruction we care about. */ /* We are at the first instruction we care about. */
/* Pedal to the metal... */ /* Pedal to the metal... */
proceed ((CORE_ADDR) -1, 0, 0); proceed ((CORE_ADDR) -1, 0, 0);
@ -4093,7 +4114,7 @@ m3_attach (args, from_tty)
m3_do_attach (pid); m3_do_attach (pid);
inferior_pid = pid; inferior_pid = pid;
push_target (&procfs_ops); push_target (&m3_ops);
} }
void void
@ -4225,6 +4246,31 @@ m3_detach (args, from_tty)
} }
#endif /* ATTACH_DETACH */ #endif /* ATTACH_DETACH */
/* Get ready to modify the registers array. On machines which store
individual registers, this doesn't need to do anything. On machines
which store all the registers in one fell swoop, this makes sure
that registers contains all the registers from the program being
debugged. */
static void
m3_prepare_to_store ()
{
#ifdef CHILD_PREPARE_TO_STORE
CHILD_PREPARE_TO_STORE ();
#endif
}
/* Print status information about what we're accessing. */
static void
m3_files_info (ignore)
struct target_ops *ignore;
{
/* FIXME: should print MID and all that crap. */
printf_unfiltered ("\tUsing the running image of %s %s.\n",
attach_flag? "attached": "child", target_pid_to_str (inferior_pid));
}
static void static void
m3_open (arg, from_tty) m3_open (arg, from_tty)
char *arg; char *arg;
@ -4461,12 +4507,9 @@ struct target_ops m3_ops = {
mach_really_wait, /* to_wait */ mach_really_wait, /* to_wait */
fetch_inferior_registers, /* to_fetch_registers */ fetch_inferior_registers, /* to_fetch_registers */
store_inferior_registers, /* to_store_registers */ store_inferior_registers, /* to_store_registers */
child_prepare_to_store, /* to_prepare_to_store */ m3_prepare_to_store, /* to_prepare_to_store */
m3_xfer_memory, /* to_xfer_memory */ m3_xfer_memory, /* to_xfer_memory */
m3_files_info, /* to_files_info */
/* FIXME: Should print MID and all that crap. */
child_files_info, /* to_files_info */
memory_insert_breakpoint, /* to_insert_breakpoint */ memory_insert_breakpoint, /* to_insert_breakpoint */
memory_remove_breakpoint, /* to_remove_breakpoint */ memory_remove_breakpoint, /* to_remove_breakpoint */
terminal_init_inferior, /* to_terminal_init */ terminal_init_inferior, /* to_terminal_init */