Take unsigned long arguments for PIDs.
* linux-low.c (add_process, linux_attach_lwp, linux_attach)
(linux_thread_alive, linux_wait_for_event, kill_lwp, send_sigstop)
(wait_for_sigstop, linux_resume_one_process)
(regsets_fetch_inferior_registers, linux_send_signal)
(linux_read_auxv): Likewise. Update the types of variables holding
PIDs. Update format string specifiers.
* linux-low.h (struct process_info, linux_attach_lwp): Likewise.
* remote-utils.c (prepare_resume_reply): Likewise.
* server.c (cont_thread, general_thread, step_thread)
(thread_from_wait, old_thread_from_wait, signal_pid): Change type to
unsigned long.
(handle_query): Update format specifiers.
(handle_v_cont, main): Use strtoul for thread IDs.
* server.h (struct inferior_list_entry): Use unsigned long for ID.
(add_thread, find_inferior_id, change_inferior_id, cont_thread)
(general_thread, step_thread, thread_from_wait)
(old_thread_from_wait): Update.
* target.h (struct thread_resume): Use unsigned long for THREAD.
(struct target_ops): Use unsigned long for arguments to attach and
thread_alive.
+2005-03-03 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * inferiors.c (change_inferior_id, add_thread, find_inferior_id):
+ Take unsigned long arguments for PIDs.
+ * linux-low.c (add_process, linux_attach_lwp, linux_attach)
+ (linux_thread_alive, linux_wait_for_event, kill_lwp, send_sigstop)
+ (wait_for_sigstop, linux_resume_one_process)
+ (regsets_fetch_inferior_registers, linux_send_signal)
+ (linux_read_auxv): Likewise. Update the types of variables holding
+ PIDs. Update format string specifiers.
+ * linux-low.h (struct process_info, linux_attach_lwp): Likewise.
+ * remote-utils.c (prepare_resume_reply): Likewise.
+ * server.c (cont_thread, general_thread, step_thread)
+ (thread_from_wait, old_thread_from_wait, signal_pid): Change type to
+ unsigned long.
+ (handle_query): Update format specifiers.
+ (handle_v_cont, main): Use strtoul for thread IDs.
+ * server.h (struct inferior_list_entry): Use unsigned long for ID.
+ (add_thread, find_inferior_id, change_inferior_id, cont_thread)
+ (general_thread, step_thread, thread_from_wait)
+ (old_thread_from_wait): Update.
+ * target.h (struct thread_resume): Use unsigned long for THREAD.
+ (struct target_ops): Use unsigned long for arguments to attach and
+ thread_alive.
+
2005-02-24 Daniel Jacobowitz <dan@codesourcery.com>
* acinclude.m4: Include bfd/bfd.m4 directly.
/* Inferior process information for the remote server for GDB.
- Copyright 2002
+ Copyright 2002, 2005
Free Software Foundation, Inc.
Contributed by MontaVista Software.
void
change_inferior_id (struct inferior_list *list,
- int new_id)
+ unsigned long new_id)
{
if (list->head != list->tail)
error ("tried to change thread ID after multiple threads are created");
}
void
-add_thread (int thread_id, void *target_data)
+add_thread (unsigned long thread_id, void *target_data)
{
struct thread_info *new_thread
= (struct thread_info *) malloc (sizeof (*new_thread));
}
struct inferior_list_entry *
-find_inferior_id (struct inferior_list *list, int id)
+find_inferior_id (struct inferior_list *list, unsigned long id)
{
struct inferior_list_entry *inf = list->head;
/* Low level interface to ptrace, for the remote server for GDB.
- Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This file is part of GDB.
}
static void *
-add_process (int pid)
+add_process (unsigned long pid)
{
struct process_info *process;
/* Attach to an inferior process. */
void
-linux_attach_lwp (int pid, int tid)
+linux_attach_lwp (unsigned long pid, unsigned long tid)
{
struct process_info *new_process;
if (ptrace (PTRACE_ATTACH, pid, 0, 0) != 0)
{
- fprintf (stderr, "Cannot attach to process %d: %s (%d)\n", pid,
+ fprintf (stderr, "Cannot attach to process %ld: %s (%d)\n", pid,
strerror (errno), errno);
fflush (stderr);
}
int
-linux_attach (int pid)
+linux_attach (unsigned long pid)
{
struct process_info *process;
/* Return nonzero if the given thread is still alive. */
static int
-linux_thread_alive (int tid)
+linux_thread_alive (unsigned long tid)
{
if (find_inferior_id (&all_threads, tid) != NULL)
return 1;
event_child = (struct process_info *)
find_inferior (&all_processes, status_pending_p, NULL);
if (debug_threads && event_child)
- fprintf (stderr, "Got a pending child %d\n", event_child->lwpid);
+ fprintf (stderr, "Got a pending child %ld\n", event_child->lwpid);
}
else
{
if (event_child->status_pending_p)
{
if (debug_threads)
- fprintf (stderr, "Got an event from pending child %d (%04x)\n",
+ fprintf (stderr, "Got an event from pending child %ld (%04x)\n",
event_child->lwpid, event_child->status_pending);
wstat = event_child->status_pending;
event_child->status_pending_p = 0;
if (! WIFSTOPPED (wstat))
{
if (debug_threads)
- fprintf (stderr, "Thread %d (LWP %d) exiting\n",
+ fprintf (stderr, "Thread %ld (LWP %ld) exiting\n",
event_child->tid, event_child->head.id);
/* If the last thread is exiting, just return. */
|| WSTOPSIG (wstat) == __SIGRTMIN + 1))
{
if (debug_threads)
- fprintf (stderr, "Ignored signal %d for %d (LWP %d).\n",
+ fprintf (stderr, "Ignored signal %d for %ld (LWP %ld).\n",
WSTOPSIG (wstat), event_child->tid,
event_child->head.id);
linux_resume_one_process (&event_child->head,
thread groups are in use, we need to use tkill. */
static int
-kill_lwp (int lwpid, int signo)
+kill_lwp (unsigned long lwpid, int signo)
{
static int tkill_failed;
}
if (debug_threads)
- fprintf (stderr, "Sending sigstop to process %d\n", process->head.id);
+ fprintf (stderr, "Sending sigstop to process %ld\n", process->head.id);
kill_lwp (process->head.id, SIGSTOP);
process->sigstop_sent = 1;
{
struct process_info *process = (struct process_info *) entry;
struct thread_info *saved_inferior, *thread;
- int wstat, saved_tid;
+ int wstat;
+ unsigned long saved_tid;
if (process->stopped)
return;
current_inferior = get_process_thread (process);
if (debug_threads)
- fprintf (stderr, "Resuming process %d (%s, signal %d, stop %s)\n", inferior_pid,
+ fprintf (stderr, "Resuming process %ld (%s, signal %d, stop %s)\n", inferior_pid,
step ? "step" : "continue", signal,
process->stop_expected ? "expected" : "not expected");
else
{
char s[256];
- sprintf (s, "ptrace(regsets_fetch_inferior_registers) PID=%d",
+ sprintf (s, "ptrace(regsets_fetch_inferior_registers) PID=%ld",
inferior_pid);
perror (s);
}
static void
linux_send_signal (int signum)
{
- extern int signal_pid;
+ extern unsigned long signal_pid;
if (cont_thread > 0)
{
char filename[PATH_MAX];
int fd, n;
- snprintf (filename, sizeof filename, "/proc/%d/auxv", inferior_pid);
+ snprintf (filename, sizeof filename, "/proc/%ld/auxv", inferior_pid);
fd = open (filename, O_RDONLY);
if (fd < 0)
/* Internal interfaces for the GNU/Linux specific target code for gdbserver.
- Copyright 2002, 2004 Free Software Foundation, Inc.
+ Copyright 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GDB.
{
struct inferior_list_entry head;
int thread_known;
- int lwpid;
- int tid;
+ unsigned long lwpid;
+ unsigned long tid;
/* If this flag is set, the next SIGSTOP will be ignored (the process will
be immediately resumed). */
extern struct inferior_list all_processes;
-void linux_attach_lwp (int pid, int tid);
+void linux_attach_lwp (unsigned long pid, unsigned long tid);
int thread_db_init (void);
/* Remote utility routines for the remote server for GDB.
Copyright 1986, 1989, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
- 2002, 2003, 2004
+ 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This file is part of GDB.
/* FIXME right place to set this? */
thread_from_wait = ((struct inferior_list_entry *)current_inferior)->id;
if (debug_threads)
- fprintf (stderr, "Writing resume reply for %d\n\n", thread_from_wait);
+ fprintf (stderr, "Writing resume reply for %ld\n\n", thread_from_wait);
/* This if (1) ought to be unnecessary. But remote_wait in GDB
will claim this event belongs to inferior_ptid if we do not
specify a thread, and there's no way for gdbserver to know
if (1 || old_thread_from_wait != thread_from_wait)
{
general_thread = thread_from_wait;
- sprintf (buf, "thread:%x;", thread_from_wait);
+ sprintf (buf, "thread:%lx;", thread_from_wait);
buf += strlen (buf);
old_thread_from_wait = thread_from_wait;
}
/* Main code for remote server for GDB.
- Copyright 1989, 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2002, 2003, 2004
+ Copyright 1989, 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2002, 2003, 2004,
+ 2005
Free Software Foundation, Inc.
This file is part of GDB.
#include <signal.h>
#include <sys/wait.h>
-int cont_thread;
-int general_thread;
-int step_thread;
-int thread_from_wait;
-int old_thread_from_wait;
+unsigned long cont_thread;
+unsigned long general_thread;
+unsigned long step_thread;
+unsigned long thread_from_wait;
+unsigned long old_thread_from_wait;
int extended_protocol;
int server_waiting;
(user hitting Control-C in the client), and to wait for the child to exit
when no longer debugging it. */
-int signal_pid;
+unsigned long signal_pid;
static unsigned char
start_inferior (char *argv[], char *statusptr)
signal_pid = create_inferior (argv[0], argv);
- fprintf (stderr, "Process %s created; pid = %d\n", argv[0],
+ fprintf (stderr, "Process %s created; pid = %ld\n", argv[0],
signal_pid);
signal (SIGTTOU, SIG_IGN);
if (strcmp ("qfThreadInfo", own_buf) == 0)
{
thread_ptr = all_threads.head;
- sprintf (own_buf, "m%x", thread_ptr->id);
+ sprintf (own_buf, "m%lx", thread_ptr->id);
thread_ptr = thread_ptr->next;
return;
}
{
if (thread_ptr != NULL)
{
- sprintf (own_buf, "m%x", thread_ptr->id);
+ sprintf (own_buf, "m%lx", thread_ptr->id);
thread_ptr = thread_ptr->next;
return;
}
}
else if (p[0] == ':')
{
- resume_info[i].thread = strtol (p + 1, &q, 16);
+ resume_info[i].thread = strtoul (p + 1, &q, 16);
if (p == q)
goto err;
p = q;
switch (own_buf[1])
{
case 'g':
- general_thread = strtol (&own_buf[2], NULL, 16);
+ general_thread = strtoul (&own_buf[2], NULL, 16);
write_ok (own_buf);
set_desired_inferior (1);
break;
case 'c':
- cont_thread = strtol (&own_buf[2], NULL, 16);
+ cont_thread = strtoul (&own_buf[2], NULL, 16);
write_ok (own_buf);
break;
case 's':
- step_thread = strtol (&own_buf[2], NULL, 16);
+ step_thread = strtoul (&own_buf[2], NULL, 16);
write_ok (own_buf);
break;
default:
break;
}
case 'T':
- if (mythread_alive (strtol (&own_buf[1], NULL, 16)))
+ if (mythread_alive (strtoul (&own_buf[1], NULL, 16)))
write_ok (own_buf);
else
write_enn (own_buf);
/* Common definitions for remote server for GDB.
- Copyright 1993, 1995, 1997, 1998, 1999, 2000, 2002, 2003, 2004
+ Copyright 1993, 1995, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This file is part of GDB.
};
struct inferior_list_entry
{
- int id;
+ unsigned long id;
struct inferior_list_entry *next;
};
void remove_inferior (struct inferior_list *list,
struct inferior_list_entry *entry);
void remove_thread (struct thread_info *thread);
-void add_thread (int thread_id, void *target_data);
+void add_thread (unsigned long thread_id, void *target_data);
void clear_inferiors (void);
struct inferior_list_entry *find_inferior
(struct inferior_list *,
void *),
void *arg);
struct inferior_list_entry *find_inferior_id (struct inferior_list *list,
- int id);
+ unsigned long id);
void *inferior_target_data (struct thread_info *);
void set_inferior_target_data (struct thread_info *, void *);
void *inferior_regcache_data (struct thread_info *);
void set_inferior_regcache_data (struct thread_info *, void *);
void change_inferior_id (struct inferior_list *list,
- int new_id);
+ unsigned long new_id);
/* Public variables in server.c */
-extern int cont_thread;
-extern int general_thread;
-extern int step_thread;
-extern int thread_from_wait;
-extern int old_thread_from_wait;
+extern unsigned long cont_thread;
+extern unsigned long general_thread;
+extern unsigned long step_thread;
+extern unsigned long thread_from_wait;
+extern unsigned long old_thread_from_wait;
extern int server_waiting;
extern jmp_buf toplevel;
/* Target operations for the remote server for GDB.
- Copyright 2002, 2003, 2004
+ Copyright 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
Contributed by MontaVista Software.
struct thread_resume
{
- int thread;
+ unsigned long thread;
/* If non-zero, leave this thread stopped. */
int leave_stopped;
PID is the process ID to attach to, specified by the user
or a higher layer. */
- int (*attach) (int pid);
+ int (*attach) (unsigned long pid);
/* Kill all inferiors. */
/* Return 1 iff the thread with process ID PID is alive. */
- int (*thread_alive) (int pid);
+ int (*thread_alive) (unsigned long pid);
/* Resume the inferior process. */