OSDN Git Service

Add support for the Linux NPTL (New POSIX Thread Library) thread
[pf3gnuchains/pf3gnuchains3x.git] / rda / unix / ChangeLog
1 2005-06-27  Jim Blandy  <jimb@redhat.com>
2
3         Add support for the Linux NPTL (New POSIX Thread Library) thread
4         implementation.
5         * arch.h, lwp-pool.c, lwp-pool.h, stock-breakpoints.c:
6         * stock-breakpoints.h: New files.
7         * gdbserv-thread-db.h (continue_lwp, singlestep_lwp, attach_lwp)
8         (stop_lwp): Move these ...
9         * lwp-ctrl.h: ... to here (new file).
10         * server.h (struct child_process): Include a pointer to the
11         architecture object, a breakpoint table, and a pointer to the
12         "focus thread".
13         * linux-target.c: Create architecture objects for the i386 and
14         FRV, and describe breakpoints for those architectures.
15         #include "arch.h".
16         [STOCK_BREAKPOINTS]: #include "stock-breakpoints.h".
17         (allocate_empty_arch): New function.
18         [X86_LINUX_TARGET] (stock_table_to_x86, x86_table_to_stock)
19         (stock_bp_to_x86, x86_bp_to_stock, x86_make_bp_table, x86_set_bp)
20         (x86_delete_bp, x86_bp_hit_p, x86_make_arch): New functions.
21         (MAKE_ARCH): #define to call x86_make_arch.
22         [X86_LINUX_TARGET] (stock_table_to_frv, frv_table_to_stock)
23         (stock_bp_to_frv, frv_bp_to_stock, frv_make_bp_table, frv_set_bp)
24         (frv_delete_bp, frv_bp_hit_p, frv_make_arch): New functions.
25         (MAKE_ARCH): #define to call frv_make_arch.
26         (linux_attach): If MAKE_ARCH is #defined, create an architecture
27         object for this process.  And if we have an architecture object,
28         make a breakpoint table.
29         * thread-db.c: #include <assert.h>, "arch.h", "lwp-ctrl.h", and
30         "lwp-pool.h".
31         (struct gdbserv_thread): Remove state-tracking flags 'attached',
32         'stopped', 'waited', and 'stepping'; all that state is handled
33         inside lwp-pool.c now.
34         (add_thread_to_list): Zero the entire newly allocated thread
35         structure.
36         (thread_list_lookup_by_lid): Prefer threads whose ti_lid values 
37         are different from that of the main process.
38         (thread_db_state_str, thread_db_type_str): Don't include
39         formatting spaces here.
40         (thread_db_event_str): New function.
41         (thread_debug_name): New function.
42         (get_thread_signals): Return a value indicating success or failure.
43         (ignore_thread_signal): New function.
44         (using_thread_db_events, create_notification, death_notification)
45         (get_event_notification, set_event_breakpoint)
46         (insert_thread_db_event_breakpoints)
47         (delete_thread_db_event_breakpoints, request_thread_db_events)
48         (hit_thread_db_event_breakpoint, handle_thread_db_event): New
49         variables and functions, for using libthread_db's event interface.
50         (thread_db_open): Gather error-handling code next to the operation
51         that might fail.  Decide here whether to use the signal-based
52         debugging interface, or the event-based debugging interface.
53         (stop_thread, stop_all_threads, struct event_list, pending_events)
54         (pending_events_listsize, pending_events_top, add_pending_event)
55         (select_pending_event, send_pending_signals, wait_all_threads):
56         Deleted; we now use lwp-pool.c for all this.
57         (attach_thread, continue_thread, continue_all_threads)
58         (singlestep_thread, thread_db_singlestep_program)
59         (thread_db_continue_thread, thread_db_singlestep_thread): Use the
60         lwp-pool.c functions, instead of calling the lwp manipulation
61         functions directly and managing state here.  Keep track of the
62         focus thread.
63         (find_new_threads_callback): Always call attach_thread.  If we're
64         using libthread_db events, enable event reporting for the new
65         thread.
66         (update_thread_list): Take the current child process as an
67         argument; if the current focus thread disappears, clear the
68         process's focus_thread pointer.
69         (thread_db_thread_next): Pass the current child process to
70         update_thread_list.
71         (thread_db_thread_info): Reformat thread descriptions.  Mark
72         threads whose pid is equal to the process ID.
73         (thread_db_check_child_state): Use the lwp-pool functions, instead
74         of calling waitpid and the old stop-all-threads functions.  If we
75         have a focus thread, only check for a status on that thread.
76         Check for libthread_db events.  Use ignore_thread_signal, instead
77         of writing it out.
78         (thread_db_break_program): New function.
79         (thread_db_attach): Register it as the target's 'break_program'
80         method.  Always preload the symbol list with the names we'll need
81         for the signal-based interface, even if we have td_symbol_list.
82         Use lwp_pool_new_stopped to register the initial thread.  Clear
83         the focus thread.
84         * ptrace-target.c: #define _GNU_SOURCE and #include <sys/types.h>
85         and <linux/unistd.h>, to get declarations for the functions we
86         need.
87         #include "lwp-ctrl.h".
88         (continue_lwp, singlestep_lwp, attach_lwp): Remove
89         unnecessary 'extern' keywords.  Move pre-function comments to
90         lwp-ctrl.h.  Take an ordinary 'pid_t', not an 'lwpid_t', since
91         we're calling ptrace / tkill, and that's what they expect; rename
92         arguments accordingly.  Preserve value of errno across calls to
93         fprintf when reporting errors.
94         (kill_lwp): All the above, and use tkill system call if available.
95         * configure.in: Whenever we include thread-db.o in TARGET_MODULES,
96         also include lwp-pool.o.
97         On i386 and FRV Linux, use the stock-breakpoints module.
98         * config.in: Add template for STOCK_BREAKPOINTS.
99         * Makefile.am (EXTRA_rda_SOURCES): Include stock-breakpoints.c.
100         * Makefile.in, aclocal.m4, configure: Regenerated.
101
102 2005-03-11  Jim Blandy  <jimb@redhat.com>
103
104         * linux-target.c (linux_get_reg) [GETREGS_SETREGS_REGINFO]: In the
105         NOREGS case, check that reginfo doesn't specify an offset outside
106         our zeroed buffer.
107
108 2005-03-10  Jim Blandy  <jimb@redhat.com>
109
110         Compile with no warnings.
111         * Makefile.am (AM_CFLAGS): Compile with -Wall.
112         * Makefile.in: Regenerated.
113         * gdbserv-thread-db.h (stop_lwp, handle_waitstatus, ps_pdread,
114         ps_pdwrite): Add declarations for these functions to
115         gdbserv-thread-db.h.
116         * linux-target.c: #include <string.h>, <sys/types.h>, and
117         <sys/wait.h> to get declarations for system functions used in this
118         file.
119         (linux_get_reg): When register REGNO doesn't exist, provide zeros
120         for its value; don't use an uninitialized pointer.
121         (linux_set_reg): Delete unused variables.
122         (decr_pc_after_break): Fix printf format directive to match
123         arguments.
124         * ptrace-target.c (ptrace_read_user, ptrace_check_child_state,
125         ptrace_attach): Delete unused variables.
126         (ptrace_singlestep_program, ptrace_continue_program): Fix printf
127         format directive to match arguments.
128         * server.c (invalid_speed): Same.
129         (main): Initialize infd, outfd, and speed.
130         (tty_raw): Use proper name for speed_t "zero baud" value.
131         * thread-db.c: #include <string.h> and "gdbserv-utils.h", to get
132         declarations for functions used in this file.
133         (thread_db_open, wait_all_threads) 
134         (thread_db_check_child_state, thread_db_get_thread_reg) 
135         (thread_db_set_thread_reg): Fix printf format directive to match
136         arguments.
137         (continue_thread, thread_db_get_thread_reg, continue_all_threads,
138         thread_db_attach): Delete unused variables.
139
140         * Makefile.in, aclocal.m4: Regenerated with automake 1.9.4.
141
142         Make config.in generated automatically again.
143         * configure.in: Provide descriptions for all the preprocessor
144         symbols we define.
145         * configure: Regenerated.
146         * config.in: Regenerated using autoheader.
147
148         * linux-target.c (frv_fdpic_loadmap_addresses): Use '%lx' for
149         unsigned long argument.
150
151 2005-02-08  Kevin Buettner  <kevinb@redhat.com
152
153         * thread-db.c (td_thr_tls_get_addr_p): New static global.
154         (thread_db_dlopen): Initialize ``td_thr_tls_get_addr_p''.
155         (thread_db_get_gen): Add support for qGetTLSAddr packet.
156
157 2004-12-13  Kevin Buettner  <kevinb@redhat.com>
158
159         * thread-db.c (thread_db_get_thread_reg): Don't allow a successful
160         return without first initializing ``reg''.
161         (thread_db_set_thread_reg): Remove code intended to for
162         thread_db_get_thread_reg().
163
164 2004-12-09  Jim Blandy  <jimb@redhat.com>
165
166         * aclocal.m4, configure: Regenerated.
167
168 2004-11-18  Kevin Buettner  <kevinb@redhat.com>
169
170         * thread-db.c (thread_db_set_thread_reg): Don't allow a successful
171         return without first initializing ``reg''.
172
173 2004-10-20  Jim Blandy  <jimb@redhat.com>
174
175         Use the libthread_db 'td_symbol_list' function to look up all the
176         symbols libthread_db will need when invited to by GDB.
177         * thread-db.c (add_symbol_to_list): Make 'name' argument const.
178         (td_symbol_list_p): New libthread_db function pointer.
179         (thread_db_dlopen): Initialize it.
180         (thread_db_attach): Use td_symbol_list to pre-load our symbol
181         cache with the names of all the symbols libthread_db will ever
182         request.
183
184         * thread-db.c (thread_db_get_gen): There's no reason to try to
185         open a thread agent until we've at least requested values for all
186         the symbols we know about.
187
188         * server.c (usage): Don't include the entire pathname in the usage
189         message.
190
191 2004-10-19  Jim Blandy  <jimb@redhat.com>
192
193         * thread-db.c (get_thread_signals): Doc fix.
194
195         * thread-db.c (enum symbol_cache_defined): Move this definition
196         above that of (struct symbol_cache), and give it a name.
197         (struct symbol_cache): Use that enum as the type of 'defined_p', so
198         the debugger will print symbol cache entries more helpfully.
199
200         * ptrace-target.c (ptrace_create_child): Don't use sys_nerr to
201         check that errno is in a valid range.  The use sys_nerr is
202         deprecated on GNU/Linux, and according to the ISO C standard and
203         POSIX, strerror always returns a valid string, even for invalid
204         errno codes.
205
206 2004-10-07  Jim Blandy  <jimb@redhat.com>
207
208         * Makefile.am (rda_DEPENDENCIES): Add ../lib/librda.la.
209         * Makefile.in: Regenerated.
210
211         * server.c (main): Check for an error return from
212         gdbsocket_startup.
213
214 2004-09-22  Jim Blandy  <jimb@theseus.home>
215
216         * thread-db.c (thread_db_open, thread_db_get_gen): Doc fixes.
217
218         * thread-db.c (thread_db_detach, thread_db_set_gen,
219         thread_db_thread_id): Make these functions static.
220
221 2004-09-13  Jim Blandy  <jimb@theseus.home>
222
223         * solaris-target.c (solaris_detach, solaris_attach): Change
224         "linux" to "solaris".
225
226 2004-08-11  Corinna Vinschen  <vinschen@redhat.com>
227
228         * linux-target.c (linux_write_reg): Print process->pid in case of
229         an error.
230
231 2004-07-19  Kevin Buettner  <kevinb@redhat.com>
232
233         * server.c (main): Set ``server_quit_p'' when debugged process
234         exits or terminates.
235
236 2004-06-03  Kevin Buettner  <kevinb@redhat.com>
237
238         * server.c (main): Ensure that thread related realtime signals
239         are ignored.
240
241 2004-04-20  Kevin Buettner  <kevinb@redhat.com>
242
243         * thread-db.c (lookup_sym): New function.
244         (thread_db_open): Print diagnostic message for failed dlopen()
245         call.  Call lookup_sym() which will print diagnostic for failed
246         dlsym() call.
247
248 2004-04-20  Kevin Buettner  <kevinb@redhat.com>
249
250         * server.c (main): Ignore realtime signals.
251
252 2004-04-05  Kevin Buettner  <kevinb@redhat.com>
253
254         * linux-target.c (reginfo) [FRV_LINUX_TARGET]: Add support for
255         registers fsr0, acc0-acc7, accg0-accg7, msr0, msr1, gner0, gner1,
256         fner0, and fner1.
257
258 2004-03-19  Kevin Buettner  <kevinb@redhat.com>
259
260         * ptrace-target.c (ptrace_exit_program): Cause main loop to exit.
261         * server.c (sys/types.h, sys/stat.h, fcntl.h, string.h, unistd.h)
262         (ctype.h, termios.h): Include.
263         (close_device, tty_raw, invalid_speed, parse_speed): New functions.
264         (speed_table): New static global.
265         (usage): Update usage message.
266         (main): Add support for connecting to serial devices.
267
268 2004-03-10  Kevin Buettner  <kevinb@redhat.com>
269
270         * linux-target.c (enum regset): Add constant OTHERREGS.
271         (struct peekuser_pokeuser_reginfo): Add new field,
272         alternate_register_read_write_method.  Adjust all initializers
273         accordingly.
274         (frv_fdpic_loadmap_addresses): New function.
275         (PTRACE_GETFDPIC, PTRACE_GETFDPIC_EXEC, PTRACE_GETFDPIC_INTERP):
276         Define.
277         (reginfo) [FRV_LINUX_TARGET]: Use slots 132 and 133 for the
278         loadmap registers.
279         
280 2004-03-10  Kevin Buettner  <kevinb@redhat.com>
281
282         * configure.in: Add "frv*linux*" to list of targets with thread
283         support.
284         * configure: Regenerate.
285         * Makefile.in: Regenerate using "automake --cygnus --ignore-deps".
286
287 2004-03-10  Kevin Buettner  <kevinb@redhat.com>
288
289         * ptrace-target.c (ptrace_create_child): Use vfork() instead of
290         fork().  Use PTRACE_ATTACH to attach to an existing process.
291         * server.c (usage): Update to include text about "-a".
292         (main): Allow use of -a switch to attach to an existing process.
293
294 2003-11-14  Kevin Buettner  <kevinb@redhat.com>
295
296         * config.in (FRV_LINUX_TARGET): Add.
297         * configure.in (sys/user.h): Don't check for this header; it's
298         not used.
299         (frv*linux*): Add rudimentary support for FR-V Linux.
300         * linux-target.c (PEEKUSER_POKEUSER_REGINFO, NUM_REGS, PC_REGNUM)
301         (sign_extend, greg_offset_and_size, fpreg_offset_and_size)
302         (noreg_offset_and_size, reginfo) [FRV_LINUX_TARGET]: Define.
303         * configure, Makefile.in: Regenerate.
304
305 2003-09-10  Kevin Buettner  <kevinb@redhat.com>
306
307         From Jimi Xenidis  <jimix@watson.ibm.com>:
308         * linux-target.c (reginfo): The MQ register is for IBM POWER
309         (pre-PowerPC) architecture, and is undefined in PPC GNU/Linux
310         environment.
311
312 2003-05-09  Kevin Buettner  <kevinb@redhat.com>
313
314         * linux-target.c (mips_singlestep): Don't any consider cop0 or cop1x
315         instructions to be conditional branches.  Expand set of cop1
316         opcodes considered to be conditional branches.
317
318 2003-05-08  Kevin Buettner  <kevinb@redhat.com>
319
320         * linux-target.c (mips_singlestep): Don't interpret all coprocessor
321         instructions as conditional branches.
322
323 2003-04-10  Kevin Buettner  <kevinb@redhat.com>
324
325         * linux-target.c (NUM_REGS) [MIPS_LINUX_TARGET, MIPS64_LINUX_TARGET]:
326         Bump to 72.
327         (struct peekuser_pokeuser_reginfo) [MIPS_LINUX_TARGET]: Use
328         PROTO_SIZE for ``bad'' and ``cause''.
329         (struct peekuser_pokeuser_reginfo) [MIPS_LINUX_TARGET]
330         [MIPS64_LINUX_TARGET]: Add ``fir'' register.
331
332 2003-02-07  Kevin Buettner  <kevinb@redhat.com>
333
334         * gdbserv-thread-db.h (singlestep_lwp): Add ``struct gdbserv *''
335         argument.  Adjust all callers.
336         (mips_singlestep) [MIPS_LINUX_TARGET, MIPS64_LINUX_TARGET]: New
337         function.
338         * linux-target.c (reginfo) [MIPS64_LINUX_TARGET]: Adjust some
339         of the fpregset/gregset related constants in this table.
340         (mips_get_reg): Add ``struct gdbserv *'' argument.  Adjust all
341         callers.
342         (mips_addr_as_reg, mips_peek_instruction, mips_poke_instruction):
343         New functions.
344         (mips_singlestep_program): Move bulk of implementation to and call...
345         (mips_singlestep): ...new function.  This new function no longer
346         makes any direct PTRACE_PEEKTEXT or PTRACE_POKETEXT operations.
347         Shadow breakpoint information is also stored in a slightly different
348         format.
349         * ptrace-target.c (server.h, ptrace-target.h): Adjust location
350         of #include statements so that gdbserv.h is included first.
351         (handle_waitstatus): Call ptrace_set_mem() instead of invoking
352         ptrace() directly.  Also adjust code to use somewhat different
353         shadow breakpoint structs.
354         (ptrace_set_mem, ptrace_get_mem): Remove ``static'' qualifier
355         from function declarators.
356         (singlestep_lwp): Add ``struct gdbserv *'' argument.
357         * ptrace-target.h (ptrace_get_mem, ptrace_set_mem): Declare.
358         * server.c (gdbserv.h): Include.
359         * server.h (struct ss_save): Add field ``in_use''.  Change
360         type of field ``ss_addr'' to struct ``gdbserv_reg''.
361         * thread-db.c (wait_all_threads): Revise diagnostic message to
362         print signal number for SIGDEBUG signal.
363         (singlestep_thread): Add ``struct gdbserv *'' argument.  Adjust
364         all callers.
365
366 2003-01-22  Kevin Buettner  <kevinb@redhat.com>
367
368         * linux-target.c (struct peekuser_pokeuser_reginfo)
369         [MIPS64_LINUX_TARGET, MIPS_LINUX_TARGET]: Disable registers ``cause''
370         and ``bad'' since they are not writable via ptrace().
371
372 2003-01-19  Alexandre Oliva  <aoliva@redhat.com>
373
374         * linux-target.c: Don't assume asm-mips/ is available, use just
375         asm instead.
376
377 2003-01-17  Kevin Buettner  <kevinb@redhat.com>
378
379         * configure.in (mips64*linux*n64, mips64*linux*n32, mips64*linux*o32):
380         Remove cases.  Instead, use compiler's preprocessor symbols to test
381         which ABI is being used.
382         * configure: Regenerate.
383
384 2003-01-16  Kevin Buettner  <kevinb@redhat.com>
385
386         * config.in (LIBTHREAD_DB_SO): New macro.
387         * configure.in (mips64*linux*): Remove no-threads.o from
388         TARGET_MODULES list.  Add thread-db.o to this list.
389         * configure: Regenerate.
390
391 2003-01-10  Kevin Buettner  <kevinb@redhat.com>
392
393         * Makefile.in: Regenerate using "automake --cygnus --ignore-deps".
394         Someday, when ``depcomp'' is added to the top level, the
395         --ignore-deps flag can be discarded.
396
397 2002-12-18  Kevin Buettner  <kevinb@redhat.com>
398
399         * ptrace-target.h, ptrace-target.c (ptrace_write_user)
400         (ptrace_read_user): Add struct gdbserv argument.
401         * linux-target.c: Fix all callers.
402         * ptrace-target.c (ptrace_write_user, ptrace_read_user): Add
403         debugging printf()s.
404         (ptrace_xfer_mem): Fix debugging printf()s so that they'll print
405         useful results when sizeof (long long) is the same as
406         sizeof (ptrace_xfer_type).
407         (ptrace_xfer_mem): Decode address using gdbserv_host_bytes_from_reg()
408         instead of gdbserv_reg_to_ulong().
409
410 2002-12-02  Kevin Buettner  <kevinb@redhat.com>
411
412         * linux-target.c (linux_get_reg, linux_set_reg, reg_from_regset)
413         (reg_to_regset, get_regset, put_regset reg_from_gregset)
414         (reg_to_gregset, reg_from_fpregset, reg_to_fpregset)
415         (reg_from_xregset, reg_to_xregset): Adjust all calls to
416         gdbserv_host_bytes_to_reg() and gdbserv_host_bytes_from_reg()
417         to account for change in interface.  Remove code which is
418         no longer needed due to improvements in the aforementioned
419         functions.
420         (sign_extend): New constant.
421         (FPR_BASE, PC, CAUSE, BADVADDR, MMHI, MMLO, FPC_CSR, FPC_EIR):
422         Make sure these are defined.
423         (PROTO_SIZE): Define.
424         (reginfo) [MIPS_LINUX_TARGET]: Use PROTO_SIZE to initialize
425         table with size (width) of registers to use when communicating
426         with the client.
427         (NUM_REGS, PC_REGNUM, reginfo) [MIPS64_LINUX_TARGET]: Define.
428
429 2002-11-19  Michael Snyder  <msnyder@redhat.com>
430
431         * ptrace-target.c: Fix typo in copyright.
432
433 2002-08-23  Kevin Buettner  <kevinb@redhat.com>
434
435         * linux-target.c (linux_get_reg, linux_set_reg): Print an
436         error message for out of bound registers.
437
438 2002-08-23  Kevin Buettner  <kevinb@redhat.com>
439
440         * linux-target.c (NUM_REGS) [X86_LINUX_TARGET]: Bump to 42.
441         (getregs_setregs_reginfo) [X86_LINUX_TARGET]: Add entry for
442         register ``orig_eax''.
443         (linux_get_reg, linux_set_reg): Make sure ``regno'' value is valid.
444         (linux_detach, linux_attach, decr_pc_after_break): Call fprintf()
445         instead of printf().
446         (linux_detach, linux_attach): Don't always print informational
447         messages.
448         * ptrace-target.c (handle_waitstatus, ptrace_detach, ptrace_attach):
449         Don't always print informational messages.  Use fprintf() instead
450         of printf().
451         (noop_get_trap_number, noop_compute_signal, noop_exit_program)
452         (noop_signlestep_program, noop_break_program): Delete.
453         (ptrace_flush_i_cache): Renamed from noop_flush_i_cache.  Update
454         reference in ptrace_attach().
455         (continue_lwp, singlestep_lwp, attach_lwp, stop_lwp, ps_pstop)
456         (ps_continue, ps_lstop): Use fprintf() instead of printf().
457         * server.c (errno.h): Include.
458         (usage): New function.
459         (main): Add option processing code.
460         * server.h (struct child_process): Add new field,
461         ``debug_informational''.
462         * thread-db.c (ps_plog, select_pending_event, send_pending_signals)
463         (wait_all_threads, thread_db_check_child_state): Use fprintf()
464         instead of printf().
465         (thread_db_detach): Conditionally print informational messages.
466         Use fprintf() instead of printf().
467
468 2002-08-21  Kevin Buettner  <kevinb@redhat.com>
469
470         * Makefile.am, configure.in, dummy-target.c, linux-target.c,
471         ptrace-target.c, ptrace-target.h, server.h, solaris-target.c,
472         thread-db.c: Change ``libremote'' references into ``RDA''
473         references.
474         * Makefile.in, configure: Regenerate.
475
476 2002-08-15  Kevin Buettner  <kevinb@redhat.com>
477
478         * dummy-target.c, gdb_proc_service.h, gdbserv-thread-db.h,
479         linux-target.c, no-threads.c, ptrace-target.c,
480         ptrace-target.h, server.c, server.h, solaris-target.c,
481         thread-db.c: Update copyright notices.
482
483 2002-05-16  Kevin Buettner  <kevinb@redhat.com>
484
485         * config.in (GREGSET_T): Renamed from GDB_GREGSET_T.
486         (FPREGSET_T): Renamed from GDB_FPREGSET_T.
487         * configure.in: Likewise.
488         * gdbserv-thread-db.h: Likewise.
489         * linux-target.c: Likewise.
490         * thread-db.c: Likewise.
491         * gdb_proc_service.h: Remove everything that's not absolutely
492         needed.
493
494 2002-02-01  Kevin Buettner  <kevinb@redhat.com>
495
496         * configure.in (arm32): Change to ``yes''.
497         * configure: Regenerate.
498
499 2002-01-30  Kevin Buettner  <kevinb@redhat.com>
500
501         * linux-target.c (linux_get_reg) [GETREGS_SETREGS_REGINFO]: Add
502         NOREGS support.
503         (linux_set_reg) [GETREGS_SETREGS_REGINFO]: Likewise.
504
505 2002-01-28  Kevin Buettner  <kevinb@redhat.com>
506
507         * linux-target.c (write_reg_bytes): Print return status in
508         ptrace failure message.
509         * ptrace-target.c (ptrace_write_user): Enable existing 
510         Linux/MIPS related kernel bug workaround when MIPS_LINUX_TARGET
511         is defined (which is in addition to _MIPSEL).
512
513 2002-01-28  Kevin Buettner  <kevinb@redhat.com>
514
515         * thread-db.c (struct regset_cache): New struct declaration.
516         (thread_db_map_id2thr_cache_valid, fpregset_cache, gregset_cache):
517         New static globals.
518         (thread_db_map_id2thr, thread_db_invalidate_map_id2thr_cache)
519         (initialize_regset_cache, initialize_regset_caches)
520         (thread_db_flush_regset_cache, thread_db_flush_regset_caches)
521         (thread_db_get_regset, thread_db_set_regset)
522         (thread_db_invalidate_regset_cache, thread_db_invalidate_regset_caches)
523         (thread_db_invalidate_caches, thread_db_getfpregs)
524         (thread_db_set_fpregs, thread_db_getgregs, thread_db_setgregs)
525         (td_thr_getfpregs_wrapper, td_thr_getgregs_wrapper)
526         (td_thr_setfpregs_wrapper, td_thr_setgregs_wrapper):
527         New functions.
528         (update_thread_list, thread_db_get_thread_reg)
529         (thread_db_set_thread_reg): Call thread_db_map_id2thr() instead of
530         td_ta_map_id2thr_p().
531         (thread_db_get_thread_reg): Call thread_db_getfpregs() instead
532         of td_thr_getfpregs_p().  Call thread_db_getgregs() instead of
533         td_thr_getgregs_p().
534         (thread_db_set_thread_reg): Likewise.  Also, call
535         thread_db_setfpregs() instead of td_thr_setfpregs_p() and
536         call thread_db_setgregs() instead of td_thr_setgregs_p().
537         (continue_thread, thread_db_continue_program)
538         (thread_db_singlestep_program, thread_db_continue_thread)
539         (singlestep_thread): Call thread_db_flush_regset_caches() at
540         beginning of function and thread_db_invalidate_caches() at
541         end of function.
542         (thread_db_attach): Initialize regset caches.
543
544 2002-01-15  Kevin Buettner  <kevinb@redhat.com>
545
546         * config.in (Generated automatically comment): Revise to note
547         that this file was generated automatically at one time, but is
548         no longer.
549         (LINUX_TARGET, SOLARIS_TARGET): Fix comments.
550         (MIPS_LINUX_TARGET): Add.
551         * configure.in (i?86*linux*, powerpc*linux*, arm*linux*, mips*linux*):
552         Eliminate unnecessary duplication.
553         (mips*linux*): Target is MIPS_LINUX_TARGET, not SH_LINUX_TARGET.
554         * gdbserv-thread-db.h (is_gp_reg): New function.
555         (is_fp_reg, is_extended_reg): Revise comments.
556         * linux-target.c (enum regset): Add new constant NOREGS.
557         (is_gp_reg): New function.
558         (PEEKUSER_POKEUSER_REGINFO) [MIPS_LINUX_TARGET]: Define.
559         (SIZEOF_REGMAP, SIZEOF_MAPPEDREG) [MIPS_LINUX_TARGET]: Delete.
560         (NUM_REGS) [MIPS_LINUX_TARGET]: Change from 38 to 70 to account
561         for addition of floating point support.
562         (regmap) [MIPS_LINUX_TARGET]: Delete this array.
563         (is_fp_reg, is_extended_reg) [MIPS_LINUX_TARGET]: Delete.
564         (reginfo) [MIPS_LINUX_TARGET]: Define.
565         (DEBUG): Delete this macro definition.
566         (disp_gdb_mesg, ptrace_get_mem, ptrace_set_mem): Delete function
567         declarations.
568         (linux_get_reg, linux_set_reg) [PEEKUSER_POKEUSER_REGINFO]: Add
569         NOREGS support.
570         (put_regset) [PEEKUSER_POKEUSER_REGINFO]: Add missing return
571         statement.
572         (mips_get_reg): Use read_reg_bytes() to fetch the register.
573         (mips_singlestep_program): Eliminate unused variables ``u_regs_base'',
574         ``temp_reg''.  Fix fprintf related format warning.
575         * ptrace-target.h (ptrace_check_child_state): Declare.
576         * thread-db.c (thread_db_get_thread_reg, thread_db_set_thread_reg):
577         Handle case of target not supporting one or more registers.
578
579 2001-10-15  Kevin Buettner  <kevinb@redhat.com>
580
581         * gdbserv-thread-db.h (is_extended_reg, reg_to_xregset)
582         (reg_from_xregset): New functions.
583         (debug_get_pc, decr_pc_after_break): Add declaration.
584         * linux-target.c (sys/procfs.h): Include.
585         (MAX_REG_SIZE): New anonymous enum constant.
586         (enum regset): New enum.
587         (getregs_setregs_reginfo, peekuser_pokeuser_reginfo): New structs.
588         (offsetof, fieldsize): New macros.
589         (ARM_LINUX_TARGET, X86_LINUX_TARGET, PPC_LINUX_TARGET): Deleted
590         old data structures defining register maps for these registers.
591         Replaced with new tables using either getregs_setregs_reginfo
592         or peekuser_pokeuser_reginfo structs.  Other architectures
593         remain the same, though reoranized somewhat.
594         (linux_next_gg_reg, linux_gg_reg_nr): Revise comments.  Use
595         NUM_REGS instead of NUM_G_PACKET_REGS.
596         (get_xregsetsize): New function.
597         (linux_reg_format, linux_sizeof_reg, is_fp_reg, is_extended_reg)
598         [PEEKUSER_POKEUSER_REGINFO, GETREGS_SETREGS_REGINFO]: New functions.
599         (read_reg_bytes, write_reg_bytes, debug_get_reg, debug_get_pc)
600         (linux_get_reg, linux_set_reg, reg_from_regset, reg_to_regset)
601         (reg_from_gregset, reg_to_gregset, reg_from_fpregset, reg_to_fpregset)
602         (reg_from_xregset, reg_to_xregset, get_regset, put_regset, get_gregset)
603         (put_gregset, get_fpregset, put_fpregset, get_xregset, put_xregset)
604         [PEEKUSER_POKEUSER_REGINFO]: New functions.
605         (read_reg_as_ulong, write_reg_as_ulong, debug_get_reg, debug_get_pc)
606         (linux_get_reg, linux_set_reg, regs_from_gregset, regs_to_gregset)
607         (reg_from_fpregset, reg_to_fpregset, reg_from_xregset, reg_to_xregset)
608         (get_gregset, put_gregset, get_fpregset, put_fpregset, get_xregset)
609         (put_xregset) [GETREGS_SETREGS_REGINFO]: New functions.
610         (linux_process_get_regs, linux_process_get_reg, linux_process_set_reg)
611         (linux_process_set_regs, ppc_linux_process_set_reg)
612         (ppc_linux_process_get_reg, ppc_linux_process_set_regs)
613         (ppc_linux_process_get_regs): Deleted.
614         (linux_attach): Reorganize initializations.
615         (generic_linux_set_reg): Renamed to linux_set_reg.
616         (generic_linux_get_reg): Renamed to linux_get_reg.
617         (generic_linux_sizeof_reg): Renamed to linux_sizeof_reg.
618         (generic_linux_gg_reg_nr): Renamed to linux_gg_reg_nr.
619         (generic_linux_next_gg_reg): Renamed to linux_next_gg_reg.
620         (generic_linux_reg_format): Renamed to linux_reg_format.
621         (decr_pc_after_break): Consolidated versions of this function
622         down to two; one for x86 and one for everything else.  Also,
623         add ``serv'' parameter and fix all callers.
624         (debug_get_pc, debug_get_reg): Now only three versions of
625         this function, one for PEEKUSER_POKEUSER_REGINFO code,
626         one for GETREGS_SETREGS_REGINFO code, and one for legacy
627         code.  Also, debug_get_pc() now takes a ``serv'' parameter.
628         Fixed all callers.
629         (ps_lgetregs): Use new get_gregset() interface.
630         (ps_lsetregs): Use new put_gregset() interface.
631         (ps_lgetfpregs, ps_lsetfpregs, ps_lgetxregsize, ps_lgetxregs)
632         (ps_lsetxregs): Implement.
633         * ptrace-target.c (ptrace_read_user, ptrace_write_user): Make
634         ``buff'' argument of type ``void *'' instead of ``char *''.
635         (ptrace_get_gregs): Add new parameter ``alt_pid''.
636         (ptrace_set_gregs): Likewise.
637         (ptrace_get_fpregs): Add new parameter alt_pid.  Also fix call
638         to ptrace() so parameters are in correct order.
639         (ptrace_set_fpregs): Likewise.
640         (ptrace_get_fpxregs, ptrace_set_fpxregs): New functions.
641         * ptrace-target.h (ptrace_write_user, ptrace_read_user)
642         (ptrace_get_gregs, ptrace_set_gregs, ptrace_get_fpregs)
643         (ptrace_set_fpregs, ptrace_get_fpxregs, ptrace_set_fpxregs):
644         Declare.
645         * thread-db.c (td_thr_getxregsize_p, td_thr_getxregs_p)
646         (td_thr_setxregs_p): New function pointers.
647         (thread_db_dlopen): Initialize new function pointers.
648         (send_pending_signals): Add ``process'' parameter so that
649         decr_pc_after_break() can get the ``serv'' argument.  Fix all
650         callers.
651         (thread_db_get_thread_reg, thread_db_set_thread_reg): Add xregset
652         support.
653
654 2001-10-14  Kevin Buettner  <kevinb@redhat.com>
655
656         * ptrace-target.c (unistd.h): Include.
657         (close_open_files): New function.
658         (ptrace_create_child):  In newly forked child process, call
659         close_open_files() before invoking execv().
660
661 2001-10-13  Kevin Buettner  <kevinb@redhat.com>
662
663         * server.c (signal.h): Include.
664         (chld_handler): New function.
665         (main): Establish chld_handler as the SIGCHLD signal handler.
666         Also, wait 1 second instead of 0 seconds to avoid busy waiting.
667
668 2001-09-26  Louis Hamilton  <hamilton@redhat.com>
669
670         * configure.in: Use thread-db.c for ARM.
671         * configure: Regenerated.
672         * linux-target.c (ARM_R11, ARM_R12): Added to regmap[].
673         (ARM_FP, ARM_CPSR): Revised mappings of these ARM registers.
674         (debug_get_reg, debug_get_pc, decr_pc_after_break) [ARM_LINUX_TARGET]:
675         New functions.
676         
677 2001-09-20  Kevin Buettner  <kevinb@redhat.com>
678
679         * configure.in: Use thread-db.c for Linux/PPC too.
680         * configure: Regenerated.
681         * linux-target.c (linux_read_reg): Add forward declaration.
682         (debug_get_reg, debug_get_pc, decr_pc_after_break) [PPC_LINUX_TARGET]:
683         New functions.
684
685 2001-09-20  Kevin Buettner  <kevinb@redhat.com>
686
687         * linux-target.c (SIZEOF_MAPPEDREG) [PPC_LINUX_TARGET]: Add comment.
688         (PC_REGNUM) [PPC_LINUX_TARGET]: Remove FIXME comment.
689         (is_fp_reg) [PPC_LINUX_TARGET]: Revise upper bound on floating
690         point register numbers.
691         (ppc_linux_getset_reg): Rewritten to use regmap[] to fetch
692         ptrace() offsets.  This'll handle the (previously unsupported)
693         floating point registers, cr, lr, ctr, and xer.
694         (ppc_linux_process_set_regs, ppc_linux_process_get_regs): Don't
695         hardcode loop upper bound.
696         (ppc_linux_process_get_regs): Revise declarator to match
697         process_get_regs member in struct gdbserv_target.
698
699 2001-09-18  Andrew Haley  <aph@cambridge.redhat.com>
700
701         * server.c (main): Work around SIGCHLD problem.
702
703 2001-08-05  Michael Chastain  <chastain@redhat.com>
704
705         * ptrace-target.c (ptrace_write_user): Ignore ESRCH on MIPS,
706         because mips linux kernel 2.4 has a bug where PTRACE_POKEUSER
707         returns -ESRCH even when it succeeds.
708
709 2001-08-03  Michael Keezer  <mkeezer@redhat.com>
710
711         * configure.in: Add am33_2.0 & mn10300.
712         * config.in: Add AM33_LINUX_TARGET & AM33_2_0_LINUX_TARGET.
713         * linux-target.c: am33_2.0 & mn10300 support.
714
715 2001-07-23  David Howells  <dhowells@redhat.com>
716
717         * ptrace-target.c: Added big-endian MIPS support.
718         * linux-target.c: ditto.
719         * server.h: ditto.
720
721 2001-06-25  Michael Snyder  <msnyder@redhat.com>
722
723         * ptrace-target.c (ptrace_compute_signal): Implement conversion 
724         from native signals to GDB's signal numbering.
725         (ptrace_process_signal): Implement conversion from GDB's signal
726         numbering to native signals.
727         (stop_lwp): Comment out debugging output of SIGSTOP signals.
728         * linix-target.c (linux_fromtarget_break): Call compute_signal.
729         (linux_fromtarget_terminate): Ditto.
730         * thread-db.c (thread_db_check_child_state): Don't do any conversion
731         when passing a signal directly back to the inferior; just copy from
732         stop_signal to signal_to_send.
733         (thread_db_fromtarget_thread_break): Convert signal from native
734         numbering to GDB's numbering.
735
736 2001-06-18  Michael Snyder  <msnyder@redhat.com>
737
738         * linux-target.c (generic_linux_set_reg): Fix typo.
739         (decr_pc_after_break): Mute the debugging output.
740
741 2001-06-15  Michael Snyder  <msnyder@redhat.com>
742
743         * thread_db.c: Disable noisy debugging output.
744         (select_pending_event): Add new selection criterion, giving
745         preference to a thread that is being single-stepped.  This 
746         avoids the problem of deciding whether to decrement the pc if
747         we don't know whether a SIGTRAP was caused by stepping or by
748         hitting a breakpoint.
749
750 2001-06-14  Michael Snyder  <msnyder@redhat.com>
751
752         * thread-db.c (thread_db_set_gen, thread_db_get_gen): Rewrite
753         syntax for qSymbol messages.
754         * gdb_proc_service.h: New file.
755         * Makefile.am (INCLUDES): Remove $(srcdir)/../../include.
756         * Makefile.in: Regenerate.
757
758 2001-05-31  Michael Snyder  <msnyder@redhat.com>
759
760         * thread-db.c (add_thread_to_list): Return explicit value!
761
762 2001-05-23  Jackie Smith Cashion <jsmith@redhat.com>
763
764         * linux-target.c: Change MIPS SIZEOF_MAPPEDREG from 1 to 4.
765         (linux_register_offset): For MIPS return regmap[regnum] instead of
766         SIZEOF_MAPPEDREG * regmap[regnum].
767         (mips_get_reg): Pass pid as argument to ptrace_read_user instead of
768         gdbserv pointer.
769         
770 2001-05-22  Michael Snyder  <msnyder@redhat.com>
771
772         * no-threads.c: New file.
773         * configure.in: Use thread-db.c only for specified architectures, 
774         (including x86); otherwise default to using no-threads.c.
775         * configure: Regenerate.
776         
777 2001-05-10  Martin M. Hunt  <hunt@redhat.com>   
778
779         * linux-target.c (is_fp_reg): New function for mips. 
780         FP not implemented.
781         
782         Merged changes from symbol branch with appropriate modifications.
783
784 Mon Mar 26 08:54:41 PST 2001  Brendan Conoboy <blc@redhat.com>
785  
786         * configure.in: Added mipsvr4181el* target
787         * configure: regenerate
788  
789 2001-01-26  Rudy Folden <rfolden@redhat.com>
790         
791         * server.c: Changed name from gdbgeneral_xxx to gdbconnect_xx.
792  
793 2001-01-24  Rudy Folden <rfolden@redhat.com>
794  
795         * configure: Added mipsel* target.
796         * linux-target.c: Add support for MIPS processor, including single-
797         stepping which doesn't exist in mips ptrace.
798         * ptrace-target.c (ptrace_handle_waitstatus): Added single-stepping
799         instruction restore for mips.
800         (ptrace_attach): Added single stepping initialization code.
801         * server (main): Added generic interfaces, gdbgeneral_startup/shutdown
802         for serial or tcp/ip selection. Also added server_quit_p to X and W 
803         for serial support (no socket shutdown).
804         * server.h (child_process): Added mips instruction save area for
805         single-step support.
806
807         2001-01-10  Rudy Folden <rfolden@redhat.com>
808         * ptrace-target.c (enum): Added U_REGS_OFFSET to processor
809         dependent enums.
810
811 2001-04-26  Michael Snyder  <msnyder@redhat.com>
812
813         * linux-target.c (is_fp_reg): New function.
814         (reg_from_fpregset, reg_to_fpregset): New functions.
815         Support for thread_db_get_thread_reg floating point regs.
816         * thread-db.c (thread_db_get_thread_reg, thread_db_set_thread_reg):
817         Infrastructure for support of floating point regs.
818         (Attach_thread): New function, abstracted from below.
819         (find_new_threads_callback): Call attach_thread.
820         (stop_thread): New function, abstracted from stop_all_threads.
821         (stop_all_threads): Call stop_thread.
822         (continue_thread): Test for lwp == 0 before calling continue_lwp.
823         * ptrace-target.c (stop_lwp): New function.
824         * gdbserv-thread-db.h (reg_to_regnum, reg_from_regnu): Declare.
825
826 2001-04-25  Michael Snyder  <msnyder@redhat.com>
827
828         Move all ptrace references out of thread-db.c.
829         * gdbserv-thread-db.h: New file.
830         * thread-db.c (struct ps_prochandle): Move to gdbserv-thread-db.h.
831         (gdb_ps_prochandle_t): Ditto.
832         (gdb_ps_read_buf_t, gdb_ps_write_buf_t, gdb_ps_size_t): Ditto.
833         (ps_pstop, ps_pcontinue): Move to ptrace-target.c.
834         (ps_lstop, ps_lcontinue): Ditto.
835         (ps_pdread, ps_pdwrite, ps_ptread, ps_ptwrite): Ditto.
836         (ps_lgetxregsize): Move to linux-target.c.
837         (ps_lgetxregs, ps_lsetxregs, ps_getpid): Ditto.
838         (ps_lgetregs, ps_lsetregs, ps_lgetfpregs, ps_lsetfpregs): Ditto.
839         (find_new_threads_callback): Abstract attach bits into new function
840         attach_lwp, and move that to ptrace-target.c.
841         (wait_all_threads): Call continue_lwp instead of ptrace.
842         (continue_pid): Rename as continue_lwp, move into ptrace-target.c.
843         (singlestep_pid): Rename as continue_lwp, move into ptrace-target.c.
844         (struct symbol_cache): Change value to a paddr_t.
845         (add_symbol_to_list, lookup_cached_symbol): Ditto.
846         * linux-target.c (ps_lgetregs, ps_lsetregs, ps_lgetfpregs, 
847         ps_lsetfpregs, ps_lgetxregsize, ps_lgetxregs, ps_lsetxregs,
848         ps_getpid): Moved to here from thread-db.c.
849         * ptrace-target.c (continue_lwp, singlestep_lwp, attach_lwp,
850         (ps_pstop, ps_pcontinue, ps_lstop, ps_lcontinue, ps_pdread,
851         ps_pdwrite, ps_ptread, ps_ptwrite): Moved here from thread-db.c.
852         (ptrace_handle_waitstatus): Renamed as handle_waitstatus.
853         (ps_lcontinue): Implement (untested).
854         * server.c (main): Check server_quit_p after calling gdbloop_poll.
855
856
857 2001-04-24  Michael Snyder  <msnyder@redhat.com>
858
859         * thread-db.c (continue_pid, continue_thread): New functions.
860         (singlestep_pid, singlestep_thread): New functions.
861         (continue_all_threads): Use new function continue_thread.
862         (thread_db_continue_program): Ditto.
863         (thread_db_singlestep_program): Ditto.
864         (thread_db_continue_thread): Ditto.
865         (thread_db_singlestep_thread): Ditto.
866         
867         * thread-db.c: Remove some debugging printfs.
868         Add activation and handling of the thread debug signal.
869         (get_thread_signals): Get the debug signal as well as the others.
870         Set target flag to activate the debug signal.
871         (set_target_int_by_name): New function.
872         (struct gdbserv_thread): Rename "sigstopped" flag to just "stopped".
873         (stop_all_threads): Mark the event thread "stopped".
874         (wait_all_threads): Mark the event thread "waited".
875         Don't stash the debug signal (throw it away).
876         (continue_all_threads): Always send the restart signal to any
877         thread that has just been attached.
878         (thread_db_check_child_state): Make two calls to waitpid (one with
879         WCLONE, one without) instead of alternating every other time.
880         Add debug_signal to the list of events to ignore.
881         (thread_db_attach): Add "__pthread_threads_debug" to list of symbols.
882
883 2001-04-20  Michael Snyder  <msnyder@redhat.com>
884
885         * thread-db.c (thread_db_check_child_state): Add SIGCHLD to the
886         list of signals to ignore.  When a thread exits, make sure that
887         the other threads get restarted.
888
889 2001-04-19  Michael Snyder  <msnyder@redhat.com>
890
891         * thread-db.c (wait_all_threads): Save exit and term events.
892         Save SIGINT like any other signal event.  
893         (send_pending_signals): Don't send SIGINT.
894         (select_pending_event): Give preference to SIGINT.
895         (thread_db_check_child_state): Move special handling of 
896         cancel and restart signals to after the stop_all_threads
897         and wait_all_threads calls, so we can catch these signals
898         even if they aren't the first signal we get notification of.
899
900 2001-04-19  Michael Snyder  <msnyder@redhat.com>
901
902         Major change to select an event so as to avoid starvation.
903         * thread-db.c (select_pending_event): New function.  Choose an
904         event from the list of pending events, and make its thread the
905         event thread.
906         (stop_all_threads): Don't mark the event thread.  That will now
907         be done by select_pending_event.
908         (struct signal_list): Rename to event_list.  Save the thread and
909         the entire wait status, so that all events (not just signals)
910         can be saved.
911         (add_pending_signal): Rename to add_pending_event.
912         (send_pending_signals): Ignore non-signal events.
913         Ignore the selected event (which will be returned to the debugger).
914         Push back breakpoint events (moved here from wait_all_threads).
915         (wait_all_threads): Remove special handling for SIGTRAP (moved
916         into send_pending_signals).  Call select_pending_event.
917         (thread_db_check_child_status): Add initial event to event list.
918
919 2001-04-16  Michael Snyder  <msnyder@redhat.com>
920         * thread-db.c (thread_db_continue_thread): Handle the signal param.
921         (thread_db_singlestep_thread): Ditto.
922         (thread_db_check_child_state): Handle exit and termination separately.
923
924 2001-04-13  Michael Snyder  <msnyder@redhat.com>
925
926         * thread-db.c (find_new_threads_callback): Account for dead threads.
927         (update_thread_list): Keep zombie threads in thread list, but
928         delete them if they've been joined or detached.
929         (stop_all_threads): Don't stop dead threads.
930         (continue_all_threads): Don't continue if not waited.
931         (thread_db_check_child_state): Move handling of terminate and
932         exit earlier.  Handle termination or exit of children specially.
933         (thread_db_get_thread_reg): Test for defunct threads.
934         (thread_db_set_thread_reg): Ditto.
935         * ptrace-target.c (ptrace_xfer_mem): Don't be noisy about ptrace
936         errors caused by illegal memory accesses.
937
938 2001-04-12  Andrew Cagney  <ac131313@redhat.com>
939
940         * server.c: Include "gdbloop.h".  Replace gdbsocket_poll with
941         gdbloop_poll.
942         * ptrace-target.c, linux-target.c, solaris-target.c: 
943         * dummy-target.c: Update comments.
944
945 2001-04-11  Michael Snyder  <msnyder@redhat.com>
946
947         * thread-db.c (struct gdbserv_thread): Add new flag 'stepping'.
948         (stop_all_threads): Add parameter 'process'.
949         Set the process->event_thread here, instead of in check_child_state.
950         (wait_all_threads): Accept process as a parameter instead of eventpid.
951         Handle SIGTRAP differently if the thread was singlestepping.
952         (thread_db_singlestep_program): Clear flags for event thread.
953         (thread_db_singlestep_thread): Ditto.
954         (thread_db_continue_program): Ditto.
955         (thread_db_continue_thread): Ditto.
956         (thread_db_check_child_state): Cancel the stepping flag.
957         Don't set the event thread, this is now done in stop_all_threads.
958         * linux-target.c (debug_get_reg, debug_get_pc): New functions.
959         Purely for debugging output.  Architecture dependent.
960
961 2001-04-09  Michael Snyder  <msnyder@redhat.com>
962
963         * thread_db.c (thread_db_continue_thread): Continue the actual
964         thread given, not necessarily the event thread.
965         (thread_db_singlestep_thread): Step the actual thread given, 
966         not necessarily the event thread.
967
968 2001-04-09  Michael Snyder  <msnyder@redhat.com>
969
970         * thread-db.c (stop_all_threads): Do not send SIGSTOP to a thread
971         if it has already been sigstopped.
972         (thread_db_continue_thread): New function.  Continue a single thread.
973         (thread_db_singlestep_thread): New function.  Step a single thread.
974         (thread_db_attach): Set up continue_thread, singlestep_thread methods.
975         
976 2001-04-09  Michael Snyder  <msnyder@redhat.com>
977
978         * linux-target.c (PC_REGNUM): New enum, define.
979         (decr_pc_after_break): New function.  Architecture dependent.
980         This version will probably serve for all targets for which
981         DECR_PC_AFTER_BREAK is one.  Those for which it is zero will
982         want to define a no-op version of this function.
983         * thread-db.c (first_thread_in_list): New function.
984         (update_thread_list, stop_all_threads, wait_all_threads, 
985         continue_all_threads): Use first_thread_in_list in for loops.
986         (wait_all_threads): Handle SIGINT and SIGTRAP specially.
987         Throw away SIGINT for all threads but the event thread.
988         For SIGTRAP in other than the event thread, call decr_pc_after_break
989         (giving the thread a chance to hit the trap again later).
990         (thread_db_continue_program, thread_db_singlestep_program):
991         Continue the event thread before all the others.
992
993 2001-04-05  Michael Snyder  <msnyder@redhat.com>
994
995         * thread-db.c (add_pending_signal, send_pending_signals):
996         New functions.  Allow wait_all_threads to collect any signals
997         other than SIGSTOP from the threads and defer them.
998         (wait_all_threads): Loop on each thread and call waitpid until
999         we get SIGSTOP.  Any other signals are pended by throwing them
1000         into a list, and then sending them back to the threads using kill.
1001         (thread_db_get_thread_reg): Remove temporary hack for libthread_db
1002         bug.  (thread_db_set_thread_reg): Ditto.
1003
1004 2001-04-04  Michael Snyder  <msnyder@redhat.com>
1005
1006         * server.h (struct child_process): Add a 'running' flag.
1007         * thread_db.c (continue_all_threads): Take gdbserv as argument.
1008         Use it to find the current thread, and don't continue that one
1009         (leave it up to the parent method to continue the event thread.)
1010         (thread_db_continue_program): Child is running -- set a flag.
1011         (thread_db_singlestep_program): Ditto.
1012         (thread_db_check_child_state): Return immediately unles the child
1013         is running.  Because this is a polling routine, we don't want to
1014         return any new events unles the child is officially running.
1015         Call waitpid with -1 instead of the process->pid, so that we
1016         can get events from the threads.  Alternately use __WCLONE.
1017         (thread_db_get_thread_reg): If thread is not specified, use
1018         the event thread (if possible).  Temporarily hack around a
1019         bug in the thread_db library.
1020         (thread_db_set_thread_reg): Ditto.
1021         
1022 2001-04-04  Michael Snyder  <msnyder@redhat.com>
1023
1024         * thread-db.c (continue_all_threads): Zero the attached, stopped,
1025         and waited flags only if thread is successfully continued.
1026         * linux-target.c: Fix broken endif directive.
1027         * configure.in: Test for sys/procfs.h.
1028         * config.in: Define HAVE_SYS_PROCFS_H.
1029         * configure: Regenerate.
1030         * thread-db.c (thread_list_lookup_by_pid): New function.
1031         (thread_db_check_child_state): Cache the event thread.
1032         (thread_db_fromtarget_thread_break): New function.  Call
1033         gdbserv_fromtarget_thread_break with the event thread.
1034         (thread_db_attach): Take over the fromtarget_break vector.
1035         * server.h (struct child_process): Add event_thread field.
1036
1037 2001-04-02  Michael Snyder  <msnyder@redhat.com>
1038
1039         * thread-db.c: include errno.h for error reporting.
1040         (struct gdbserv_thread): Add flag 'waited'.
1041         (thread_db_type_str): New function for thread_extra_info.
1042         (find_new_threads_callback): Use errno for error reporting.
1043         (thread_db_thread_info): New function, for thread_extra_info.
1044         (wait_all_threads): New function.  Call waitpid on all threads
1045         that have been attached or sigstopped.  Incomplete -- needs to
1046         push back any signals other than SIGSTOP.
1047         (continue_all_threads): Send PTRACE_CONT only to threads that
1048         have been attached or sigstopped.
1049         (check_child_state): Call wait_all_threads.
1050         (thread_db_attach): Activate thread_info vector.
1051
1052 2001-03-30  Michael Snyder  <msnyder@redhat.com>
1053
1054         * linux-target.c (linux_read_reg, linux_write_reg): New functions.
1055         Abstract out the code to actually read a register value, so that 
1056         it can be shared by several methods.
1057         (get_gregset): Use sizeof (GREGSET_T).
1058         (generic_linux_gg_reg_nr): New function.  Support new reg methods.
1059         (generic_linux_next_gg_reg): Ditto.
1060         (generic_linux_sizeof_reg): Ditto.
1061         (generic_linux_reg_format): Ditto.
1062         (generic_linux_get_reg): New function.  Newer register method,
1063         non-thread-aware version.
1064         (linux_attach): Use new register method in target vector.
1065         * thread-db.c: Remove some developmental ifdef code.
1066         (thread_db_get_thread_reg): Fall back on parentvec.get_reg
1067         if no thread or no thread_agent available.
1068         (thread_db_attach): Replace get_reg vector with get_thread_reg.
1069
1070         * ptrace-target.c (ptrace_write_user): For X86 target, skip
1071         write-protected location in user/context address space.
1072         * linux-target.c (linux_process_get_reg): Use linux_read_reg.
1073         (linux_process_set_reg): Use linux_write_reg.
1074         (put_gregset): New function.  Write child's gregset.
1075         (generic_linux_get_reg): Use SIZEOF_MAPPEDREG.
1076         (generic_linux_set_reg): New function.  Newer register method.
1077         (linux_attach): Add set_reg to target vector, not process_set_reg.
1078         * thread-db.c (ps_lsetregs): Implement by calling put_gregset.
1079         (thread_db_set_thread_reg): New function.  Implement set_thread_reg.
1080         (thread_db_attach): Add set_thread_reg to target vector.
1081
1082 2001-03-29  Michael Snyder  <msnyder@redhat.com>
1083
1084         * ptrace-target.c (ptrace_read_user, ptrace_write_user):
1085         Accept an explicit pid instead of a struct gdbserv.
1086         * linux-target.c: Include gdb_proc_service.h for gregset_t
1087         (FIXME: better place to get it from?)
1088         (linux_register_offset): Return signed long to facilitate 
1089         test for -1 error return value.
1090         (ppc_linux_xfer_reg, linux_process_get_reg, linux_process_set_reg):
1091         Calls to ptrace_read_user and ptrace_write_user now need a pid
1092         argument instead of a struct gdbserv.
1093         (reg_from_gregset): New function.
1094         (reg_to_gregset): New function.
1095         (get_gregset): New function.  Read child's gregset.
1096         * thread-db.c (ps_lgetregs): Implement by calling get_gregset.
1097         (thread_db_dlopen, thread_db_open, thread_db_attach): Change 
1098         sense of return: -1 now means failure, 0 means success.
1099         (thread_db_get_thread_reg): Call reg_from_gregset.
1100
1101 2001-03-29  Michael Snyder  <msnyder@redhat.com>
1102
1103         * thread-db.c: Include signal.h, sys/ptrace.h (FIXME ptrace).
1104         (struct symbol_cache): Make value (address) unsigned.
1105         (add_symbol_to_list, lookup_cached_symbol): Ditto.
1106         (struct gdbserv_thread): Add attached, stopped flags to thread.
1107         (add_thread_to_list): Return pointer to new thread in list.
1108         (delete_thread_from_list): New function.
1109         (ps_pglobal_lookup, ps_pdread, ps_pdwrite, ps_ptread, ps_ptwrite):
1110         Muffle debugging output.
1111         (find_new_threads_callback): Muffle debugging output.
1112         Add thread to list only if it isn't already there.
1113         Use ptrace to attach to new threads.  (FIXME explicit ptrace).
1114         (update_thread_list): New function.  Only place where td_ta_thr_iter
1115         is called.  Builds up the thread list, prunes it of any dead threads.
1116         (thread_db_thread_next): Call update_thread_list.
1117         (get_thread_signals): Read the values of the cancel and restart
1118         signals from the target using hardcoded symbol names.
1119         (stop_all_threads): New function.  First cut.  Deliver SIGSTOP
1120         to all threads except the event thread and any new threads that
1121         have just been attached.
1122         (continue_all_threads): New function.  First cut.  Deliver
1123         PTRACE_CONT to all threads except the main thread.  Needs work.
1124         (thread_db_continue_program): New function.  
1125         (thread_db_singlestep_program): New function.
1126         (thread_db_get_thread_reg): New function, incomplete.
1127         (thread_db_attach): Take over continue_program, singlestep_program.
1128         Muffle some debugging output.
1129
1130 2001-03-26  Michael Snyder  <msnyder@redhat.com>
1131
1132         * thread-db.c: New file.  Linux thread debugging layer.
1133         * linux-target.c (linux_attach): Call thread_db_attach.
1134         * ptrace-target.c: Export ptrace_handle_waitstatus for
1135         thread-db.c (FIXME).
1136         * configure.in: Add thread-db.c to linux target modules.
1137         (GREGSET_T, FPREGSET_T, HAVE_LWPID_T, HAVE_PSADDR_T,
1138         HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T, LINUX_TARGET): Define.
1139         * config.in (GREGSET_T, FPREGSET_T, HAVE_LWPID_T, 
1140         HAVE_PSADDR_T, HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T, LINUX_TARGET): 
1141         Default undefine.
1142         * configure: Regenerate.
1143         * Makefile.am (INCLUDES): Add $(srcdir)/../../include
1144         (devo/include), so that header files can be shared with gdb.
1145         (server_LDFLAGS): Add -ldl -rdynamic (FIXME configure).
1146         * Makefile.in: Regenerate.
1147
1148 2001-03-22  Andrew Cagney  <ac131313@redhat.com>
1149
1150         * server.c (main): Pass gdbserver.attach and process to
1151         gdbserver_startup instead of gdbserver_poll.
1152
1153 2001-03-16  Michael Snyder  <msnyder@redhat.com>
1154
1155         * linux-target.c (linux_detach): Pass new parameter to ptrace_detach.
1156         Fix file header comment typo.  Update copyright.
1157
1158 2001-03-16  Elena Zannoni  <ezannoni@cygnus.com>
1159
1160         * dummy-target.c (dummy_detach): Add new parameter.
1161         * linux-target.c (linux_detach): Ditto.
1162         * ptrace-target.c (ptrace_detach): Ditto.
1163         * solaris-target.c (solaris_detach): Ditto.
1164
1165 2001-03-14  Andrew Cagney  <ac131313@redhat.com>
1166
1167         * ChangeLog: Move to here from ../native.
1168         * Makefile.am: Ditto.
1169         * aclocal.m4: Ditto.
1170         * configure.in: Ditto.
1171         * dummy-target.c: Ditto.
1172         * linux-target.c: Ditto.
1173         * ptrace-target.c: Ditto.
1174         * ptrace-target.h: Ditto.
1175         * server.c: Ditto.
1176         * server.h: Ditto.
1177         * solaris-target.c: Ditto.
1178         * Makefile.in: Regenerate.
1179         * config.in: Ditto.
1180         * configure: Ditto.
1181
1182 2001-03-14  Andrew Cagney  <ac131313@redhat.com>
1183
1184         * Makefile.am (INCLUDES): Update. Headers moved to ../include.
1185         * Makefile.in: Regenerate.
1186
1187 2000-11-27  Michael Snyder  <msnyder@happy.cygnus.com>
1188
1189         * ptrace-target.c (ptrace_xfer_mem): Return -1 on error.
1190
1191 2000-11-21  Michael Snyder  <msnyder@cleaver.cygnus.com>
1192
1193         * ptrace-target.c (noop_flush_i_cache): Comment out superfluous
1194         debugging output.
1195         * linux-target.c (linux_process_get_reg): Return value of 
1196         linux_register_offset is unsigned (can't be less than zero).
1197         (linux_process_rcmd): Just use '1' and '0' to control debug output.
1198
1199 2000-11-06  Michael Snyder  <msnyder@cleaver.cygnus.com>
1200
1201         * dummy-target.c (dummy_attach): Fix order of memset args.
1202         * linux-target.c (linux_attach): Ditto.
1203         * ptrace-target.c (ptrace_attach): Ditto.
1204         * solaris-target.c (solaris_attach): Ditto.
1205
1206 2000-10-19  Belinda Brazelle <brazelle@redhat.com>
1207
1208         * linux-target.c: Add support for Arm processor.
1209
1210 2000-10-12  Michael Snyder  <msnyder@cleaver.cygnus.com>
1211
1212         * ptrace-target.c (ptrace_handle_waitstatus): Save exitstatus
1213         in process->stop_signal.
1214
1215 2000-09-14  Michael Snyder  <msnyder@michael.wirespeed.com>
1216
1217         * linux-target.c: Define regmap etc. for SH target.
1218         * configure.in: Add defines for SH target.
1219         * configure: Rebuild.
1220
1221 2000-09-13  Michael Snyder  <msnyder@michael.wirespeed.com>
1222
1223         * server.h (fromtarget_terminate): New field.  Also fix up 
1224         some overlooked function prototypes in the existing fields.
1225         (struct client_process): Rename to struct child_process.
1226         * linux-target.c (linux_fromtarget_terminate): New function.
1227         Called from main when child terminates abnormally.
1228         (linux_process_rcmd): New function.  Catches "qRcmd" requests, 
1229         which are currently used just to turn on debug output.
1230         * ptrace-target.c (ptrace_handle_waitstatus): Set stop_signal
1231         for the WIFSTOPPED case.  (ptrace_process_signal): Return zero
1232         instead of the signal number, to let libremote know that we have
1233         handled the signal.  (ptrace_xfer_memory): Fix off-by-one error.
1234         * solaris-target.c (solaris_fromtarget_terminate): New function.
1235         * server.c (main): Call fromtarget_terminate for the 'T' case.
1236         Do not request a one-second delay from gdbsocket_poll.
1237
1238 2000-09-08  Michael Snyder  <msnyder@cleaver.cygnus.com>
1239
1240         * solaris-target.c: New file.  Just a prototype, doesn't actually
1241         work.  Used to confirm configurability to multiple targets.
1242         * dummy-target.c: New file.  Dummy back-end for implementing new
1243         targets such as solaris-target.c (above), before actually having
1244         a working back-end.  The dummy target works just like the sample
1245         target in the samples directory.
1246         * configure.in: Add AC_SUBST(TARGET_MODULES) to add the 
1247         appropriate target modules to the Makefile.  Add solaris target.
1248         * configure: Regenerate.
1249         * Makefile.am: Move *-target.c into EXTRA_server_SOURCES.
1250         Add TARGET_MODULES to server_LDADD.  Define server_DEPENDENCIES.
1251         * Makefile.in: Regenerate.
1252         * ptrace-target.h: New file.  Defines needed only by ptrace.
1253         * server.h: Remove ptrace-specific defines to ptrace-target.h.
1254         (struct server_vector): New, for target entry points.
1255         (struct nativeserver): Rename to struct client_process.
1256         * server.c: Use client_process for entry points, and server_vector.
1257         * linux-target.c: Include ptrace-target.h.  
1258         (ppc_linux_get_reg): Rename to ppc_linux_process_get_reg.
1259         (ppc_linux_set_reg): Rename to ppc_linux_process_set_reg.
1260         (ppc_linux_get_regs): Rename to ppc_linux_process_get_regs.
1261         (ppc_linux_set_regs): Rename to ppc_linux_process_set_regs.
1262         (linux_get_reg): Rename to linux_process_get_reg.
1263         (linux_set_reg): Rename to linux_process_set_reg.
1264         (linux_get_regs): Rename to linux_process_get_regs.
1265         (linux_set_regs): Rename to linux_process_set_regs.
1266         (gdbserver_check_child_state): Rename to linux_check_child_state.
1267         (gdbserver_fromtarget_break): Rename to linux_fromtarget_break.
1268         (gdbserver_fromtarget_exit): Rename to linux_fromtarget_exit.
1269         (struct server_vector gdbserver): New, defines entry points.
1270         * ptrace-target.c: Include ptrace-target.h.
1271         * aclocal.m4: New file.
1272
1273 2000-09-08  Michael Snyder  <msnyder@cleaver.cygnus.com>
1274
1275         * linux-target.c (linux_get_reg, linux_set_reg): Remove direct
1276         calls to ptrace; instead use service call into ptrace-target.c.
1277         (linux_get_regs, linux_set_regs): Remove ifdef PPC; instead use
1278         an ifdef in linux_attach to set up the target vector pointers.
1279         (linux_attach): If PPC_LINUX_TARGET, use PPC versions of register
1280         functions instead of generic ones.  Define process_set_reg, so
1281         that the "P" command is now handled.
1282
1283 2000-09-07  Michael Snyder  <msnyder@cleaver.cygnus.com>
1284
1285         * ptrace-target.c (ptrace_read_user, ptrace_write_user): New 
1286         functions.  Exported so that linux-target does not have to 
1287         call ptrace directly.  (ptrace_get_gregs, ptrace_set_gregs, 
1288         ptrace_get_fpregs, ptrace_set_fpregs): New functions.
1289         Exported for use by targets that use these methods.
1290         (ptrace_xfer_mem): Use ptrace_arg3_type instead of long.
1291         Add address to error messages.  
1292         * linux-target.c: Start using config macros, port to alpha and ppc.
1293         (ppc_linux_xfer_reg, ppc_linux_getset_reg, ppc_linux_get_reg,
1294         ppc_linux_set_reg, ppc_linux_get_regs, ppc_linux_set_regs):
1295         New functions.  Explicit knowledge of ppc linux register layout.
1296         (linux_get_reg): Catch undefined regmap offsets.
1297         (linux_set_reg): Ditto.
1298         (linux_get_regs): Conditionally call ppc_linux_get_regs.
1299         (linux_set_regs): Ditto.
1300         * configure.in: Add PPC target, and export target defines.
1301         * configure: Regenerate.
1302         * config.in: Add new target defines.
1303
1304 2000-09-06  Michael Snyder  <msnyder@cleaver.cygnus.com>
1305
1306         * Makefile.am: Define CC and CFLAGS.
1307         * Makefile.in: Regenerate.
1308         * configure.in: New file.  Detect all manner of things.
1309         * config.in: New file.  Input file for config.h.
1310         * configure: Generate.
1311         * ptrace-target.c (ptrace_xfer_type): Move def'n into server.h.
1312         (PTRACE_XFER_SIZE): Ditto.
1313         * linux-target.c (ptrace_xfer_type): Move def'n into server.h.
1314         (ptrace_arg3_type): Ditto.
1315         * server.h: Use config macros to determine definitions of 
1316         ptrace_xfer_type, ptrace_arg1_type, ptrace_arg2_type, 
1317         ptrace_arg3_type, ptrace_arg4_type.
1318
1319 2000-09-05  Michael Snyder  <msnyder@cleaver.cygnus.com>
1320
1321         * server.c (main): Detect exit status, and call fromtarget_exit
1322         instead of fromtarget_break.
1323         * linux-target.c (gdbserver_fromtarget_exit): New function.
1324         * ptrace-target.c (ptrace_kill_program, ptrace_sigkill_program):
1325         New functions.  Send signals to the child.
1326         (ptrace_exit_program): New function.
1327
1328 2000-09-05  Michael Snyder  <msnyder@cleaver.cygnus.com>
1329
1330         * linux-target.c (linux_attach): Activate process_signal vector.
1331         (gdbserver_check_child_state): Send real received signal, instead
1332         of faking SIGTRAP.
1333         * ptrace-target.c (ptrace_break_program): New function.  Implement
1334         control-c interrupt from host.
1335         (ptrace_process_signal): Implement continuation signal.
1336         (ptrace_singlestep_program): Ditto.
1337         (ptrace_continue_program): Ditto.
1338         (ptrace_get_trap_number): New function.  Return signal to libremote.
1339         (ptrace_compute_signal): Ditto.
1340         (ptrace_attach): Activate break_program, process_signal, compute_signal
1341         and get_trap_number vectors.
1342         server.h (struct nativeserver): add signal_to_send field.
1343         Rename stop_sig to stop_signal.
1344
1345 2000-09-05  Michael Snyder  <msnyder@cleaver.cygnus.com>
1346
1347         * ptrace-target.c (ptrace_singlestep_program): Make ptrace args long.
1348         FIXME: needs to be configurable.
1349         * linux-target.c (linux_get_reg, linux_set_reg): Make regaddr and
1350         regval configurable types.  FIXME needs real configury.
1351
1352 2000-09-01  Michael Snyder  <msnyder@cleaver.cygnus.com>
1353         New directory "native" for native gdbserver in libremote.
1354         * server.c: New file.  Entry point and main event loop.
1355         * server.h: New file.  Shared declarations.
1356         * linux-target.c: New file.  Linux version of libremote native stub.
1357         * ptrace-target.c: New file.  Ptrace operations for libremote stub.
1358         * Makefile.am: New file.  Automake source.
1359         * Makefile.in: New file.  Automake-generated makefile source.
1360         Note: this work is incomplete and only partially working.
1361         
1362