/* Target-vector operations for controlling windows child processes, for GDB.
- Copyright (C) 1995-2017 Free Software Foundation, Inc.
+ Copyright (C) 1995-2018 Free Software Foundation, Inc.
Contributed by Cygnus Solutions, A Red Hat Company.
#define DEBUG_MEM(x) if (debug_memory) printf_unfiltered x
#define DEBUG_EXCEPT(x) if (debug_exceptions) printf_unfiltered x
-static void windows_interrupt (struct target_ops *self, ptid_t);
+static void windows_interrupt (struct target_ops *self);
static int windows_thread_alive (struct target_ops *, ptid_t);
static void windows_kill_inferior (struct target_ops *);
windows_thread_info *th, int r)
{
char *context_offset = ((char *) &th->context) + mappings[r];
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch *gdbarch = regcache->arch ();
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
long l;
((char *) &th->context) + mappings[r]);
else
{
- for (r = 0; r < gdbarch_num_regs (get_regcache_arch (regcache)); r++)
+ for (r = 0; r < gdbarch_num_regs (regcache->arch ()); r++)
do_windows_store_inferior_registers (regcache, th, r);
}
}
{
char *name;
int from_tty;
- struct section_addr_info *addrs;
+ section_addr_info *addrs;
int mainline;
int flags;
struct ui_file *err, *out;
}
static void
-signal_event_command (char *args, int from_tty)
+signal_event_command (const char *args, int from_tty)
{
uintptr_t event_id = 0;
char *endargs = NULL;
static int
handle_output_debug_string (struct target_waitstatus *ourstatus)
{
- char *s = NULL;
+ gdb::unique_xmalloc_ptr<char> s;
int retval = 0;
if (!target_read_string
((CORE_ADDR) (uintptr_t) current_event.u.DebugString.lpDebugStringData,
- &s, 1024, 0)
- || !s || !*s)
+ &s, 1024, 0)
+ || !s || !*(s.get ()))
/* nothing to do */;
- else if (!startswith (s, _CYGWIN_SIGNAL_STRING))
+ else if (!startswith (s.get (), _CYGWIN_SIGNAL_STRING))
{
#ifdef __CYGWIN__
- if (!startswith (s, "cYg"))
+ if (!startswith (s.get (), "cYg"))
#endif
{
- char *p = strchr (s, '\0');
+ char *p = strchr (s.get (), '\0');
- if (p > s && *--p == '\n')
+ if (p > s.get () && *--p == '\n')
*p = '\0';
- warning (("%s"), s);
+ warning (("%s"), s.get ());
}
}
#ifdef __CYGWIN__
to be stored at the given address in the inferior. Tell gdb
to treat this like a real signal. */
char *p;
- int sig = strtol (s + sizeof (_CYGWIN_SIGNAL_STRING) - 1, &p, 0);
+ int sig = strtol (s.get () + sizeof (_CYGWIN_SIGNAL_STRING) - 1, &p, 0);
gdb_signal gotasig = gdb_signal_from_host (sig);
ourstatus->value.sig = gotasig;
}
#endif
- if (s)
- xfree (s);
return retval;
}
}
static void
-display_selectors (char * args, int from_tty)
+display_selectors (const char * args, int from_tty)
{
if (!current_thread)
{
if (named_thread != NULL)
{
int thread_name_len;
- char *thread_name;
+ gdb::unique_xmalloc_ptr<char> thread_name;
thread_name_len = target_read_string (thread_name_target,
&thread_name, 1025, NULL);
if (thread_name_len > 0)
{
- thread_name[thread_name_len - 1] = '\0';
+ thread_name.get ()[thread_name_len - 1] = '\0';
xfree (named_thread->name);
- named_thread->name = thread_name;
+ named_thread->name = thread_name.release ();
}
- else
- xfree (thread_name);
}
ourstatus->value.sig = GDB_SIGNAL_TRAP;
result = HANDLE_EXCEPTION_IGNORED;
{
/* Single step by setting t bit. */
struct regcache *regcache = get_current_regcache ();
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch *gdbarch = regcache->arch ();
windows_fetch_inferior_registers (ops, regcache,
gdbarch_ps_regnum (gdbarch));
th->context.EFlags |= FLAG_TRACE_BIT;
}
static void
-windows_detach (struct target_ops *ops, const char *args, int from_tty)
+windows_detach (struct target_ops *ops, inferior *inf, int from_tty)
{
int detached = 1;
^C on the controlling terminal. */
static void
-windows_interrupt (struct target_ops *self, ptid_t ptid)
+windows_interrupt (struct target_ops *self)
{
DEBUG_EVENTS (("gdb: GenerateConsoleCtrlEvent (CTRLC_EVENT, 0)\n"));
CHECK (GenerateConsoleCtrlEvent (CTRL_C_EVENT, current_event.dwProcessId));