Sun Feb 6 06:55:15 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
+ * remote-udi.c (udi_files_info): If prog_name is NULL, just skip
+ printing the program, rather than passing NULL to printf.
+ (udi_detach): Set udi_session_id to -1 so that udi_close doesn't
+ try to call UDIDisconnect again. Print better message.
+ (udi_kill): Just call UDIDisconnect ourselves, rather than doing
+ it via udi_close.
+ (udi_open): Unpush UDI target after target_preopen, now that
+ udi_kill doesn't pop the target.
+ (udi_create_inferior): If udi_session_id is negative, open a new
+ TIP rather than giving an error.
+
* config/mips/mipsm3.mh, config/i386/i386m3.mh,
config/ns32k/ns32km3.mh: Define NAT_FILE.
* config/nm-m3.h: Change guard from _OS_MACH3_H_ and _OS_MACH3_H
starts. */
UDISessionId udi_session_id = -1;
+static char *udi_config_id;
CPUOffset IMemStart = 0;
CPUSizeT IMemSize = 0;
if (udi_session_id < 0)
{
- printf_unfiltered("UDI connection not open yet.\n");
- return;
+ /* If the TIP is not open, open it. */
+ if (UDIConnect (udi_config_id, &udi_session_id))
+ error("UDIConnect() failed: %s\n", dfe_errmsg);
}
inferior_pid = 40000;
/* XXX - need cleanups for udiconnect for various failures!!! */
-static char *udi_config_id;
static void
udi_open (name, from_tty)
char *name;
UDIUInt32 TIPId, TargetId, DFEId, DFE, TIP, DFEIPCId, TIPIPCId;
target_preopen(from_tty);
+ /* target_preopen calls target_kill to clean up the previous target. But
+ udi_kill leaves it on the stack. So we pop it here (the call to udi_close
+ is harmless now that udi_session_id is -1). */
+ unpush_target (&udi_ops);
entry.Offset = 0;
udi_config_id = strdup (strtok (name, " \t"));
if (UDIConnect (udi_config_id, &udi_session_id))
+ /* FIXME: Should set udi_session_id to -1 here. */
error("UDIConnect() failed: %s\n", dfe_errmsg);
push_target (&udi_ops);
if (UDIDisconnect (udi_session_id, UDIContinueSession))
error ("UDIDisconnect() failed in udi_detach");
- /* calls udi_close to do the real work (which looks like it calls
- UDIDisconnect with UDITerminateSession, FIXME). */
+ /* Don't try to UDIDisconnect it again in udi_close, which is called from
+ pop_target. */
+ udi_session_id = -1;
+ inferior_pid = 0;
+
pop_target();
- /* FIXME, message too similar to what udi_close prints. */
if (from_tty)
- printf_unfiltered ("Ending remote debugging\n");
+ printf_unfiltered ("Detaching from TIP\n");
}
static void
udi_files_info ()
{
- printf_unfiltered ("\tAttached to UDI socket to %s and running program %s.\n",
- udi_config_id, prog_name);
+ printf_unfiltered ("\tAttached to UDI socket to %s", udi_config_id);
+ if (prog_name != NULL)
+ printf_unfiltered ("and running program %s", prog_name);
+ printf_unfiltered (".\n");
}
/**************************************************** UDI_INSERT_BREAKPOINT */
#endif /* 0 */
/* Keep the target around, e.g. so "run" can do the right thing when
- we are already debugging something. FIXME-maybe: should we kill the
- TIP with UDIDisconnect using UDITerminateSession, and then restart
- it on the next "run"? */
+ we are already debugging something. */
+ if (UDIDisconnect (udi_session_id, UDITerminateSession))
+ {
+ warning ("UDIDisconnect() failed");
+ }
+
+ /* Do not try to close udi_session_id again, later in the program. */
+ udi_session_id = -1;
inferior_pid = 0;
}