extern int exception_catchpoints_are_fragile;
/* This is defined in valops.c. */
-extern value_ptr find_function_in_inferior (char *);
+extern struct value *find_function_in_inferior (char *);
/* Should call_function allocate stack space for a struct return? */
int
We also need a number of horrid hacks to deal with lossage in the
PC queue registers (apparently they're not valid when the in syscall
bit is set). */
- pc = target_read_pc (inferior_pid);
+ pc = target_read_pc (inferior_ptid);
int_buffer = read_register (FLAGS_REGNUM);
if (int_buffer & 0x2)
{
any other choice? Is there *any* way to do this stuff with
ptrace() or some equivalent?). */
resume (1, 0);
- target_wait (inferior_pid, &w);
+ target_wait (inferior_ptid, &w);
if (w.kind == TARGET_WAITKIND_SIGNALLED)
{
to the callee, so we do that too. */
CORE_ADDR
-hppa_push_arguments (int nargs, value_ptr *args, CORE_ADDR sp,
+hppa_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
int struct_return, CORE_ADDR struct_addr)
{
/* array of arguments' offsets */
arguments into registers as needed by the ABI. */
CORE_ADDR
-hppa_push_arguments (int nargs, value_ptr *args, CORE_ADDR sp,
+hppa_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
int struct_return, CORE_ADDR struct_addr)
{
/* array of arguments' offsets */
This function does the same stuff as value_being_returned in values.c, but
gets the value from the stack rather than from the buffer where all the
registers were saved when the function called completed. */
-value_ptr
+struct value *
hppa_value_returned_from_stack (register struct type *valtype, CORE_ADDR addr)
{
- register value_ptr val;
+ register struct value *val;
val = allocate_value (valtype);
CHECK_TYPEDEF (valtype);
struct symbol *get_sym, *symbol2;
struct minimal_symbol *buff_minsym, *msymbol;
struct type *ftype;
- value_ptr *args;
- value_ptr funcval, val;
+ struct value **args;
+ struct value *funcval;
+ struct value *val;
int x, namelen, err_value, tmp = -1;
CORE_ADDR endo_buff_addr, value_return_addr, errno_return_addr;
CORE_ADDR stub_addr;
- args = (value_ptr *) alloca (sizeof (value_ptr) * 8); /* 6 for the arguments and one null one??? */
+ args = alloca (sizeof (struct value *) * 8); /* 6 for the arguments and one null one??? */
funcval = find_function_in_inferior ("__d_shl_get");
get_sym = lookup_symbol ("__d_shl_get", NULL, VAR_NAMESPACE, NULL, NULL);
buff_minsym = lookup_minimal_symbol ("__buffer", NULL, NULL);
CORE_ADDR
hppa_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs,
- value_ptr *args, struct type *type, int gcc_p)
+ struct value **args, struct type *type, int gcc_p)
{
CORE_ADDR dyncall_addr;
struct minimal_symbol *msymbol;
such that it points to the PC value written immediately above
(ie the call dummy). */
resume (1, 0);
- target_wait (inferior_pid, &w);
+ target_wait (inferior_ptid, &w);
resume (1, 0);
- target_wait (inferior_pid, &w);
+ target_wait (inferior_ptid, &w);
/* Restore the two instructions at the old PC locations. */
*((int *) buf) = inst1;
stub rather than the export stub or real function for lazy binding
to work correctly
- /* If we are using the gcc PLT call routine, then we need to
+ If we are using the gcc PLT call routine, then we need to
get the import stub for the target function. */
if (using_gcc_plt_call && som_solib_get_got_by_pc (fun))
{
if (flags & 2)
return pc;
#ifndef GDB_TARGET_IS_PA_ELF
- else if (som_solib_get_got_by_pc (target_read_pc (inferior_pid)))
+ else if (som_solib_get_got_by_pc (target_read_pc (inferior_ptid)))
return pc;
#endif
else
bits. */
CORE_ADDR
-target_read_pc (int pid)
+target_read_pc (ptid_t ptid)
{
- int flags = read_register_pid (FLAGS_REGNUM, pid);
+ int flags = read_register_pid (FLAGS_REGNUM, ptid);
/* The following test does not belong here. It is OS-specific, and belongs
in native code. */
/* Test SS_INSYSCALL */
if (flags & 2)
- return read_register_pid (31, pid) & ~0x3;
+ return read_register_pid (31, ptid) & ~0x3;
- return read_register_pid (PC_REGNUM, pid) & ~0x3;
+ return read_register_pid (PC_REGNUM, ptid) & ~0x3;
}
/* Write out the PC. If currently in a syscall, then also write the new
PC value into %r31. */
void
-target_write_pc (CORE_ADDR v, int pid)
+target_write_pc (CORE_ADDR v, ptid_t ptid)
{
- int flags = read_register_pid (FLAGS_REGNUM, pid);
+ int flags = read_register_pid (FLAGS_REGNUM, ptid);
/* The following test does not belong here. It is OS-specific, and belongs
in native code. */
privilege bits set correctly. */
/* Test SS_INSYSCALL */
if (flags & 2)
- write_register_pid (31, v | 0x3, pid);
+ write_register_pid (31, v | 0x3, ptid);
- write_register_pid (PC_REGNUM, v, pid);
- write_register_pid (NPC_REGNUM, v + 4, pid);
+ write_register_pid (PC_REGNUM, v, ptid);
+ write_register_pid (NPC_REGNUM, v + 4, ptid);
}
/* return the alignment of a type in bytes. Structures have the maximum
for (i = start; i < 2; i++)
{
errno = 0;
- raw_val[i] = call_ptrace (PT_RUREGS, inferior_pid,
+ raw_val[i] = call_ptrace (PT_RUREGS, PIDGET (inferior_ptid),
(PTRACE_ARG3_TYPE) regaddr, 0);
if (errno != 0)
{
}
}
- /* Quit if we hit any kind of branch the previous iteration.
+ /* Quit if we hit any kind of branch the previous iteration. */
if (final_iteration)
break;
}
anaddr = SYMBOL_VALUE_ADDRESS (msymbol);
- store_unsigned_integer (buf, 4, inferior_pid); /* FIXME 32x64? */
+ store_unsigned_integer (buf, 4, PIDGET (inferior_ptid)); /* FIXME 32x64? */
if (target_write_memory (anaddr, buf, 4)) /* FIXME 32x64? */
{
warning ("Unable to write __d_pid");
if (!eh_notify_callback_addr)
{
/* We can get here either if there is no plabel in the export list
- for the main image, or if something strange happened (??) */
+ for the main image, or if something strange happened (?) */
warning ("Couldn't find a plabel (indirect function label) for the exception callback.");
warning ("GDB will not be able to intercept exception events.");
return 0;
if (enable)
{
/* Ensure that __d_pid is set up correctly -- end.c code checks this. :-( */
- if (inferior_pid > 0)
+ if (PIDGET (inferior_ptid) > 0)
{
if (setup_d_pid_in_inferior ())
return (struct symtab_and_line *) -1;
For these reasons, we have to violate information hiding and
call "breakpoint_here_p". If core gdb thinks there is a bpt
here, that's what counts, as core gdb is the one which is
- putting the BPT instruction in and taking it out. */
+ putting the BPT instruction in and taking it out.
+
+ Note that this implementation is potentially redundant now that
+ default_prepare_to_proceed() has been added.
+
+ FIXME This may not support switching threads after Ctrl-C
+ correctly. The default implementation does support this. */
int
hppa_prepare_to_proceed (void)
{
pid_t old_thread;
pid_t current_thread;
- old_thread = hppa_switched_threads (inferior_pid);
+ old_thread = hppa_switched_threads (PIDGET (inferior_ptid));
if (old_thread != 0)
{
/* Switched over from "old_thread". Try to do
/* Yuk, shouldn't use global to specify current
thread. But that's how gdb does it. */
- current_thread = inferior_pid;
- inferior_pid = old_thread;
+ current_thread = PIDGET (inferior_ptid);
+ inferior_ptid = pid_to_ptid (old_thread);
new_pc = read_pc ();
if (new_pc != old_pc /* If at same pc, no need */
registers_changed ();
#if 0
printf ("---> PREPARE_TO_PROCEED (was %d, now %d)!\n",
- current_thread, inferior_pid);
+ current_thread, PIDGET (inferior_ptid));
#endif
return 1;
}
/* Otherwise switch back to the user-chosen thread. */
- inferior_pid = current_thread;
+ inferior_ptid = pid_to_ptid (current_thread);
new_pc = read_pc (); /* Re-prime register cache */
}