1 Patch pending upstream, probably acceptable.
2 --------------------------------------------
6 Daniel Jacobowitz <drow@mvista.com> writes:
7 > I like this. The way func_frame_chain_valid should really be used is
10 > /* NOTE: tm-i386nw.h and tm-i386v4.h override this. */
11 > set_gdbarch_frame_chain_valid (gdbarch, file_frame_chain_valid);
13 > (copied from i386-tdep.c).
15 > Does this patch work for you?
17 Yes, thanks. I've included a revised version of my patch below.
19 > I'm curious as to why we can't just set this universally, or at least a
20 > little more globally. Most things that have a main () use it as a
21 > normal main (). I'd propose that we set it as the default frame chain,
22 > and provide/document an option to ignore inside_main_func.
24 Well, gdbarch is never supposed to change the default behavior of
25 macros; this helps us convert pre-gdbarch targets incrementally.
26 Simply turning on gdbarch for one's target ideally wouldn't change its
30 [Patch revised for Debian snapshot]
31 --- snap/gdb/i386-linux-tdep.c.orig 2002-08-18 19:53:57.000000000 -0400
32 +++ snap/gdb/i386-linux-tdep.c 2002-08-18 19:54:31.000000000 -0400
35 set_solib_svr4_fetch_link_map_offsets (gdbarch,
36 i386_linux_svr4_fetch_link_map_offsets);
38 + set_gdbarch_frame_chain_valid (gdbarch,
39 + generic_func_frame_chain_valid);
42 /* Provide a prototype to silence -Wmissing-prototypes. */
43 [Hurd needs 6. Take 8, since it does no real harm.]
52 GDB will crash on the Hurd after issuing the 'show' and hitting enter
55 ../../gdb/ui-out.c:130: gdb-internal-error: push_level: Assertion +`uiout->level >= 0 && uiout->level < MAX_UI_OUT_LEVELS' failed.
57 the problem is that MAX_UI_OUT_LEVELS is not high enough for the extra
58 option we have on the Hurd, it should be rised to 6 then, which works
61 --- gdb-5.2.cvs20020401/gdb/ui-out.c~ Fri May 3 02:19:20 2002
62 +++ gdb-5.2.cvs20020401/gdb/ui-out.c Fri May 3 02:19:32 2002
64 is always available. Stack/nested level 0 is reserved for the
67 -enum { MAX_UI_OUT_LEVELS = 5 };
68 +enum { MAX_UI_OUT_LEVELS = 8 };
76 "5 years from now everyone will be running
77 free GNU on their 200 MIPS, 64M SPARCstation-5"
79 Andrew S. Tanenbaum, 30 Jan 1992
82 Submitted upstream, not liked very much. It's a hack, but it will do for
85 2002-07-31 Daniel Jacobowitz <drow@mvista.com>
88 * thread-db.c (lwp_from_thread): Only warn if unable to find
92 ===================================================================
93 RCS file: /cvs/src/src/gdb/thread-db.c,v
94 retrieving revision 1.22
95 diff -u -p -r1.22 thread-db.c
96 --- gdb/gdb/thread-db.c 23 Mar 2002 17:38:13 -0000 1.22
97 +++ gdb/gdb/thread-db.c 31 Jul 2002 16:29:52 -0000
98 @@ -260,6 +260,12 @@ lwp_from_thread (ptid_t ptid)
101 err = td_ta_map_id2thr_p (thread_agent, GET_THREAD (ptid), &th);
104 + warning ("Cannot find thread %ld: %s",
105 + (long) GET_THREAD (ptid), thread_db_err_str (err));
109 error ("Cannot find thread %ld: %s",
110 (long) GET_THREAD (ptid), thread_db_err_str (err));
111 From Michael Fedrowitz <michaelf@debian.org>. Not submitted to FSF yet.
115 gdb fails to build from source on m68k because some definitions have
116 been removed from tm-m68k.h. The patch below readds them.
121 diff -urN gdb-5.2.cvs20020818.orig/gdb/config/m68k/tm-m68k.h gdb-5.2.cvs20020818/gdb/config/m68k/tm-m68k.h
122 --- gdb-5.2.cvs20020818.orig/gdb/config/m68k/tm-m68k.h 2002-07-10 19:01:38.000000000 +0200
123 +++ gdb-5.2.cvs20020818/gdb/config/m68k/tm-m68k.h 2002-10-06 18:01:59.000000000 +0200
125 /* Generic 68000 stuff, to be included by other tm-*.h files. */
127 /* D0_REGNM and A0_REGNUM must be defined here because they are
128 - used by the monitor. */
129 + used by the monitor. FPC_REGNUM, FPS_REGNUM and FPI_REGNUM are
130 + defined here because they are used by m68klinux-nat.c. */
135 +#define FPC_REGNUM 26
136 +#define FPS_REGNUM 27
137 +#define FPI_REGNUM 28
140 2002-11-24 Daniel Jacobowitz <drow@mvista.com>
142 * doublest.c (convert_floatformat_to_doublest): Cast exp_bias to int.
143 * config/alpha/alpha-linux.mh (MH_CFLAGS): Add -mieee.
145 --- gdb-5.2.debian90.cvs20021120/gdb/doublest.c.orig 2002-11-24 17:48:16.000000000 -0500
146 +++ gdb-5.2.debian90.cvs20021120/gdb/doublest.c 2002-11-24 17:48:25.000000000 -0500
148 if (!special_exponent)
149 exponent -= fmt->exp_bias;
150 else if (exponent == 0)
151 - exponent = 1 - fmt->exp_bias;
152 + exponent = 1 - (int)fmt->exp_bias;
154 /* Build the result algebraically. Might go infinite, underflow, etc;
156 --- gdb-5.2.debian90.cvs20021120/gdb/config/alpha/alpha-linux.mh.orig 2002-11-24 17:50:30.000000000 -0500
157 +++ gdb-5.2.debian90.cvs20021120/gdb/config/alpha/alpha-linux.mh 2002-11-24 17:50:41.000000000 -0500
161 MMALLOC_CFLAGS = -DNO_MMALLOC
164 In CVS but not in 5.3 branch...
166 2002-10-23 Daniel Jacobowitz <drow@mvista.com>
168 * lin-lwp.c (lin_lwp_resume): Remove resume_all test for !step.
171 ===================================================================
172 RCS file: /cvs/src/src/gdb/lin-lwp.c,v
173 retrieving revision 1.35
174 diff -u -p -r1.35 lin-lwp.c
175 --- gdb-5.2.90/gdb/lin-lwp.c 27 Aug 2002 22:37:06 -0000 1.35
176 +++ gdb-5.2.90/gdb/lin-lwp.c 23 Oct 2002 04:23:13 -0000
177 @@ -579,11 +579,8 @@ lin_lwp_resume (ptid_t ptid, int step, e
181 - /* Apparently the interpretation of PID is dependent on STEP: If
182 - STEP is non-zero, a specific PID means `step only this process
183 - id'. But if STEP is zero, then PID means `continue *all*
184 - processes, but give the signal only to this one'. */
185 - resume_all = (PIDGET (ptid) == -1) || !step;
186 + /* A specific PTID means `step only this process id'. */
187 + resume_all = (PIDGET (ptid) == -1);
190 iterate_over_lwps (resume_set_callback, NULL);
192 Not submitted yet, testing.
194 --- gdb-5.2.90/gdb/alpha-tdep.c.orig Sun Nov 24 21:42:53 2002
195 +++ gdb-5.2.90/gdb/alpha-tdep.c Sun Nov 24 21:48:26 2002
198 static alpha_extra_func_info_t heuristic_proc_desc (CORE_ADDR,
200 - struct frame_info *);
201 + struct frame_info *,
204 static alpha_extra_func_info_t find_proc_desc (CORE_ADDR,
205 - struct frame_info *);
206 + struct frame_info *,
210 static int alpha_in_lenient_prologue (CORE_ADDR, CORE_ADDR);
215 - proc_desc = find_proc_desc (pc, frame->next);
216 + proc_desc = find_proc_desc (pc, frame->next, 1);
217 pcreg = proc_desc ? PROC_PC_REG (proc_desc) : ALPHA_RA_REGNUM;
219 if (frame->signal_handler_caller)
220 @@ -596,10 +598,10 @@
222 static alpha_extra_func_info_t
223 heuristic_proc_desc (CORE_ADDR start_pc, CORE_ADDR limit_pc,
224 - struct frame_info *next_frame)
225 + struct frame_info *next_frame, int read_sp_p)
227 - CORE_ADDR sp = read_next_frame_reg (next_frame, SP_REGNUM);
228 - CORE_ADDR vfp = sp;
233 int has_frame_reg = 0;
239 + vfp = sp = read_next_frame_reg (next_frame, SP_REGNUM);
245 memset (&temp_proc_desc, '\0', sizeof (temp_proc_desc));
247 CORE_ADDR func_addr, func_end;
250 - proc_desc = find_proc_desc (pc, NULL);
251 + proc_desc = find_proc_desc (pc, NULL, 0);
258 static alpha_extra_func_info_t
259 -find_proc_desc (CORE_ADDR pc, struct frame_info *next_frame)
260 +find_proc_desc (CORE_ADDR pc, struct frame_info *next_frame, int read_sp_p)
262 alpha_extra_func_info_t proc_desc;
266 alpha_extra_func_info_t found_heuristic =
267 heuristic_proc_desc (PROC_LOW_ADDR (proc_desc),
269 + pc, next_frame, read_sp_p);
272 PROC_LOCALOFF (found_heuristic) =
274 startaddr = heuristic_proc_start (pc);
277 - heuristic_proc_desc (startaddr, pc, next_frame);
278 + heuristic_proc_desc (startaddr, pc, next_frame, read_sp_p);
283 if (saved_pc == 0 || inside_entry_file (saved_pc))
286 - proc_desc = find_proc_desc (saved_pc, frame);
287 + proc_desc = find_proc_desc (saved_pc, frame, 1);
293 /* Use proc_desc calculated in frame_chain */
294 alpha_extra_func_info_t proc_desc =
295 - frame->next ? cached_proc_desc : find_proc_desc (frame->pc, frame->next);
296 + frame->next ? cached_proc_desc : find_proc_desc (frame->pc, frame->next, 1);
298 frame->extra_info = (struct frame_extra_info *)
299 frame_obstack_alloc (sizeof (struct frame_extra_info));
300 @@ -1291,7 +1298,7 @@
301 /* we need proc_desc to know how to restore the registers;
302 if it is NULL, construct (a temporary) one */
303 if (proc_desc == NULL)
304 - proc_desc = find_proc_desc (frame->pc, frame->next);
305 + proc_desc = find_proc_desc (frame->pc, frame->next, 1);
307 /* Question: should we copy this proc_desc and save it in
308 frame->proc_desc? If we do, who will free it?
309 Not yet submitted upstream. This requires some serious thinking about.
310 If the target stack worked in any logical way, this wouldn't be necessary...
311 ending up with roughly:
312 thread_stratum: thread-db (silent reference to lin-lwp)
313 core_stratum: corelow
318 This patch fixes debugging threaded applications which are statically linked
319 without breaking debugging threaded core files. It also fixes the PIDs in
320 generate-core-file'd corefiles. Mostly.
322 diff -x '*~' -ur o/gdb-5.2.debian90.cvs20021120/gdb/corelow.c gdb-5.2.debian90.cvs20021120/gdb/corelow.c
323 --- o/gdb-5.2.debian90.cvs20021120/gdb/corelow.c 2002-09-18 13:23:15.000000000 -0400
324 +++ gdb-5.2.debian90.cvs20021120/gdb/corelow.c 2002-12-03 14:03:32.000000000 -0500
326 bfd_map_over_sections (core_bfd, add_to_thread_list,
327 bfd_get_section_by_name (core_bfd, ".reg"));
332 /* Fetch all registers from core file. */
333 target_fetch_registers (-1);
334 diff -x '*~' -ur o/gdb-5.2.debian90.cvs20021120/gdb/linux-proc.c gdb-5.2.debian90.cvs20021120/gdb/linux-proc.c
335 --- o/gdb-5.2.debian90.cvs20021120/gdb/linux-proc.c 2002-12-03 14:13:52.000000000 -0500
336 +++ gdb-5.2.debian90.cvs20021120/gdb/linux-proc.c 2002-12-03 13:56:34.000000000 -0500
338 #ifdef FILL_FPXREGSET
339 gdb_fpxregset_t fpxregs;
341 - unsigned long merged_pid = ptid_get_tid (ptid) << 16 | ptid_get_pid (ptid);
342 + unsigned long merged_pid = ptid_get_tid (ptid) << 16; /* | ptid_get_pid (ptid); */
344 fill_gregset (&gregs, -1);
345 note_data = (char *) elfcore_write_prstatus (obfd,
346 diff -x '*~' -ur o/gdb-5.2.debian90.cvs20021120/gdb/target.c gdb-5.2.debian90.cvs20021120/gdb/target.c
347 --- o/gdb-5.2.debian90.cvs20021120/gdb/target.c 2002-09-18 13:23:22.000000000 -0400
348 +++ gdb-5.2.debian90.cvs20021120/gdb/target.c 2002-12-03 14:06:07.000000000 -0500
349 @@ -1589,6 +1589,7 @@
350 dummy_target.to_find_memory_regions = dummy_find_memory_regions;
351 dummy_target.to_make_corefile_notes = dummy_make_corefile_notes;
352 dummy_target.to_magic = OPS_MAGIC;
353 + cleanup_target (&dummy_target);
357 diff -x '*~' -ur o/gdb-5.2.debian90.cvs20021120/gdb/thread-db.c gdb-5.2.debian90.cvs20021120/gdb/thread-db.c
358 --- o/gdb-5.2.debian90.cvs20021120/gdb/thread-db.c 2002-12-03 14:13:50.000000000 -0500
359 +++ gdb-5.2.debian90.cvs20021120/gdb/thread-db.c 2002-12-03 13:39:54.000000000 -0500
361 /* Non-zero if we're using this module's target vector. */
362 static int using_thread_db;
364 +/* Macros to pass an event to the next target if we should not be handling it
365 + here in the thread_stratum. */
366 +#define FIND_NEXT_TARGET(METHOD_NAME) \
367 + struct target_ops *next_target = &thread_db_ops; \
370 + next_target = find_target_beneath (next_target); \
371 + if (next_target->METHOD_NAME != NULL) \
375 +#define MAYBE_HAND_DOWN(METHOD_NAME,ARGS) \
376 + if (proc_handle.pid == 0) \
378 + FIND_NEXT_TARGET (METHOD_NAME); \
379 + (*next_target->METHOD_NAME) ARGS; \
382 +#define MAYBE_HAND_DOWN_RETURN(METHOD_NAME,ARGS) \
383 + if (proc_handle.pid == 0) \
385 + FIND_NEXT_TARGET (METHOD_NAME); \
386 + return (*next_target->METHOD_NAME) ARGS; \
389 /* Non-zero if we have to keep this module's target vector active
391 static int keep_thread_db;
396 - /* Don't attempt to use thread_db on targets which can not run
398 - if (objfile == NULL || !target_has_execution)
399 + if (objfile == NULL)
401 /* All symbols have been discarded. If the thread_db target is
402 active, deactivate it now. */
404 /* Initialize the structure that identifies the child process. Note
405 that at this point there is no guarantee that we actually have a
407 - proc_handle.pid = GET_PID (inferior_ptid);
408 + if (target_has_execution)
409 + proc_handle.pid = GET_PID (inferior_ptid);
411 + proc_handle.pid = 0;
413 /* Now attempt to open a connection to the thread library. */
414 err = td_ta_new_p (&proc_handle, &thread_agent);
416 struct cleanup *old_chain = save_inferior_ptid ();
419 + MAYBE_HAND_DOWN_RETURN (to_xfer_memory, (memaddr, myaddr, len, write,
422 if (is_thread (inferior_ptid))
424 /* FIXME: This seems to be necessary to make sure breakpoints
426 gdb_prfpregset_t fpregset;
429 + MAYBE_HAND_DOWN (to_fetch_registers, (regno));
431 if (!is_thread (inferior_ptid))
433 /* Pass the request to the target beneath us. */
435 gdb_prfpregset_t fpregset;
438 + MAYBE_HAND_DOWN (to_store_registers, (regno));
440 if (!is_thread (inferior_ptid))
442 /* Pass the request to the target beneath us. */
447 + MAYBE_HAND_DOWN_RETURN (to_thread_alive, (ptid));
449 if (is_thread (ptid))
451 err = td_ta_map_id2thr_p (thread_agent, GET_THREAD (ptid), &th);
456 + MAYBE_HAND_DOWN (to_find_new_threads, ());
458 /* Iterate over all user-space threads to discover new threads. */
459 err = td_ta_thr_iter_p (thread_agent, find_new_threads_callback, NULL,
460 TD_THR_ANY_STATE, TD_THR_LOWEST_PRIORITY,
463 thread_db_pid_to_str (ptid_t ptid)
465 + MAYBE_HAND_DOWN_RETURN (to_pid_to_str, (ptid));
467 if (is_thread (ptid))
470 Trivial. Need to submit this.
472 --- gdb-5.2.debian90.cvs20021120/gdb/tracepoint.c.orig 2002-12-03 14:35:44.000000000 -0500
473 +++ gdb-5.2.debian90.cvs20021120/gdb/tracepoint.c 2002-12-03 14:43:02.000000000 -0500
476 line = gdb_readline (0);
478 + if (line == NULL || *line == EOF)
480 linetype = validate_actionline (&line, t);
481 if (linetype == BADLINE)
482 continue; /* already warned -- collect another line */
485 --- gdb-5.3/gdb/sparc-nat.c.orig 2003-01-04 00:11:28.000000000 -0500
486 +++ gdb-5.3/gdb/sparc-nat.c 2003-01-04 00:12:42.000000000 -0500
488 #include <sys/ptrace.h>
489 #include <sys/wait.h>
491 +/* Sadly, <sys/ucontext.h> conflicts with <asm/reg.h> on Linux. And
492 + -D_GNU_SOURCE brings in <sys/ucontext.h> implicitly with <signal.h>.
493 + Hack around this. */
494 +#undef FPU_REGS_TYPE
495 +#define fpu asm_reg_fpu
496 +#define fq asm_reg_fq
497 +#define fpq asm_reg_fpq
500 #include <machine/reg.h>
501 diff -urN gdb-5.3/gdb/gdbserver.orig/gdbreplay.c gdb-5.3/gdb/gdbserver/gdbreplay.c
502 --- gdb-5.3/gdb/gdbserver.orig/gdbreplay.c 2002-07-09 11:38:58.000000000 -0600
503 +++ gdb-5.3/gdb/gdbserver/gdbreplay.c 2003-08-20 08:44:20.000000000 -0600
505 perror_with_name (char *string)
508 - extern int sys_nerr;
509 extern char *sys_errlist[];
515 - err = (errno < sys_nerr) ? sys_errlist[errno] : "unknown error";
516 + err = strerror (errno);
518 + err = "unknown error";
519 combined = (char *) alloca (strlen (err) + strlen (string) + 3);
520 strcpy (combined, string);
521 strcat (combined, ": ");
522 diff -urN gdb-5.3/gdb/gdbserver.orig/low-hppabsd.c gdb-5.3/gdb/gdbserver/low-hppabsd.c
523 --- gdb-5.3/gdb/gdbserver.orig/low-hppabsd.c 2002-01-17 14:13:49.000000000 -0700
524 +++ gdb-5.3/gdb/gdbserver/low-hppabsd.c 2003-08-20 08:46:04.000000000 -0600
526 execv (program, allargs);
528 fprintf (stderr, "Cannot exec %s: %s.\n", program,
529 - errno < sys_nerr ? sys_errlist[errno] : "unknown error");
534 diff -urN gdb-5.3/gdb/gdbserver.orig/low-lynx.c gdb-5.3/gdb/gdbserver/low-lynx.c
535 --- gdb-5.3/gdb/gdbserver.orig/low-lynx.c 2002-01-17 14:13:49.000000000 -0700
536 +++ gdb-5.3/gdb/gdbserver/low-lynx.c 2003-08-20 08:46:18.000000000 -0600
539 fprintf (stderr, "GDBserver (process %d): Cannot exec %s: %s.\n",
541 - errno < sys_nerr ? sys_errlist[errno] : "unknown error");
546 diff -urN gdb-5.3/gdb/gdbserver.orig/low-nbsd.c gdb-5.3/gdb/gdbserver/low-nbsd.c
547 --- gdb-5.3/gdb/gdbserver.orig/low-nbsd.c 2002-01-17 14:13:49.000000000 -0700
548 +++ gdb-5.3/gdb/gdbserver/low-nbsd.c 2003-08-20 08:46:27.000000000 -0600
550 execv (program, allargs);
552 fprintf (stderr, "Cannot exec %s: %s.\n", program,
553 - errno < sys_nerr ? sys_errlist[errno] : "unknown error");
558 diff -urN gdb-5.3/gdb/gdbserver.orig/low-sparc.c gdb-5.3/gdb/gdbserver/low-sparc.c
559 --- gdb-5.3/gdb/gdbserver.orig/low-sparc.c 2002-01-17 14:13:50.000000000 -0700
560 +++ gdb-5.3/gdb/gdbserver/low-sparc.c 2003-08-20 08:46:38.000000000 -0600
562 #include <sys/ptrace.h>
565 -extern int sys_nerr;
566 extern char **sys_errlist;
570 execv (program, allargs);
572 fprintf (stderr, "Cannot exec %s: %s.\n", program,
573 - errno < sys_nerr ? sys_errlist[errno] : "unknown error");
578 diff -urN gdb-5.3/gdb/gdbserver.orig/low-sun3.c gdb-5.3/gdb/gdbserver/low-sun3.c
579 --- gdb-5.3/gdb/gdbserver.orig/low-sun3.c 2002-01-17 14:13:50.000000000 -0700
580 +++ gdb-5.3/gdb/gdbserver/low-sun3.c 2003-08-20 08:46:51.000000000 -0600
582 #include <sys/ptrace.h>
583 #include <machine/reg.h>
585 -extern int sys_nerr;
586 extern char **sys_errlist;
590 execv (program, allargs);
592 fprintf (stderr, "Cannot exec %s: %s.\n", program,
593 - errno < sys_nerr ? sys_errlist[errno] : "unknown error");
598 diff -urN gdb-5.3/gdb/gdbserver.orig/utils.c gdb-5.3/gdb/gdbserver/utils.c
599 --- gdb-5.3/gdb/gdbserver.orig/utils.c 2003-08-20 08:47:56.000000000 -0600
600 +++ gdb-5.3/gdb/gdbserver/utils.c 2003-08-20 08:48:15.000000000 -0600
602 perror_with_name (char *string)
605 - extern int sys_nerr;
606 - extern char *sys_errlist[];
612 - if (errno < sys_nerr)
613 - err = sys_errlist[errno];
615 + err = strerror (errno);
617 err = "unknown error";
619 combined = (char *) alloca (strlen (err) + strlen (string) + 3);
620 diff -urN gdb-5.3/gdb/gdbserver.orig/linux-low.c.orig gdb-5.3/gdb/gdbserver/linux-low.c.orig
621 --- gdb-5.3/gdb/gdbserver.orig/linux-low.c 2003-08-20 08:40:27.000000000 -0600
622 +++ gdb-5.3/gdb/gdbserver/linux-low.c 2003-08-20 08:44:54.000000000 -0600
624 if (ptrace (PTRACE_ATTACH, pid, 0, 0) != 0)
626 fprintf (stderr, "Cannot attach to process %d: %s (%d)\n", pid,
627 - errno < sys_nerr ? sys_errlist[errno] : "unknown error",
629 + strerror (errno), errno);
632 /* If we fail to attach to an LWP, just return. */