FRAME_ADDR step_frame_address;
/* 1 means step over all subroutine calls.
+ 0 means don't step over calls (used by stepi).
-1 means step over calls to undebuggable functions. */
int step_over_calls;
if (from_tty)
{
- printf_filtered ("Starting program: %s %s\n",
- exec_file? exec_file: "", inferior_args);
+ puts_filtered("Starting program: ");
+ if (exec_file)
+ puts_filtered(exec_file);
+ puts_filtered(" ");
+ puts_filtered(inferior_args);
+ puts_filtered("\n");
fflush (stdout);
}
/* Take the smaller of the two. If there was space before the
"=", they will be the same right now. */
- p = arg + min (p - arg, val - arg);
+
+ if (val < p)
+ p = val - 1;
}
else if (val != 0 && p == 0)
p = val;
char *args;
int from_tty;
{
- printf_filtered ("Executable and object file path: %s\n",
- get_in_environ (inferior_environ, path_var_name));
+ puts_filtered ("Executable and object file path: ");
+ puts_filtered (get_in_environ (inferior_environ, path_var_name));
+ puts_filtered ("\n");
}
/* Add zero or more directories to the front of the execution path. */
continue;
}
- target_convert_to_virtual (i, raw_buffer, virtual_buffer);
+ REGISTER_CONVERT_TO_VIRTUAL (i, raw_buffer, virtual_buffer);
/* If virtual format is floating, print it that way, and in raw hex. */
if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT
int fpregs;
{
int regnum;
+ register char *end;
if (!target_has_registers)
error ("The program has no registers now.");
- if (addr_exp)
+ if (!addr_exp)
{
- if (*addr_exp >= '0' && *addr_exp <= '9')
- regnum = atoi (addr_exp);
- else
- {
- register char *p = addr_exp;
- if (p[0] == '$')
- p++;
- for (regnum = 0; regnum < NUM_REGS; regnum++)
- if (!strcmp (p, reg_names[regnum]))
- break;
- if (regnum == NUM_REGS)
- error ("%s: invalid register name.", addr_exp);
- }
+ DO_REGISTERS_INFO(-1, fpregs);
+ return;
}
- else
- regnum = -1;
- DO_REGISTERS_INFO(regnum, fpregs);
+ do
+ {
+ if (addr_exp[0] == '$')
+ addr_exp++;
+ end = addr_exp;
+ while (*end != '\0' && *end != ' ' && *end != '\t')
+ ++end;
+ for (regnum = 0; regnum < NUM_REGS; regnum++)
+ if (!strncmp (addr_exp, reg_names[regnum], end - addr_exp)
+ && strlen (reg_names[regnum]) == end - addr_exp)
+ goto found;
+ if (*addr_exp >= '0' && *addr_exp <= '9')
+ regnum = atoi (addr_exp); /* Take a number */
+ if (regnum >= NUM_REGS) /* Bad name, or bad number */
+ error ("%.*s: invalid register", end - addr_exp, addr_exp);
+
+found:
+ DO_REGISTERS_INFO(regnum, fpregs);
+
+ addr_exp = end;
+ while (*addr_exp == ' ' || *addr_exp == '\t')
+ ++addr_exp;
+ } while (*addr_exp != '\0');
}
static void
*/
/*
- * attach_command --
- * takes a program started up outside of gdb and ``attaches'' to it.
- * This stops it cold in its tracks and allows us to start tracing it.
- * For this to work, we must be able to send the process a
- * signal and we must have the same effective uid as the program.
- */
+ attach_command --
+ takes a program started up outside of gdb and ``attaches'' to it.
+ This stops it cold in its tracks and allows us to start debugging it.
+ and wait for the trace-trap that results from attaching. */
+
void
attach_command (args, from_tty)
char *args;
int from_tty;
{
dont_repeat (); /* Not for the faint of heart */
+
+ if (target_has_execution)
+ {
+ if (query ("A program is being debugged already. Kill it? "))
+ target_kill ();
+ else
+ error ("Inferior not killed.");
+ }
+
target_attach (args, from_tty);
+
+ /* Set up the "saved terminal modes" of the inferior
+ based on what modes we are starting it with. */
+ target_terminal_init ();
+
+ /* Install inferior's terminal modes. */
+ target_terminal_inferior ();
+
+ /* Set up execution context to know that we should return from
+ wait_for_inferior as soon as the target reports a stop. */
+ init_wait_for_inferior ();
+ clear_proceed_status ();
+ stop_soon_quietly = 1;
+
+ wait_for_inferior ();
+
+#ifdef SOLIB_ADD
+ /* Add shared library symbols from the newly attached process, if any. */
+ SOLIB_ADD ((char *)0, from_tty, (struct target_ops *)0);
+#endif
+
+ normal_stop ();
}
/*
#endif
}
\f
-struct cmd_list_element *unsetlist = NULL;
-
/* ARGSUSED */
static void
unset_command (args, from_tty)
target_preopen(from_tty);
+ entry.Offset = 0;
+
+ for (cnt = 0; cnt < BKPT_TABLE_SIZE; cnt++)
+ bkpt_table[cnt].Type = 0;
+
if (udi_config_id)
free (udi_config_id);
UDISizeT Size = 4;
UDICount CountDone;
UDIBool HostEndian = 0;
+ UDIError err;
if (udi_session_id < 0)
error ("UDI connection not opened yet, use the 'target udi' command.\n");
UDIStop();
From.Space = 11;
From.Offset = UDI29KSpecialRegs;
- if(UDIRead(From, &PC_adds, Count, Size, &CountDone, HostEndian))
+ if (err = UDIRead(From, &PC_adds, Count, Size, &CountDone, HostEndian))
error ("UDIRead failed in udi_attach");
printf ("Remote process is now halted, pc1 = 0x%x.\n", PC_adds);
}
UDISizeT Size = 4;
UDICount CountDone;
UDIBool HostEndian = 0;
+ UDIError err;
int i;
if (regno >= 0) {
From.Offset = 1;
To = (UDIUInt32 *)®isters[4 * GR1_REGNUM];
Count = 1;
- if (UDIRead(From, To, Count, Size, &CountDone, HostEndian))
+ if (err = UDIRead(From, To, Count, Size, &CountDone, HostEndian))
error("UDIRead() failed in udi_fetch_registers");
register_valid[GR1_REGNUM] = 1;
From.Offset = 64;
To = (UDIUInt32 *)®isters[4 * GR64_REGNUM];
Count = 32;
- if (UDIRead(From, To, Count, Size, &CountDone, HostEndian))
+ if (err = UDIRead(From, To, Count, Size, &CountDone, HostEndian))
error("UDIRead() failed in udi_fetch_registers");
for (i = GR64_REGNUM; i < GR64_REGNUM + 32; i++)
From.Offset = 96;
To = (UDIUInt32 *)®isters[4 * GR96_REGNUM];
Count = 32;
- if (UDIRead(From, To, Count, Size, &CountDone, HostEndian))
+ if (err = UDIRead(From, To, Count, Size, &CountDone, HostEndian))
error("UDIRead() failed in udi_fetch_registers");
for (i = GR96_REGNUM; i < GR96_REGNUM + 32; i++)
From.Offset = 0;
To = (UDIUInt32 *)®isters[4 * LR0_REGNUM];
Count = 128;
- if (UDIRead(From, To, Count, Size, &CountDone, HostEndian))
+ if (err = UDIRead(From, To, Count, Size, &CountDone, HostEndian))
error("UDIRead() failed in udi_fetch_registers");
for (i = LR0_REGNUM; i < LR0_REGNUM + 128; i++)
From.Offset = 0;
To = (UDIUInt32 *)®isters[4 * SR_REGNUM(0)];
Count = 15;
- if (UDIRead(From, To, Count, Size, &CountDone, HostEndian))
+ if (err = UDIRead(From, To, Count, Size, &CountDone, HostEndian))
error("UDIRead() failed in udi_fetch_registers");
for (i = SR_REGNUM(0); i < SR_REGNUM(0) + 15; i++)
From.Offset = 128;
To = (UDIUInt32 *)®isters[4 * SR_REGNUM(128)];
Count = 135-128 + 1;
- if (UDIRead(From, To, Count, Size, &CountDone, HostEndian))
+ if (err = UDIRead(From, To, Count, Size, &CountDone, HostEndian))
error("UDIRead() failed in udi_fetch_registers");
for (i = SR_REGNUM(128); i < SR_REGNUM(128) + 135-128+1; i++)
else /* BSS */
{
UDIResource From;
- char zero = 0;
+ unsigned long zero = 0;
/* Write a zero byte at the vma */
err = UDIWrite ((UDIHostMemPtr)&zero, /* From */
To, /* To */
(UDICount)1, /* Count */
- (UDISizeT)1, /* Size */
+ (UDISizeT)4, /* Size */
&Count, /* CountDone */
(UDIBool)0); /* HostEndian */
if (err)
error ("UDIWrite failed, error = %d", err);
From = To;
- To.Offset++;
+ To.Offset+=4;
/* Now, duplicate it for the length of the BSS */
err = UDICopy (From, /* From */
To, /* To */
- (UDICount)section_size - 1, /* Count */
- (UDISizeT)1, /* Size */
+ (UDICount)(section_size/4 - 1), /* Count */
+ (UDISizeT)4, /* Size */
&Count, /* CountDone */
(UDIBool)1); /* Direction */
if (err)
- error ("UDICopy failed, error = %d", err);
+ {
+ char message[100];
+ int xerr;
+
+ xerr = UDIGetErrorMsg(err, 100, message, &Count);
+ if (!xerr)
+ fprintf (stderr, "Error is %s\n", message);
+ else
+ fprintf (stderr, "xerr is %d\n", xerr);
+ error ("UDICopy failed, error = %d", err);
+ }
}
}
UDISizeT Size = 1;
UDICount CountDone = 0;
UDIBool HostEndian = 0;
+ UDIError err;
From.Space = udi_memory_space(memaddr);
To = (UDIUInt32*)myaddr;
{ Count = len - nread;
if (Count > MAXDATA) Count = MAXDATA;
From.Offset = memaddr + nread;
- if(UDIRead(From, To, Count, Size, &CountDone, HostEndian))
- { error("UDIWrite() failed in udi_read_inferrior_memory");
+ if(err = UDIRead(From, To, Count, Size, &CountDone, HostEndian))
+ { error("UDIRead() failed in udi_read_inferrior_memory");
break;
}
else
UDISizeT Size = 4;
UDICount CountDone;
UDIBool HostEndian = 0;
+ UDIError err;
int result;
if (regno == GR1_REGNUM)
From.Offset = regnum_to_srnum(regno);
}
- if (UDIRead(From, &To, Count, Size, &CountDone, HostEndian))
+ if (err = UDIRead(From, &To, Count, Size, &CountDone, HostEndian))
error("UDIRead() failed in udi_fetch_registers");
supply_register(regno, (char *) &To);