From 43873a6422c8c866a855af11ab7e69942eac0197 Mon Sep 17 00:00:00 2001 From: cagney Date: Dec 02 2004 18:30:25 +0000 Subject: Merge in most PPC fixes. --- diff --git a/gdb-6.3-framepczero-20040927.patch b/gdb-6.3-framepczero-20040927.patch new file mode 100644 index 0000000..2f1869b --- /dev/null +++ b/gdb-6.3-framepczero-20040927.patch @@ -0,0 +1,31 @@ +2004-09-27 Andrew Cagney + + * frame.c (get_prev_frame): Stop backtrace when a zero PC and + successive normal frames. + +Index: ./gdb/frame.c +=================================================================== +RCS file: /cvs/src/src/gdb/frame.c,v +retrieving revision 1.191 +diff -p -u -r1.191 frame.c +--- ./gdb/frame.c 1 Sep 2004 14:13:33 -0000 1.191 ++++ ./gdb/frame.c 28 Sep 2004 02:45:58 -0000 +@@ -1235,6 +1235,18 @@ get_prev_frame (struct frame_info *this_ + return NULL; + } + ++ if (this_frame->level > 0 ++#if 0 ++ && backtrace_past_zero_pc ++#endif ++ && get_frame_type (this_frame) == NORMAL_FRAME ++ && get_frame_type (get_next_frame (this_frame)) == NORMAL_FRAME ++ && get_frame_pc (this_frame) == 0) ++ { ++ frame_debug_got_null_frame (gdb_stdlog, this_frame, "zero PC"); ++ return NULL; ++ } ++ + return get_prev_frame_1 (this_frame); + } + diff --git a/gdb-6.3-ppc64displaysymbol-20041124.patch b/gdb-6.3-ppc64displaysymbol-20041124.patch new file mode 100644 index 0000000..7af2e73 --- /dev/null +++ b/gdb-6.3-ppc64displaysymbol-20041124.patch @@ -0,0 +1,28 @@ +2004-11-24 Andrew Cagney + + * printcmd.c (build_address_symbolic): Find a section for the + address. + +--- ./gdb/printcmd.c.1 2004-11-24 17:54:27.316295608 -0500 ++++ ./gdb/printcmd.c 2004-11-24 17:59:20.069790312 -0500 +@@ -615,6 +615,20 @@ + addr = overlay_mapped_address (addr, section); + } + } ++ /* To ensure that the symbol returned belongs to the correct setion ++ (and that the last [random] symbol from the previous section ++ isn't returned) try to find the section containing PC. First try ++ the overlay code (which by default returns NULL); and second try ++ the normal section code (which almost always succeeds). */ ++ section = find_pc_overlay (addr); ++ if (section == NULL) ++ { ++ struct obj_section *obj_section = find_pc_section (addr); ++ if (obj_section == NULL) ++ section = NULL; ++ else ++ section = obj_section->the_bfd_section; ++ } + + /* First try to find the address in the symbol table, then + in the minsyms. Take the closest one. */ diff --git a/gdb-6.3-ppc64section-20041026.patch b/gdb-6.3-ppc64section-20041026.patch new file mode 100644 index 0000000..155bde4 --- /dev/null +++ b/gdb-6.3-ppc64section-20041026.patch @@ -0,0 +1,99 @@ +2004-10-26 Andrew Cagney + + * blockframe.c (find_pc_function): Use find_pc_section to find the + pc's section. + * block.c, symfile.c: Ditto. + +*** ./gdb/blockframe.c.1 2004-10-26 21:21:46.517866240 -0400 +--- ./gdb/blockframe.c 2004-10-26 21:24:16.345089040 -0400 +*************** +*** 288,294 **** + struct symbol * + find_pc_function (CORE_ADDR pc) + { +! return find_pc_sect_function (pc, find_pc_mapped_section (pc)); + } + + /* These variables are used to cache the most recent result +--- 288,311 ---- + struct symbol * + find_pc_function (CORE_ADDR pc) + { +! struct bfd_section *section; +! struct symbol *symbol; +! /* To ensure that the symbol returned belongs to the correct setion +! (and that the last [random] symbol from the previous section +! isn't returned) try to find the section containing PC. First try +! the overlay code (which by default returns NULL); and second try +! the normal section code (which almost always succeeds). */ +! section = find_pc_overlay (pc); +! if (section == NULL) +! { +! struct obj_section *obj_section = find_pc_section (pc); +! if (obj_section == NULL) +! section = NULL; +! else +! section = obj_section->the_bfd_section; +! } +! symbol = find_pc_sect_function (pc, section); +! return symbol; + } + + /* These variables are used to cache the most recent result +--- ./gdb/symtab.c.1 2004-10-26 22:47:13.650423616 -0400 ++++ ./gdb/symtab.c 2004-10-26 22:50:10.239577984 -0400 +@@ -2176,7 +2176,20 @@ + { + asection *section; + ++ /* To ensure that the symbol returned belongs to the correct setion ++ (and that the last [random] symbol from the previous section ++ isn't returned) try to find the section containing PC. First try ++ the overlay code (which by default returns NULL); and second try ++ the normal section code (which almost always succeeds). */ + section = find_pc_overlay (pc); ++ if (section == NULL) ++ { ++ struct obj_section *obj_section = find_pc_section (pc); ++ if (obj_section == NULL) ++ section = NULL; ++ else ++ section = obj_section->the_bfd_section; ++ } + if (pc_in_unmapped_range (pc, section)) + pc = overlay_mapped_address (pc, section); + return find_pc_sect_line (pc, section, notcurrent); +--- ./gdb/block.c.1 2004-10-27 00:22:56.881319808 -0400 ++++ ./gdb/block.c 2004-10-27 00:24:17.364084568 -0400 +@@ -25,6 +25,7 @@ + #include "symfile.h" + #include "gdb_obstack.h" + #include "cp-support.h" ++#include "objfiles.h" + + /* This is used by struct block to store namespace-related info for + C++ files, namely using declarations and the current namespace in +@@ -153,7 +154,22 @@ + struct block * + block_for_pc (CORE_ADDR pc) + { +- return block_for_pc_sect (pc, find_pc_mapped_section (pc)); ++ struct bfd_section *section; ++ /* To ensure that the symbol returned belongs to the correct setion ++ (and that the last [random] symbol from the previous section ++ isn't returned) try to find the section containing PC. First try ++ the overlay code (which by default returns NULL); and second try ++ the normal section code (which almost always succeeds). */ ++ section = find_pc_overlay (pc); ++ if (section == NULL) ++ { ++ struct obj_section *obj_section = find_pc_section (pc); ++ if (obj_section == NULL) ++ section = NULL; ++ else ++ section = obj_section->the_bfd_section; ++ } ++ return block_for_pc_sect (pc, section); + } + + /* Now come some functions designed to deal with C++ namespace issues. diff --git a/gdb-6.3-ppc64syscall-20040622.patch b/gdb-6.3-ppc64syscall-20040622.patch new file mode 100644 index 0000000..61d02ff --- /dev/null +++ b/gdb-6.3-ppc64syscall-20040622.patch @@ -0,0 +1,112 @@ +2004-06-22 Andrew Cagney + + * rs6000-tdep.c (struct rs6000_framedata): Add field "func_start". + (skip_prologue): Delete local variable "orig_pc", use + "func_start". Add local variable "num_skip_linux_syscall_insn", + use to skip over first half of a GNU/Linux syscall and update + "func_start". + +Index: ./gdb/rs6000-tdep.c +=================================================================== +RCS file: /cvs/src/src/gdb/rs6000-tdep.c,v +retrieving revision 1.215 +diff -p -u -r1.215 rs6000-tdep.c +--- ./gdb/rs6000-tdep.c 20 Jun 2004 17:18:06 -0000 1.215 ++++ ./gdb/rs6000-tdep.c 22 Jun 2004 19:06:46 -0000 +@@ -71,6 +71,7 @@ + + struct rs6000_framedata + { ++ CORE_ADDR func_start; /* True function start. */ + int offset; /* total size of frame --- the distance + by which we decrement sp to allocate + the frame */ +@@ -694,7 +695,6 @@ store_param_on_stack_p (unsigned long op + static CORE_ADDR + skip_prologue (CORE_ADDR pc, CORE_ADDR lim_pc, struct rs6000_framedata *fdata) + { +- CORE_ADDR orig_pc = pc; + CORE_ADDR last_prologue_pc = pc; + CORE_ADDR li_found_pc = 0; + char buf[4]; +@@ -712,6 +712,7 @@ skip_prologue (CORE_ADDR pc, CORE_ADDR l + int minimal_toc_loaded = 0; + int prev_insn_was_prologue_insn = 1; + int num_skip_non_prologue_insns = 0; ++ int num_skip_ppc64_gnu_linux_syscall_insn = 0; + int r0_contains_arg = 0; + const struct bfd_arch_info *arch_info = gdbarch_bfd_arch_info (current_gdbarch); + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); +@@ -732,6 +733,7 @@ skip_prologue (CORE_ADDR pc, CORE_ADDR l + lim_pc = refine_prologue_limit (pc, lim_pc); + + memset (fdata, 0, sizeof (struct rs6000_framedata)); ++ fdata->func_start = pc; + fdata->saved_gpr = -1; + fdata->saved_fpr = -1; + fdata->saved_vr = -1; +@@ -760,6 +762,55 @@ skip_prologue (CORE_ADDR pc, CORE_ADDR l + break; + op = extract_signed_integer (buf, 4); + ++ /* A PPC64 GNU/Linux system call function is split into two ++ sub-functions: a non-threaded fast-path (__NAME_nocancel) ++ which does not use a frame; and a threaded slow-path ++ (Lpseudo_cancel) that does create a frame. Ref: ++ nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h ++ ++ *INDENT-OFF* ++ NAME: ++ SINGLE_THREAD_P ++ bne- .Lpseudo_cancel ++ __NAME_nocancel: ++ li r0,162 ++ sc ++ bnslr+ ++ b 0x7fe014ef64 <.__syscall_error> ++ Lpseudo_cancel: ++ stdu r1,-128(r1) ++ ... ++ *INDENT-ON* ++ ++ Unfortunatly, because the latter case uses a local label (not ++ in the symbol table) a PC in "Lpseudo_cancel" appears to be ++ in "__NAME_nocancel". The following code recognizes this, ++ adjusting FUNC_START to point to where "Lpseudo_cancel" ++ should be, and parsing the prologue sequence as if ++ "Lpseudo_cancel" was the entry point. */ ++ ++ if (((op & 0xffff0000) == 0x38000000 /* li r0,N */ ++ && pc == fdata->func_start + 0 ++ && num_skip_ppc64_gnu_linux_syscall_insn == 0) ++ || (op == 0x44000002 /* sc */ ++ && pc == fdata->func_start + 4 ++ && num_skip_ppc64_gnu_linux_syscall_insn == 1) ++ || (op == 0x4ca30020 /* bnslr+ */ ++ && pc == fdata->func_start + 8 ++ && num_skip_ppc64_gnu_linux_syscall_insn == 2)) ++ { ++ num_skip_ppc64_gnu_linux_syscall_insn++; ++ continue; ++ } ++ else if ((op & 0xfc000003) == 0x48000000 /* b __syscall_error */ ++ && pc == fdata->func_start + 12 ++ && num_skip_ppc64_gnu_linux_syscall_insn == 3) ++ { ++ num_skip_ppc64_gnu_linux_syscall_insn = -1; ++ fdata->func_start = pc; ++ continue; ++ } ++ + if ((op & 0xfc1fffff) == 0x7c0802a6) + { /* mflr Rx */ + /* Since shared library / PIC code, which needs to get its +@@ -913,7 +964,7 @@ skip_prologue (CORE_ADDR pc, CORE_ADDR l + fdata->frameless = 0; + /* Don't skip over the subroutine call if it is not within + the first three instructions of the prologue. */ +- if ((pc - orig_pc) > 8) ++ if ((pc - fdata->func_start) > 8) + break; + + op = read_memory_integer (pc + 4, 4); diff --git a/gdb.spec b/gdb.spec index 463b43d..83ef9bc 100644 --- a/gdb.spec +++ b/gdb.spec @@ -56,12 +56,7 @@ Patch4: gdb-6.3-rh-testlibunwind1fix-20041202.patch ####### ABI fixes and updates #Broken: Patch19: gdb-6.1post-abi-ppccfi-nov2004.patch -#Broken: Patch20: gdb-6.1post-abi-ppc64-oct2004.patch -Patch21: gdb-6.1post-abi-ppc64syscall-jun2004.patch #Broken: Patch23: gdb-6.1post-abi-ppc64main-aug2004.patch -Patch24: gdb-6.1post-frame-zeropc-sep2004.patch -Patch26: gdb-6.1post-abi-ppc64fpscr-oct2004.patch -Patch28: gdb-6.1post-abi-ppc64section-oct2004.patch ###### Testsuite merge, fixes, and local RH hack # Get selftest working with sep-debug-info @@ -97,12 +92,8 @@ Patch79: gdb-6.1post-constructor-nov2004.patch # Add --readnever hack, and gstack script #Broken: Patch82: gdb-6.1post-readnever-nov2004.patch Patch83: gdb-6.1post-gstack-nov2004.patch -# Add PPC register groups. -Patch84: gdb-6.1post-abi-ppcreggroups-nov2004.patch # No longer a need to set .malloc on ppc64. #Broken: Patch85: gdb-6.1post-abi-ppcmalloc-nov2004.patch -# display and x needed to look for a section symbol. -Patch86: gdb-6.1post-abi-ppc64displaysymbol-nov2004.patch # Continue removing breakpoints even when failure occurs. Patch87: gdb-6.1post-remove-bp-nov2004.patch @@ -110,8 +101,16 @@ Patch87: gdb-6.1post-remove-bp-nov2004.patch Patch100: gdb-6.3-dwoppiecewarning-20041202.patch Patch101: gdb-6.3-sigx86-20040621.patch Patch102: gdb-6.3-sigsymtramp-20040621.patch -Patch103: gdb-6.3-sigppc-20040621.patch +Patch103: gdb-6.3-ppcsignals-20040621.patch Patch104: gdb-6.3-ppcdotsolib-20041022.patch +Patch105: gdb-6.3-ppc64syscall-20040622.patch +Patch106: gdb-6.3-framepczero-20040927.patch +Patch107: gdb-6.3-ppc64fpscrhack-20041026.patch +Patch108: gdb-6.3-ppc64section-20041026.patch +Patch109: gdb-6.3-ppcreggroups-20041124.patch +Patch110: gdb-6.3-ppc64abi-20040621.patch +Patch111: gdb-6.3-ppc64displaysymbol-20041124.patch + %ifarch ia64 BuildRequires: ncurses-devel glibc-devel gcc make gzip texinfo dejagnu libunwind >= 0.96-3 @@ -150,12 +149,13 @@ and printing their data. %patch102 -p1 %patch103 -p1 %patch104 -p1 - -%patch21 -p1 -%patch24 -p1 -%patch25 -p1 -%patch26 -p1 -%patch28 -p1 +%patch105 -p1 +%patch106 -p1 +%patch107 -p1 +%patch108 -p1 +%patch109 -p1 +%patch110 -p1 +%patch111 -p1 %patch50 -p1 @@ -163,8 +163,6 @@ and printing their data. %patch78 -p1 %patch79 -p1 %patch83 -p1 -%patch84 -p1 -%patch86 -p1 %patch87 -p1 # Change the version that gets printed at GDB startup, so it is RedHat