aboutsummaryrefslogtreecommitdiff
path: root/gdb/remote-udi.c
diff options
context:
space:
mode:
authorJim Kingdon <jkingdon@engr.sgi.com>1994-02-06 23:34:13 +0000
committerJim Kingdon <jkingdon@engr.sgi.com>1994-02-06 23:34:13 +0000
commit4a00e1de7b94259295433df221cfd9dc9259a46f (patch)
tree2c7709936a1a86b16943e182555543299cb9afa5 /gdb/remote-udi.c
parent01cd70b98538cd45dbfa04f85afdb0ae25a40992 (diff)
downloadgdb-4a00e1de7b94259295433df221cfd9dc9259a46f.zip
gdb-4a00e1de7b94259295433df221cfd9dc9259a46f.tar.gz
gdb-4a00e1de7b94259295433df221cfd9dc9259a46f.tar.bz2
* 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.
Diffstat (limited to 'gdb/remote-udi.c')
-rw-r--r--gdb/remote-udi.c39
1 files changed, 27 insertions, 12 deletions
diff --git a/gdb/remote-udi.c b/gdb/remote-udi.c
index 17c1016..0a7e1a9 100644
--- a/gdb/remote-udi.c
+++ b/gdb/remote-udi.c
@@ -84,6 +84,7 @@ extern struct target_ops udi_ops; /* Forward declaration */
starts. */
UDISessionId udi_session_id = -1;
+static char *udi_config_id;
CPUOffset IMemStart = 0;
CPUSizeT IMemSize = 0;
@@ -139,8 +140,9 @@ udi_create_inferior (execfile, args, env)
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;
@@ -203,7 +205,6 @@ udi_mourn()
/* XXX - need cleanups for udiconnect for various failures!!! */
-static char *udi_config_id;
static void
udi_open (name, from_tty)
char *name;
@@ -220,6 +221,10 @@ udi_open (name, from_tty)
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;
@@ -235,6 +240,7 @@ udi_open (name, from_tty)
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);
@@ -368,13 +374,15 @@ udi_detach (args,from_tty)
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");
}
@@ -936,8 +944,10 @@ udi_xfer_inferior_memory (memaddr, myaddr, len, write)
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 */
@@ -1022,10 +1032,15 @@ just invoke udi_close, which seems to get things right.
#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;
}