int attach_flag;
-#ifdef MAINTENANCE_CMDS
/* Non-zero if we want to see trace of target level stuff. */
static int targetdebug = 0;
static void setup_target_debug PARAMS ((void));
-#endif
-
/* The user just typed 'target' without the name of a target. */
/* ARGSUSED */
cleanup_target (¤t_target); /* Fill in the gaps */
-#ifdef MAINTENANCE_CMDS
if (targetdebug)
setup_target_debug ();
-#endif
return prev != 0;
}
return 1;
}
+/* Find a single runnable target in the stack and return it. If for
+ some reason there is more than one, return NULL. */
+
+struct target_ops *
+find_run_target ()
+{
+ struct target_ops **t;
+ struct target_ops *runable = NULL;
+ int count;
+
+ count = 0;
+
+ for (t = target_structs; t < target_structs + target_struct_size; ++t)
+ {
+ if ((*t)->to_can_run && target_can_run(*t))
+ {
+ runable = *t;
+ ++count;
+ }
+ }
+
+ return (count == 1 ? runable : NULL);
+}
+
struct target_ops *
find_core_target ()
{
{"EXC_SOFTWARE", "Software generated exception"},
{"EXC_BREAKPOINT", "Breakpoint"},
#endif
+ {"SIGINFO", "Information request"},
+
{NULL, "Unknown signal"},
{NULL, "Internal error: printing TARGET_SIGNAL_DEFAULT"},
target_signal_to_string (sig)
enum target_signal sig;
{
- return signals[sig].string;
+ if ((sig >= TARGET_SIGNAL_FIRST) && (sig <= TARGET_SIGNAL_LAST))
+ return signals[sig].string;
+ else
+ return signals[TARGET_SIGNAL_UNKNOWN].string;
}
/* Return the name for a signal. */
if (hostsig == _NSIG + EXC_BREAKPOINT) return TARGET_EXC_BREAKPOINT;
#endif
+#if defined (SIGINFO)
+ if (hostsig == SIGINFO) return TARGET_SIGNAL_INFO;
+#endif
+
#if defined (REALTIME_LO)
if (hostsig >= REALTIME_LO && hostsig < REALTIME_HI)
return (enum target_signal)
case TARGET_EXC_BREAKPOINT: return _NSIG + EXC_BREAKPOINT;
#endif
+#if defined (SIGINFO)
+ case TARGET_SIGNAL_INFO: return SIGINFO;
+#endif
+
default:
#if defined (REALTIME_LO)
if (oursig >= TARGET_SIGNAL_REALTIME_33
}
\f
-#ifdef MAINTENANCE_CMDS
static struct target_ops debug_target;
static void
has_execd = debug_target.to_has_execd (pid, execd_pathname);
fprintf_unfiltered (gdb_stderr, "target_has_execd (%d, %s) = %d\n",
- pid, *execd_pathname, has_execd);
+ pid, (*execd_pathname ? *execd_pathname : "<NULL>"),
+ has_execd);
return has_execd;
}
enum exception_event_kind kind;
int enable;
{
- debug_target.to_enable_exception_callback (kind, enable);
-
+ struct symtab_and_line *result;
+ result = debug_target.to_enable_exception_callback (kind, enable);
fprintf_unfiltered (gdb_stderr,
"target get_exception_callback_sal (%d, %d)\n",
kind, enable);
+ return result;
}
static struct exception_event_record *
debug_to_get_current_exception_event ()
{
- debug_target.to_get_current_exception_event();
-
+ struct exception_event_record *result;
+ result = debug_target.to_get_current_exception_event();
fprintf_unfiltered (gdb_stderr, "target get_current_exception_event ()\n");
+ return result;
}
static char *
current_target.to_core_file_to_sym_file = debug_to_core_file_to_sym_file;
}
-#endif /* MAINTENANCE_CMDS */
+
\f
static char targ_desc[] =
"Names of targets and files being debugged.\n\
add_info ("target", target_info, targ_desc);
add_info ("files", target_info, targ_desc);
-#ifdef MAINTENANCE_CMDS
add_show_from_set (
add_set_cmd ("targetdebug", class_maintenance, var_zinteger,
(char *)&targetdebug,
"Set target debugging.\n\
When non-zero, target debugging is enabled.", &setlist),
&showlist);
-#endif
if (!STREQ (signals[TARGET_SIGNAL_LAST].string, "TARGET_SIGNAL_MAGIC"))
abort ();