diff --git a/args-newline.diff b/args-newline.diff deleted file mode 100644 index 3baafe7..0000000 --- a/args-newline.diff +++ /dev/null @@ -1,59 +0,0 @@ -2008-09-12 Andreas Schwab - - * infcmd.c (construct_inferior_arguments): Handle newlines - specially. - -testsuite/: - * gdb.base/args.exp: Add tests for newlines. - ---- gdb/infcmd.c.~1.211.~ 2008-09-12 11:12:15.000000000 +0200 -+++ gdb/infcmd.c 2008-09-12 16:25:48.000000000 +0200 -@@ -271,7 +271,7 @@ construct_inferior_arguments (struct gdb - - /* We over-compute the size. It shouldn't matter. */ - for (i = 0; i < argc; ++i) -- length += 2 * strlen (argv[i]) + 1 + 2 * (argv[i][0] == '\0'); -+ length += 3 * strlen (argv[i]) + 1 + 2 * (argv[i][0] == '\0'); - - result = (char *) xmalloc (length); - out = result; -@@ -291,9 +291,21 @@ construct_inferior_arguments (struct gdb - { - for (cp = argv[i]; *cp; ++cp) - { -- if (strchr (special, *cp) != NULL) -- *out++ = '\\'; -- *out++ = *cp; -+ if (*cp == '\n') -+ { -+ /* A newline cannot be quoted with a backslash (it -+ just disappears), only by putting it inside -+ quotes. */ -+ *out++ = '\''; -+ *out++ = '\n'; -+ *out++ = '\''; -+ } -+ else -+ { -+ if (strchr (special, *cp) != NULL) -+ *out++ = '\\'; -+ *out++ = *cp; -+ } - } - } - } ---- gdb/testsuite/gdb.base/args.exp.~1.15.~ 2008-08-09 15:44:54.000000000 +0200 -+++ gdb/testsuite/gdb.base/args.exp 2008-09-12 16:11:20.000000000 +0200 -@@ -96,4 +96,12 @@ args_test "one empty (with single quotes - set GDBFLAGS "-nx --args $binfile 1 '' '' 3" - args_test "two empty (with single quotes)" {{1} {''} {''} {3}} - -+# try with arguments containing literal newlines. -+ -+set GDBFLAGS "-nx --args $binfile 1 {\n} 3" -+args_test "one newline" {{1} {\\n} {3}} -+ -+set GDBFLAGS "-nx --args $binfile 1 {\n} {\n} 3" -+args_test "two newlines" {{1} {\\n} {\\n} {3}} -+ - set GDBFLAGS $old_gdbflags diff --git a/auxv.diff b/auxv.diff new file mode 100644 index 0000000..a6eb618 --- /dev/null +++ b/auxv.diff @@ -0,0 +1,32 @@ +Index: gdb/auxv.c +=================================================================== +RCS file: /cvs/src/src/gdb/auxv.c,v +retrieving revision 1.15 +diff -u -a -p -r1.15 auxv.c +--- gdb/auxv.c 28 Oct 2008 17:19:56 -0000 1.15 ++++ gdb/auxv.c 3 Nov 2008 20:11:26 -0000 +@@ -206,6 +206,8 @@ fprint_target_auxv (struct ui_file *file + TAG (AT_SYSINFO, _("Special system info/entry points"), hex); + TAG (AT_SYSINFO_EHDR, _("System-supplied DSO's ELF header"), hex); + TAG (AT_SECURE, _("Boolean, was exec setuid-like?"), dec); ++ TAG (AT_BASE_PLATFORM, _("String identifying base platform"), str); ++ TAG (AT_EXECFN, _("File name given to execve"), str); + TAG (AT_SUN_UID, _("Effective user ID"), dec); + TAG (AT_SUN_RUID, _("Real user ID"), dec); + TAG (AT_SUN_GID, _("Effective group ID"), dec); +Index: include/elf/common.h +=================================================================== +RCS file: /cvs/src/src/include/elf/common.h,v +retrieving revision 1.99 +diff -u -a -p -r1.99 common.h +--- include/elf/common.h 3 Aug 2008 23:20:42 -0000 1.99 ++++ include/elf/common.h 3 Nov 2008 20:11:26 -0000 +@@ -798,6 +798,8 @@ + #define AT_UCACHEBSIZE 21 /* Unified cache block size. */ + #define AT_IGNOREPPC 22 /* Entry should be ignored */ + #define AT_SECURE 23 /* Boolean, was exec setuid-like? */ ++#define AT_BASE_PLATFORM 24 /* String identifying base platform. */ ++#define AT_EXECFN 31 /* File name given to execve. */ + /* Pointer to the global system page used for system calls and other + nice things. */ + #define AT_SYSINFO 32 diff --git a/cell-combined.diff b/cell-combined.diff index a0331bd..20ed1e5 100644 --- a/cell-combined.diff +++ b/cell-combined.diff @@ -386,715 +386,984 @@ doc/ChangeLog: Index: gdb-head/gdb/linux-nat.c -=================================================================== ---- gdb-head.orig/gdb/linux-nat.c -+++ gdb-head/gdb/linux-nat.c -@@ -49,6 +49,12 @@ - #include "inf-loop.h" - #include "event-loop.h" - #include "event-top.h" -+#include /* for struct statfs */ -+#include /* for DIR etc. */ -+ -+#ifndef SPUFS_MAGIC -+#define SPUFS_MAGIC 0x23c9b64e -+#endif - - #ifdef HAVE_PERSONALITY - # include -@@ -3364,8 +3370,8 @@ linux_nat_do_thread_registers (bfd *obfd - gdb_gregset_t gregs; - gdb_fpregset_t fpregs; - unsigned long lwp = ptid_get_lwp (ptid); -- struct regcache *regcache = get_thread_regcache (ptid); -- struct gdbarch *gdbarch = get_regcache_arch (regcache); -+ struct gdbarch *gdbarch = target_gdbarch; -+ struct regcache *regcache = get_thread_arch_regcache (ptid, gdbarch); - const struct regset *regset; - int core_regset_p; - struct cleanup *old_chain; -@@ -3475,6 +3481,119 @@ linux_nat_corefile_thread_callback (stru - return 0; +================================================================================ +--- gdb-6.8.50.20081103-cvs/gdb/Makefile.in ++++ gdb-6.8.50.20081103-cvs/gdb/Makefile.in +@@ -499,7 +499,7 @@ ALL_TARGET_OBS = \ + sh64-tdep.o sh-linux-tdep.o shnbsd-tdep.o sh-tdep.o \ + sparc-linux-tdep.o sparcnbsd-tdep.o sparcobsd-tdep.o \ + sparc-sol2-tdep.o sparc-tdep.o \ +- spu-tdep.o \ ++ spu-tdep.o spu-multiarch.o solib-spu.o \ + v850-tdep.o \ + vaxnbsd-tdep.o vaxobsd-tdep.o vax-tdep.o \ + xstormy16-tdep.o \ +@@ -1337,7 +1337,7 @@ ALLDEPFILES = \ + sparc64-tdep.c sparc64fbsd-nat.c sparc64fbsd-tdep.c \ + sparc64nbsd-nat.c sparc64nbsd-tdep.c sparc64obsd-tdep.c \ + sparcnbsd-nat.c sparcnbsd-tdep.c sparcobsd-tdep.c \ +- spu-linux-nat.c spu-tdep.c \ ++ spu-linux-nat.c spu-tdep.c spu-multiarch.c solib-spu.c \ + v850-tdep.c \ + vax-nat.c vax-tdep.c vaxbsd-nat.c vaxnbsd-tdep.c \ + win32-nat.c \ +--- gdb-6.8.50.20081103-cvs/gdb/arch-utils.c ++++ gdb-6.8.50.20081103-cvs/gdb/arch-utils.c +@@ -326,15 +326,24 @@ set_endian (char *ignore_args, int from_ } -+/* Enumerate spufs IDs for process PID. */ + /* Given SELECTED, a currently selected BFD architecture, and +- FROM_TARGET, a BFD architecture reported by the target description, +- return what architecture to use. Either may be NULL; if both are +- specified, we use the more specific. If the two are obviously +- incompatible, warn the user. */ ++ TARGET_DESC, the current target description, return what ++ architecture to use. ++ ++ SELECTED may be NULL, in which case we return the architecture ++ associated with TARGET_DESC. If SELECTED specifies a variant ++ of the architecture associtated with TARGET_DESC, return the ++ more specific of the two. ++ ++ If SELECTED is a different architecture, but it is accepted as ++ compatible by the target, we can use the target architecture. ++ ++ If SELECTED is obviously incompatible, warn the user. */ + + static const struct bfd_arch_info * +-choose_architecture_for_target (const struct bfd_arch_info *selected, +- const struct bfd_arch_info *from_target) ++choose_architecture_for_target (const struct target_desc *target_desc, ++ const struct bfd_arch_info *selected) + { ++ const struct bfd_arch_info *from_target = tdesc_architecture (target_desc); + const struct bfd_arch_info *compat1, *compat2; + + if (selected == NULL) +@@ -364,6 +373,11 @@ choose_architecture_for_target (const st + + if (compat1 == NULL && compat2 == NULL) + { ++ /* BFD considers the architectures incompatible. Check our target ++ description whether it accepts SELECTED as compatible anyway. */ ++ if (tdesc_compatible_p (target_desc, selected)) ++ return from_target; ++ + warning (_("Selected architecture %s is not compatible " + "with reported target architecture %s"), + selected->printable_name, from_target->printable_name); +@@ -692,7 +706,7 @@ gdbarch_info_fill (struct gdbarch_info * + /* From the target. */ + if (info->target_desc != NULL) + info->bfd_arch_info = choose_architecture_for_target +- (info->bfd_arch_info, tdesc_architecture (info->target_desc)); ++ (info->target_desc, info->bfd_arch_info); + /* From the default. */ + if (info->bfd_arch_info == NULL) + info->bfd_arch_info = default_bfd_arch; +@@ -720,6 +734,27 @@ gdbarch_info_fill (struct gdbarch_info * + gdb_assert (info->bfd_arch_info != NULL); + } + ++ ++/* restore_current_gdbarch() will be used by the cleanup machinery ++ to restore the current_gdbarch value saved in a call to ++ save_current_gdbarch(). */ + +static void -+iterate_over_spus (int pid, void (*callback) (void *, int), void *data) ++restore_current_gdbarch (void *arg) +{ -+ char path[128]; -+ DIR *dir; -+ struct dirent *entry; -+ -+ xsnprintf (path, sizeof path, "/proc/%d/fd", pid); -+ dir = opendir (path); -+ if (!dir) -+ return; -+ -+ rewinddir (dir); -+ while ((entry = readdir (dir)) != NULL) -+ { -+ struct stat st; -+ struct statfs stfs; -+ int fd; -+ -+ fd = atoi (entry->d_name); -+ if (!fd) -+ continue; -+ -+ xsnprintf (path, sizeof path, "/proc/%d/fd/%d", pid, fd); -+ if (stat (path, &st) != 0) -+ continue; -+ if (!S_ISDIR (st.st_mode)) -+ continue; -+ -+ if (statfs (path, &stfs) != 0) -+ continue; -+ if (stfs.f_type != SPUFS_MAGIC) -+ continue; -+ -+ callback (data, fd); -+ } -+ -+ closedir (dir); ++ current_gdbarch = arg; +} + -+/* Generate corefile notes for SPU contexts. */ ++/* Save the value of current so that it may be restored by a ++ later call to do_cleanups(). Returns the struct cleanup pointer ++ needed for later doing the cleanup. */ + -+struct linux_spu_corefile_data ++struct cleanup * ++save_current_gdbarch (void) +{ -+ bfd *obfd; -+ char *note_data; -+ int *note_size; -+}; -+ -+static void -+linux_spu_corefile_callback (void *data, int fd) -+{ -+ struct linux_spu_corefile_data *args = data; -+ int i; -+ -+ static const char *spu_files[] = -+ { -+ "object-id", -+ "mem", -+ "regs", -+ "fpcr", -+ "lslr", -+ "decr", -+ "decr_status", -+ "signal1", -+ "signal1_type", -+ "signal2", -+ "signal2_type", -+ "event_mask", -+ "event_status", -+ "mbox_info", -+ "ibox_info", -+ "wbox_info", -+ "dma_info", -+ "proxydma_info", -+ }; -+ -+ for (i = 0; i < sizeof (spu_files) / sizeof (spu_files[0]); i++) -+ { -+ char annex[32], note_name[32]; -+ gdb_byte *spu_data; -+ LONGEST spu_len; -+ -+ xsnprintf (annex, sizeof annex, "%d/%s", fd, spu_files[i]); -+ spu_len = target_read_alloc (¤t_target, TARGET_OBJECT_SPU, -+ annex, &spu_data); -+ if (spu_len > 0) -+ { -+ xsnprintf (note_name, sizeof note_name, "SPU/%s", annex); -+ args->note_data = elfcore_write_note (args->obfd, args->note_data, -+ args->note_size, note_name, -+ NT_SPU, spu_data, spu_len); -+ xfree (spu_data); -+ } -+ } ++ return make_cleanup (restore_current_gdbarch, current_gdbarch); +} + -+static char * -+linux_spu_make_corefile_notes (bfd *obfd, char *note_data, int *note_size) -+{ -+ struct linux_spu_corefile_data args; -+ args.obfd = obfd; -+ args.note_data = note_data; -+ args.note_size = note_size; -+ -+ iterate_over_spus (PIDGET (inferior_ptid), -+ linux_spu_corefile_callback, &args); -+ -+ return args.note_data; -+} -+ - /* Fills the "to_make_corefile_note" target vector. Builds the note - section for a corefile, and returns it in a malloc buffer. */ + /* */ -@@ -3535,6 +3654,8 @@ linux_nat_make_corefile_notes (bfd *obfd - xfree (auxv); - } + extern initialize_file_ftype _initialize_gdbarch_utils; /* -Wmissing-prototypes */ +--- gdb-6.8.50.20081103-cvs/gdb/arch-utils.h ++++ gdb-6.8.50.20081103-cvs/gdb/arch-utils.h +@@ -139,4 +139,9 @@ extern void gdbarch_info_fill (struct gd -+ note_data = linux_spu_make_corefile_notes (obfd, note_data, note_size); -+ - make_cleanup (xfree, note_data); - return note_data; - } -@@ -3861,6 +3982,99 @@ linux_proc_xfer_partial (struct target_o - return ret; - } + extern struct gdbarch *gdbarch_from_bfd (bfd *abfd); ++/* Save value of current_gdbarch so that it may be restored by ++ a later call to do_cleanups(). Returns the struct cleanup ++ pointer needed for later doing the cleanup. */ ++struct cleanup *save_current_gdbarch (void); + -+/* Enumerate spufs IDs for process PID. */ -+static LONGEST -+spu_enumerate_spu_ids (int pid, gdb_byte *buf, ULONGEST offset, LONGEST len) -+{ -+ LONGEST pos = 0; -+ LONGEST written = 0; -+ char path[128]; -+ DIR *dir; -+ struct dirent *entry; -+ -+ xsnprintf (path, sizeof path, "/proc/%d/fd", pid); -+ dir = opendir (path); -+ if (!dir) -+ return -1; -+ -+ rewinddir (dir); -+ while ((entry = readdir (dir)) != NULL) -+ { -+ struct stat st; -+ struct statfs stfs; -+ int fd; -+ -+ fd = atoi (entry->d_name); -+ if (!fd) -+ continue; -+ -+ xsnprintf (path, sizeof path, "/proc/%d/fd/%d", pid, fd); -+ if (stat (path, &st) != 0) -+ continue; -+ if (!S_ISDIR (st.st_mode)) -+ continue; -+ -+ if (statfs (path, &stfs) != 0) -+ continue; -+ if (stfs.f_type != SPUFS_MAGIC) -+ continue; -+ -+ if (pos >= offset && pos + 4 <= offset + len) -+ { -+ store_unsigned_integer (buf + pos - offset, 4, fd); -+ written += 4; -+ } -+ pos += 4; -+ } -+ -+ closedir (dir); -+ return written; -+} -+ -+/* Implement the to_xfer_partial interface for the TARGET_OBJECT_SPU -+ object type, using the /proc file system. */ -+static LONGEST -+linux_proc_xfer_spu (struct target_ops *ops, enum target_object object, -+ const char *annex, gdb_byte *readbuf, -+ const gdb_byte *writebuf, -+ ULONGEST offset, LONGEST len) -+{ -+ char buf[128]; -+ int fd = 0; -+ int ret = -1; -+ int pid = PIDGET (inferior_ptid); -+ -+ if (!annex) -+ { -+ if (!readbuf) -+ return -1; -+ else -+ return spu_enumerate_spu_ids (pid, readbuf, offset, len); -+ } -+ -+ xsnprintf (buf, sizeof buf, "/proc/%d/fd/%s", pid, annex); -+ fd = open (buf, writebuf? O_WRONLY : O_RDONLY); -+ if (fd <= 0) -+ return -1; -+ -+ if (offset != 0 -+ && lseek (fd, (off_t) offset, SEEK_SET) != (off_t) offset) -+ { -+ close (fd); -+ return 0; -+ } -+ -+ if (writebuf) -+ ret = write (fd, writebuf, (size_t) len); -+ else if (readbuf) -+ ret = read (fd, readbuf, (size_t) len); -+ -+ close (fd); -+ return ret; -+} -+ -+ - /* Parse LINE as a signal set and add its set bits to SIGS. */ + #endif +--- gdb-6.8.50.20081103-cvs/gdb/avr-tdep.c ++++ gdb-6.8.50.20081103-cvs/gdb/avr-tdep.c +@@ -278,7 +278,8 @@ avr_convert_saddr_to_raw (CORE_ADDR x) + /* Convert from address to pointer and vice-versa. */ static void -@@ -3953,6 +4167,10 @@ linux_xfer_partial (struct target_ops *o - return procfs_xfer_auxv (ops, object, annex, readbuf, writebuf, - offset, len); - -+ if (object == TARGET_OBJECT_SPU) -+ return linux_proc_xfer_spu (ops, object, annex, readbuf, writebuf, -+ offset, len); -+ - xfer = linux_proc_xfer_partial (ops, object, annex, readbuf, writebuf, - offset, len); - if (xfer != 0) -Index: gdb-head/gdb/proc-service.c -=================================================================== ---- gdb-head.orig/gdb/proc-service.c -+++ gdb-head/gdb/proc-service.c -@@ -257,7 +257,7 @@ ps_lgetregs (gdb_ps_prochandle_t ph, lwp - struct regcache *regcache; - - inferior_ptid = BUILD_LWP (lwpid, ph->pid); -- regcache = get_thread_regcache (inferior_ptid); -+ regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch); - - target_fetch_registers (regcache, -1); - fill_gregset (regcache, (gdb_gregset_t *) gregset, -1); -@@ -276,7 +276,7 @@ ps_lsetregs (gdb_ps_prochandle_t ph, lwp - struct regcache *regcache; - - inferior_ptid = BUILD_LWP (lwpid, ph->pid); -- regcache = get_thread_regcache (inferior_ptid); -+ regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch); - - supply_gregset (regcache, (const gdb_gregset_t *) gregset); - target_store_registers (regcache, -1); -@@ -296,7 +296,7 @@ ps_lgetfpregs (gdb_ps_prochandle_t ph, l - struct regcache *regcache; - - inferior_ptid = BUILD_LWP (lwpid, ph->pid); -- regcache = get_thread_regcache (inferior_ptid); -+ regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch); - - target_fetch_registers (regcache, -1); - fill_fpregset (regcache, (gdb_fpregset_t *) fpregset, -1); -@@ -316,7 +316,7 @@ ps_lsetfpregs (gdb_ps_prochandle_t ph, l - struct regcache *regcache; - - inferior_ptid = BUILD_LWP (lwpid, ph->pid); -- regcache = get_thread_regcache (inferior_ptid); -+ regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch); - - supply_fpregset (regcache, (const gdb_fpregset_t *) fpregset); - target_store_registers (regcache, -1); -Index: gdb-head/gdb/regcache.c -=================================================================== ---- gdb-head.orig/gdb/regcache.c -+++ gdb-head/gdb/regcache.c -@@ -29,6 +29,7 @@ - #include "gdb_string.h" - #include "gdbcmd.h" /* For maintenanceprintlist. */ - #include "observer.h" -+#include "arch-utils.h" - - /* - * DATA STRUCTURE -@@ -410,36 +411,60 @@ regcache_invalidate (struct regcache *re - - - /* Global structure containing the current regcache. */ --/* FIXME: cagney/2002-05-11: The two global arrays registers[] and -- deprecated_register_valid[] currently point into this structure. */ --static struct regcache *current_regcache; - - /* NOTE: this is a write-through cache. There is no "dirty" bit for - recording if the register values have been changed (eg. by the - user). Therefore all registers must be written back to the - target when appropriate. */ - --struct regcache *get_thread_regcache (ptid_t ptid) -+struct regcache_list +-avr_address_to_pointer (struct type *type, gdb_byte *buf, CORE_ADDR addr) ++avr_address_to_pointer (struct gdbarch *gdbarch, ++ struct type *type, gdb_byte *buf, CORE_ADDR addr) { -- /* NOTE: uweigand/2007-05-05: We need to detect the thread's -- current architecture at this point. */ -- struct gdbarch *thread_gdbarch = current_gdbarch; -+ struct regcache *regcache; -+ struct regcache_list *next; -+}; -+ -+static struct regcache_list *current_regcache; -+ -+struct regcache * -+get_thread_arch_regcache (ptid_t ptid, struct gdbarch *gdbarch) -+{ -+ struct regcache_list *list; -+ struct regcache *new_regcache; - -- if (current_regcache && ptid_equal (current_regcache->ptid, ptid) -- && get_regcache_arch (current_regcache) == thread_gdbarch) -- return current_regcache; -+ for (list = current_regcache; list; list = list->next) -+ if (ptid_equal (list->regcache->ptid, ptid) -+ && get_regcache_arch (list->regcache) == gdbarch) -+ return list->regcache; - -- if (current_regcache) -- regcache_xfree (current_regcache); -+ new_regcache = regcache_xmalloc (gdbarch); -+ new_regcache->readonly_p = 0; -+ new_regcache->ptid = ptid; - -- current_regcache = regcache_xmalloc (thread_gdbarch); -- current_regcache->readonly_p = 0; -- current_regcache->ptid = ptid; -+ list = xmalloc (sizeof (struct regcache_list)); -+ list->regcache = new_regcache; -+ list->next = current_regcache; -+ current_regcache = list; - -- return current_regcache; -+ return new_regcache; + /* Is it a code address? */ + if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC +@@ -296,7 +297,8 @@ avr_address_to_pointer (struct type *typ } --struct regcache *get_current_regcache (void) -+static ptid_t current_thread_ptid; -+static struct gdbarch *current_thread_arch; -+ -+struct regcache * -+get_thread_regcache (ptid_t ptid) -+{ -+ if (!current_thread_arch || !ptid_equal (current_thread_ptid, ptid)) -+ { -+ current_thread_ptid = ptid; -+ current_thread_arch = target_thread_architecture (ptid); -+ } -+ -+ return get_thread_arch_regcache (ptid, current_thread_arch); -+} -+ -+struct regcache * -+get_current_regcache (void) + static CORE_ADDR +-avr_pointer_to_address (struct type *type, const gdb_byte *buf) ++avr_pointer_to_address (struct gdbarch *gdbarch, ++ struct type *type, const gdb_byte *buf) { - return get_thread_regcache (inferior_ptid); - } -@@ -458,9 +483,11 @@ regcache_observer_target_changed (struct - static void - regcache_thread_ptid_changed (ptid_t old_ptid, ptid_t new_ptid) - { -- if (current_regcache != NULL -- && ptid_equal (current_regcache->ptid, old_ptid)) -- current_regcache->ptid = new_ptid; -+ struct regcache_list *list; -+ -+ for (list = current_regcache; list; list = list->next) -+ if (ptid_equal (list->regcache->ptid, old_ptid)) -+ list->regcache->ptid = new_ptid; - } + CORE_ADDR addr = extract_unsigned_integer (buf, TYPE_LENGTH (type)); - /* Low level examining and depositing of registers. -@@ -477,11 +504,20 @@ regcache_thread_ptid_changed (ptid_t old - void - registers_changed (void) - { -- int i; -+ struct regcache_list *list, *next; -+ -+ for (list = current_regcache; list; list = next) -+ { -+ next = list->next; -+ regcache_xfree (list->regcache); -+ xfree (list); -+ } - -- regcache_xfree (current_regcache); - current_regcache = NULL; - -+ current_thread_ptid = null_ptid; -+ current_thread_arch = NULL; -+ - /* Need to forget about any frames we have cached, too. */ - reinit_frame_cache (); - -@@ -509,6 +545,8 @@ regcache_raw_read (struct regcache *regc - { - struct cleanup *old_chain = save_inferior_ptid (); - inferior_ptid = regcache->ptid; -+ save_current_gdbarch (); -+ current_gdbarch = get_regcache_arch (regcache); - target_fetch_registers (regcache, regnum); - do_cleanups (old_chain); +--- gdb-6.8.50.20081103-cvs/gdb/breakpoint.c ++++ gdb-6.8.50.20081103-cvs/gdb/breakpoint.c +@@ -1142,7 +1142,7 @@ Note: automatically using hardware break + bpt->overlay_target_info = bpt->target_info; + bpt->overlay_target_info.placed_address = addr; + val = target_insert_breakpoint (&bpt->overlay_target_info); +- if (val != 0) ++ if (val > 0) + fprintf_unfiltered (tmp_error_stream, + "Overlay breakpoint %d failed: in ROM?", + bpt->owner->number); +@@ -1165,6 +1165,14 @@ Note: automatically using hardware break + } } -@@ -667,6 +705,8 @@ regcache_raw_write (struct regcache *reg - old_chain = save_inferior_ptid (); - inferior_ptid = regcache->ptid; -+ save_current_gdbarch (); -+ current_gdbarch = get_regcache_arch (regcache); - - target_prepare_to_store (regcache); - memcpy (register_buffer (regcache, regnum), buf, -Index: gdb-head/gdb/regcache.h -=================================================================== ---- gdb-head.orig/gdb/regcache.h -+++ gdb-head/gdb/regcache.h -@@ -26,6 +26,7 @@ struct gdbarch; - - extern struct regcache *get_current_regcache (void); - extern struct regcache *get_thread_regcache (ptid_t ptid); -+extern struct regcache *get_thread_arch_regcache (ptid_t, struct gdbarch *); - - void regcache_xfree (struct regcache *regcache); - struct cleanup *make_cleanup_regcache_xfree (struct regcache *regcache); -Index: gdb-head/gdb/remote.c -=================================================================== ---- gdb-head.orig/gdb/remote.c -+++ gdb-head/gdb/remote.c -@@ -3575,6 +3575,7 @@ Packet: '%s'\n"), - else - { - struct packet_reg *reg = packet_reg_from_pnum (rsa, pnum); -+ struct regcache *regcache; - p = p1; - - if (*p != ':') -@@ -3595,8 +3596,10 @@ Packet: '%s'\n"), - if (fieldsize < register_size (target_gdbarch, - reg->regnum)) - warning (_("Remote reply is too short: %s"), buf); -- regcache_raw_supply (get_current_regcache (), -- reg->regnum, regs); ++ if (val < 0) ++ { ++ /* The target could not insert the breakpoint right away due ++ to a temporary issue. No error, but do not mark the bp ++ as 'inserted'. */ ++ return 0; ++ } + -+ regcache = get_thread_arch_regcache -+ (inferior_ptid, target_gdbarch); -+ regcache_raw_supply (regcache, reg->regnum, regs); - } - - if (*p != ';') -@@ -5392,7 +5395,7 @@ remote_insert_breakpoint (struct bp_targ - switch (packet_ok (rs->buf, &remote_protocol_packets[PACKET_Z0])) + if (val) { - case PACKET_ERROR: -- return -1; -+ return 1; - case PACKET_OK: - bp_tgt->placed_address = addr; - bp_tgt->placed_size = bpsize; -@@ -5579,7 +5582,7 @@ remote_insert_hw_breakpoint (struct bp_t - (target_gdbarch, &bp_tgt->placed_address, &bp_tgt->placed_size); + /* Can't set the breakpoint. */ +@@ -1641,6 +1649,14 @@ remove_breakpoint (struct bp_location *b + } + } - if (remote_protocol_packets[PACKET_Z1].support == PACKET_DISABLE) -- return -1; -+ return 1; - - rs = get_remote_state (); - p = rs->buf; -@@ -5599,7 +5602,7 @@ remote_insert_hw_breakpoint (struct bp_t - { - case PACKET_ERROR: - case PACKET_UNKNOWN: -- return -1; -+ return 1; - case PACKET_OK: - return 0; - } -@@ -5616,7 +5619,7 @@ remote_remove_hw_breakpoint (struct bp_t - char *p = rs->buf; - - if (remote_protocol_packets[PACKET_Z1].support == PACKET_DISABLE) -- return -1; -+ return 1; - - *(p++) = 'z'; - *(p++) = '1'; -@@ -5633,7 +5636,7 @@ remote_remove_hw_breakpoint (struct bp_t - { - case PACKET_ERROR: - case PACKET_UNKNOWN: -- return -1; -+ return 1; - case PACKET_OK: - return 0; - } -Index: gdb-head/gdb/sol-thread.c -=================================================================== ---- gdb-head.orig/gdb/sol-thread.c -+++ gdb-head/gdb/sol-thread.c -@@ -1093,7 +1093,7 @@ ps_lgetregs (gdb_ps_prochandle_t ph, lwp - old_chain = save_inferior_ptid (); - - inferior_ptid = BUILD_LWP (lwpid, PIDGET (inferior_ptid)); -- regcache = get_thread_regcache (inferior_ptid); -+ regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch); - - if (target_has_execution) - procfs_ops.to_fetch_registers (regcache, -1); -@@ -1118,7 +1118,7 @@ ps_lsetregs (gdb_ps_prochandle_t ph, lwp - old_chain = save_inferior_ptid (); - - inferior_ptid = BUILD_LWP (lwpid, PIDGET (inferior_ptid)); -- regcache = get_thread_regcache (inferior_ptid); -+ regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch); - - supply_gregset (regcache, (const gdb_gregset_t *) gregset); - if (target_has_execution) -@@ -1229,7 +1229,7 @@ ps_lgetfpregs (gdb_ps_prochandle_t ph, l - old_chain = save_inferior_ptid (); - - inferior_ptid = BUILD_LWP (lwpid, PIDGET (inferior_ptid)); -- regcache = get_thread_regcache (inferior_ptid); -+ regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch); - - if (target_has_execution) - procfs_ops.to_fetch_registers (regcache, -1); -@@ -1254,7 +1254,7 @@ ps_lsetfpregs (gdb_ps_prochandle_t ph, l - old_chain = save_inferior_ptid (); - - inferior_ptid = BUILD_LWP (lwpid, PIDGET (inferior_ptid)); -- regcache = get_thread_regcache (inferior_ptid); -+ regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch); - - supply_fpregset (regcache, (const gdb_fpregset_t *) fpregset); - if (target_has_execution) -Index: gdb-head/gdb/target.c -=================================================================== ---- gdb-head.orig/gdb/target.c -+++ gdb-head/gdb/target.c -@@ -91,6 +91,9 @@ static LONGEST target_xfer_partial (stru - void *readbuf, const void *writebuf, - ULONGEST offset, LONGEST len); - -+static struct gdbarch *default_thread_architecture (struct target_ops *ops, -+ ptid_t ptid); ++ if (val < 0) ++ { ++ /* The target could not remove the breakpoint right away due ++ to a temporary issue. No error, but keep the bp marked ++ as 'inserted'. */ ++ return 0; ++ } + - static void init_dummy_target (void); - - static struct target_ops debug_target; -@@ -460,6 +463,7 @@ update_current_target (void) - INHERIT (to_find_memory_regions, t); - INHERIT (to_make_corefile_notes, t); - INHERIT (to_get_thread_local_address, t); -+ INHERIT (to_thread_architecture, t); - /* Do not inherit to_read_description. */ - /* Do not inherit to_search_memory. */ - INHERIT (to_magic, t); -@@ -625,6 +629,8 @@ update_current_target (void) - de_fault (to_async_mask, - (int (*) (int)) - return_one); -+ de_fault (to_thread_architecture, -+ default_thread_architecture); - current_target.to_read_description = NULL; - #undef de_fault - -@@ -2025,7 +2031,8 @@ target_require_runnable (void) - /* Do not worry about thread_stratum targets that can not - create inferiors. Assume they will be pushed again if - necessary, and continue to the process_stratum. */ -- if (t->to_stratum == thread_stratum) -+ if (t->to_stratum == thread_stratum -+ || t->to_stratum == arch_stratum) - continue; - - error (_("\ -@@ -2164,6 +2171,12 @@ default_watchpoint_addr_within_range (st - return addr >= start && addr < start + length; + /* In some cases, we might not be able to remove a breakpoint + in a shared library that has already been removed, but we + have not yet processed the shlib unload event. */ +@@ -7807,6 +7823,37 @@ breakpoint_re_set (void) + + create_overlay_event_breakpoint ("_ovly_debug_event"); } - -+static struct gdbarch * -+default_thread_architecture (struct target_ops *ops, ptid_t ptid) ++ ++/* Update breakpoint location list after an object file was relocated. */ ++void ++breakpoint_relocate (struct objfile *objfile, struct section_offsets *delta) +{ -+ return target_gdbarch; -+} ++ struct bp_location *b; ++ struct obj_section *s; + - static int - return_zero (void) - { -@@ -3036,6 +3049,19 @@ debug_to_find_new_threads (void) - fputs_unfiltered ("target_find_new_threads ()\n", gdb_stdlog); - } ++ /* Update the breakpoint addresses so that breakpoint_re_set has a chance ++ to identify the previous locations (to carry over enabled state). */ ++ ALL_BP_LOCATIONS (b) ++ { ++ if (b->inserted || b->loc_type == bp_loc_other) ++ continue; ++ ++ ALL_OBJFILE_OSECTIONS (objfile, s) ++ { ++ CORE_ADDR offset = ANOFFSET (delta, s->the_bfd_section->index); ++ ++ if (b->address >= obj_section_addr (s) - offset ++ && b->address < obj_section_endaddr (s) - offset) ++ { ++ b->address += offset; ++ break; ++ } ++ } ++ } ++ ++ /* Now reset all breakpoints. */ ++ breakpoint_re_set (); ++} + + /* Reset the thread number of this breakpoint: -+static struct gdbarch * -+debug_to_thread_architecture (struct target_ops *ops, ptid_t ptid) -+{ -+ struct gdbarch *retval; +--- gdb-6.8.50.20081103-cvs/gdb/breakpoint.h ++++ gdb-6.8.50.20081103-cvs/gdb/breakpoint.h +@@ -698,6 +698,8 @@ extern int breakpoint_thread_match (CORE + + extern void until_break_command (char *, int, int); + ++extern void breakpoint_relocate (struct objfile *, struct section_offsets *); + -+ retval = debug_target.to_thread_architecture (ops, ptid); -+ -+ fprintf_unfiltered (gdb_stdlog, "target_thread_architecture (%s) = %p [%s]\n", -+ target_pid_to_str (ptid), retval, -+ gdbarch_bfd_arch_info (retval)->printable_name); -+ return retval; -+} -+ - static void - debug_to_stop (ptid_t ptid) - { -@@ -3121,6 +3147,7 @@ setup_target_debug (void) - current_target.to_stop = debug_to_stop; - current_target.to_rcmd = debug_to_rcmd; - current_target.to_pid_to_exec_file = debug_to_pid_to_exec_file; -+ current_target.to_thread_architecture = debug_to_thread_architecture; + extern void breakpoint_re_set (void); + + extern void breakpoint_re_set_thread (struct breakpoint *); +--- gdb-6.8.50.20081103-cvs/gdb/cli/cli-dump.c ++++ gdb-6.8.50.20081103-cvs/gdb/cli/cli-dump.c +@@ -428,7 +428,7 @@ add_dump_command (char *name, void (*fun + + /* Opaque data for restore_section_callback. */ + struct callback_data { +- long load_offset; ++ CORE_ADDR load_offset; + CORE_ADDR load_start; + CORE_ADDR load_end; + }; +@@ -533,8 +533,8 @@ restore_binary_file (char *filename, str + printf_filtered + ("Restoring binary file %s into memory (0x%lx to 0x%lx)\n", + filename, +- (unsigned long) data->load_start + data->load_offset, +- (unsigned long) data->load_start + data->load_offset + len); ++ (unsigned long) (data->load_start + data->load_offset), ++ (unsigned long) (data->load_start + data->load_offset + len)); + + /* Now set the file pos to the requested load start pos. */ + if (fseek (file, data->load_start, SEEK_SET) != 0) +@@ -584,7 +584,7 @@ restore_command (char *args, int from_tt + /* Parse offset (optional). */ + if (args != NULL && *args != '\0') + data.load_offset = +- parse_and_eval_long (scan_expression_with_cleanup (&args, NULL)); ++ parse_and_eval_address (scan_expression_with_cleanup (&args, NULL)); + if (args != NULL && *args != '\0') + { + /* Parse start address (optional). */ +--- gdb-6.8.50.20081103-cvs/gdb/configure.tgt ++++ gdb-6.8.50.20081103-cvs/gdb/configure.tgt +@@ -349,7 +349,8 @@ powerpc-*-aix* | rs6000-*-*) + powerpc-*-linux* | powerpc64-*-linux*) + # Target: PowerPC running Linux + gdb_target_obs="rs6000-tdep.o ppc-linux-tdep.o ppc-sysv-tdep.o \ +- solib.o solib-svr4.o corelow.o symfile-mem.o" ++ solib.o solib-svr4.o solib-spu.o spu-multiarch.o \ ++ corelow.o symfile-mem.o" + gdb_sim=../sim/ppc/libsim.a + build_gdbserver=yes + ;; +--- gdb-6.8.50.20081103-cvs/gdb/corelow.c ++++ gdb-6.8.50.20081103-cvs/gdb/corelow.c +@@ -542,6 +542,33 @@ core_files_info (struct target_ops *t) + print_section_info (t, core_bfd); } - -Index: gdb-head/gdb/target.h -=================================================================== ---- gdb-head.orig/gdb/target.h -+++ gdb-head/gdb/target.h -@@ -62,7 +62,8 @@ enum strata - file_stratum, /* Executable files, etc */ - core_stratum, /* Core dump files */ - process_stratum, /* Executing processes */ -- thread_stratum /* Executing threads */ -+ thread_stratum, /* Executing threads */ -+ arch_stratum /* Architecture overrides */ - }; - - enum thread_control_capabilities -@@ -523,6 +524,9 @@ struct target_ops - const gdb_byte *pattern, ULONGEST pattern_len, - CORE_ADDR *found_addrp); - -+ /* Determine current architecture of thread PTID. */ -+ struct gdbarch *(*to_thread_architecture) (struct target_ops *, ptid_t); ++struct spuid_list ++{ ++ gdb_byte *buf; ++ ULONGEST offset; ++ LONGEST len; ++ ULONGEST pos; ++ ULONGEST written; ++}; + - int to_magic; - /* Need sub-structure for target machine related rather than comm related? - */ -@@ -1025,6 +1029,11 @@ extern char *normal_pid_to_str (ptid_t p - #define target_pid_to_exec_file(pid) \ - (current_target.to_pid_to_exec_file) (pid) - -+/* Determine current architecture of thread PTID. */ ++static void ++add_to_spuid_list (bfd *abfd, asection *asect, void *list_p) ++{ ++ struct spuid_list *list = list_p; ++ int fd, pos = 0; + -+#define target_thread_architecture(ptid) \ -+ (current_target.to_thread_architecture (¤t_target, ptid)) ++ sscanf (bfd_section_name (abfd, asect), "SPU/%d/regs%n", &fd, &pos); ++ if (pos == 0) ++ return; + - /* - * Iterator function for target memory regions. - * Calls a callback function once for each memory region 'mapped' -Index: gdb-head/gdb/thread.c -=================================================================== ---- gdb-head.orig/gdb/thread.c -+++ gdb-head/gdb/thread.c -@@ -725,6 +725,7 @@ switch_to_thread (ptid_t ptid) - inferior_ptid = ptid; - reinit_frame_cache (); - registers_changed (); -+ current_gdbarch = get_regcache_arch (get_current_regcache ()); ++ if (list->pos >= list->offset && list->pos + 4 <= list->offset + list->len) ++ { ++ store_unsigned_integer (list->buf + list->pos - list->offset, 4, fd); ++ list->written += 4; ++ } ++ list->pos += 4; ++} ++ + static LONGEST + core_xfer_partial (struct target_ops *ops, enum target_object object, + const char *annex, gdb_byte *readbuf, +@@ -634,6 +661,53 @@ core_xfer_partial (struct target_ops *op + } + /* FALL THROUGH */ - /* We don't check for is_stopped, because we're called at times - while in the TARGET_RUNNING state, e.g., while handling an -Index: gdb-head/gdb/frame.c -=================================================================== ---- gdb-head.orig/gdb/frame.c -+++ gdb-head/gdb/frame.c ++ case TARGET_OBJECT_SPU: ++ if (readbuf && annex) ++ { ++ /* When the SPU contexts are stored in core file, BFD ++ represents this with a fake section called "SPU/". */ ++ ++ struct bfd_section *section; ++ bfd_size_type size; ++ char *contents; ++ ++ char sectionstr[100]; ++ xsnprintf (sectionstr, sizeof sectionstr, "SPU/%s", annex); ++ ++ section = bfd_get_section_by_name (core_bfd, sectionstr); ++ if (section == NULL) ++ return -1; ++ ++ size = bfd_section_size (core_bfd, section); ++ if (offset >= size) ++ return 0; ++ size -= offset; ++ if (size > len) ++ size = len; ++ if (size > 0 ++ && !bfd_get_section_contents (core_bfd, section, readbuf, ++ (file_ptr) offset, size)) ++ { ++ warning (_("Couldn't read SPU section in core file.")); ++ return -1; ++ } ++ ++ return size; ++ } ++ else if (readbuf) ++ { ++ /* NULL annex requests list of all present spuids. */ ++ struct spuid_list list; ++ list.buf = readbuf; ++ list.offset = offset; ++ list.len = len; ++ list.pos = 0; ++ list.written = 0; ++ bfd_map_over_sections (core_bfd, add_to_spuid_list, &list); ++ return list.written; ++ } ++ return -1; ++ + default: + if (ops->beneath != NULL) + return ops->beneath->to_xfer_partial (ops->beneath, object, annex, +@@ -673,8 +747,8 @@ core_file_thread_alive (ptid_t tid) + static const struct target_desc * + core_read_description (struct target_ops *target) + { +- if (gdbarch_core_read_description_p (current_gdbarch)) +- return gdbarch_core_read_description (current_gdbarch, target, core_bfd); ++ if (core_gdbarch && gdbarch_core_read_description_p (core_gdbarch)) ++ return gdbarch_core_read_description (core_gdbarch, target, core_bfd); + + return NULL; + } +--- gdb-6.8.50.20081103-cvs/gdb/doc/gdb.texinfo ++++ gdb-6.8.50.20081103-cvs/gdb/doc/gdb.texinfo +@@ -16787,6 +16787,33 @@ and local store addresses and transfer s + + @end table + ++When @value{GDBN} is debugging a combined PowerPC/SPU application ++on the Cell Broadband Engine, it provides in addition the following ++special commands: ++ ++@table @code ++@item set spu stop-on-load @var{arg} ++@kindex set spu ++Set whether to stop for new SPE threads. When set to @code{on}, @value{GDBN} ++will give control to the user when a new SPE thread enters its @code{main} ++function. The default is @code{off}. ++ ++@item show spu stop-on-load ++@kindex show spu ++Show whether to stop for new SPE threads. ++ ++@item set spu auto-flush-cache @var{arg} ++Set whether to automatically flush the software-managed cache. When set to ++@code{on}, @value{GDBN} will automatically cause the SPE software-managed ++cache to be flushed whenever SPE execution stops. This provides a consistent ++view of PowerPC memory that is accessed via the cache. If an application ++does not use the software-managed cache, this option has no effect. ++ ++@item show spu auto-flush-cache ++Show whether to automatically flush the software-managed cache. ++ ++@end table ++ + @node PowerPC + @subsection PowerPC + @cindex PowerPC architecture +@@ -28377,6 +28404,7 @@ are explained further below. + + + @r{[}@var{architecture}@r{]} ++ @r{[}@var{compatible}@dots{}@r{]} + @r{[}@var{feature}@dots{}@r{]} + + @end smallexample +@@ -28428,9 +28456,33 @@ An @samp{} element has thi + @var{arch} + @end smallexample + +-@var{arch} is an architecture name from the same selection +-accepted by @code{set architecture} (@pxref{Targets, ,Specifying a +-Debugging Target}). ++@var{arch} is one of the architectures from the set accepted by ++@code{set architecture} (@pxref{Targets, ,Specifying a Debugging Target}). ++ ++@subsection Compatible Architecture ++@cindex ++ ++A @samp{} element has this form: ++ ++@smallexample ++ @var{arch} ++@end smallexample ++ ++@var{arch} is one of the architectures from the set accepted by ++@code{set architecture} (@pxref{Targets, ,Specifying a Debugging Target}). ++ ++A @samp{} element is used to specify that the target ++is able to run binaries in some other than the main target architecture ++given by the @samp{} element. For example, on the ++Cell Broadband Engine, the main architecture is @code{powerpc:common} ++or @code{powerpc:common64}, but the system is able to run binaries ++in the @code{spu} architecture as well. The way to describe this ++capability with @samp{} is as follows: ++ ++@smallexample ++ @code{powerpc:common} ++ @code{spu} ++@end smallexample + + @subsection Features + @cindex +--- gdb-6.8.50.20081103-cvs/gdb/features/Makefile ++++ gdb-6.8.50.20081103-cvs/gdb/features/Makefile +@@ -34,7 +34,7 @@ + WHICH = arm-with-iwmmxt mips-linux mips64-linux \ + rs6000/powerpc-32l rs6000/powerpc-altivec32l rs6000/powerpc-e500l \ + rs6000/powerpc-64l rs6000/powerpc-altivec64l rs6000/powerpc-vsx32l \ +- rs6000/powerpc-vsx64l ++ rs6000/powerpc-vsx64l rs6000/powerpc-cell32l rs6000/powerpc-cell64l + + # Record which registers should be sent to GDB by default after stop. + arm-with-iwmmxt-expedite = r11,sp,pc +@@ -42,10 +42,12 @@ mips-linux-expedite = r29,pc + mips64-linux-expedite = r29,pc + rs6000/powerpc-32l-expedite = r1,pc + rs6000/powerpc-altivec32l-expedite = r1,pc ++rs6000/powerpc-cell32l-expedite = r1,pc,r0,orig_r3,r4 + rs6000/powerpc-vsx32l-expedite = r1,pc + rs6000/powerpc-e500l-expedite = r1,pc + rs6000/powerpc-64l-expedite = r1,pc + rs6000/powerpc-altivec64l-expedite = r1,pc ++rs6000/powerpc-cell64l-expedite = r1,pc,r0,orig_r3,r4 + rs6000/powerpc-vsx64l-expedite = r1,pc + + +--- gdb-6.8.50.20081103-cvs/gdb/features/rs6000/powerpc-cell32l.c ++++ gdb-6.8.50.20081103-cvs/gdb/features/rs6000/powerpc-cell32l.c +@@ -0,0 +1,170 @@ ++/* THIS FILE IS GENERATED. Original: powerpc-cell32l.xml */ ++ ++#include "defs.h" ++#include "gdbtypes.h" ++#include "target-descriptions.h" ++ ++struct target_desc *tdesc_powerpc_cell32l; ++static void ++initialize_tdesc_powerpc_cell32l (void) ++{ ++ struct target_desc *result = allocate_target_description (); ++ struct tdesc_feature *feature; ++ struct type *field_type, *type; ++ ++ set_tdesc_architecture (result, bfd_scan_arch ("powerpc:common")); ++ ++ tdesc_add_compatible (result, bfd_scan_arch ("spu:256K")); ++ ++ feature = tdesc_create_feature (result, "org.gnu.gdb.power.core"); ++ tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "uint32"); ++ tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "uint32"); ++ tdesc_create_reg (feature, "r2", 2, 1, NULL, 32, "uint32"); ++ tdesc_create_reg (feature, "r3", 3, 1, NULL, 32, "uint32"); ++ tdesc_create_reg (feature, "r4", 4, 1, NULL, 32, "uint32"); ++ tdesc_create_reg (feature, "r5", 5, 1, NULL, 32, "uint32"); ++ tdesc_create_reg (feature, "r6", 6, 1, NULL, 32, "uint32"); ++ tdesc_create_reg (feature, "r7", 7, 1, NULL, 32, "uint32"); ++ tdesc_create_reg (feature, "r8", 8, 1, NULL, 32, "uint32"); ++ tdesc_create_reg (feature, "r9", 9, 1, NULL, 32, "uint32"); ++ tdesc_create_reg (feature, "r10", 10, 1, NULL, 32, "uint32"); ++ tdesc_create_reg (feature, "r11", 11, 1, NULL, 32, "uint32"); ++ tdesc_create_reg (feature, "r12", 12, 1, NULL, 32, "uint32"); ++ tdesc_create_reg (feature, "r13", 13, 1, NULL, 32, "uint32"); ++ tdesc_create_reg (feature, "r14", 14, 1, NULL, 32, "uint32"); ++ tdesc_create_reg (feature, "r15", 15, 1, NULL, 32, "uint32"); ++ tdesc_create_reg (feature, "r16", 16, 1, NULL, 32, "uint32"); ++ tdesc_create_reg (feature, "r17", 17, 1, NULL, 32, "uint32"); ++ tdesc_create_reg (feature, "r18", 18, 1, NULL, 32, "uint32"); ++ tdesc_create_reg (feature, "r19", 19, 1, NULL, 32, "uint32"); ++ tdesc_create_reg (feature, "r20", 20, 1, NULL, 32, "uint32"); ++ tdesc_create_reg (feature, "r21", 21, 1, NULL, 32, "uint32"); ++ tdesc_create_reg (feature, "r22", 22, 1, NULL, 32, "uint32"); ++ tdesc_create_reg (feature, "r23", 23, 1, NULL, 32, "uint32"); ++ tdesc_create_reg (feature, "r24", 24, 1, NULL, 32, "uint32"); ++ tdesc_create_reg (feature, "r25", 25, 1, NULL, 32, "uint32"); ++ tdesc_create_reg (feature, "r26", 26, 1, NULL, 32, "uint32"); ++ tdesc_create_reg (feature, "r27", 27, 1, NULL, 32, "uint32"); ++ tdesc_create_reg (feature, "r28", 28, 1, NULL, 32, "uint32"); ++ tdesc_create_reg (feature, "r29", 29, 1, NULL, 32, "uint32"); ++ tdesc_create_reg (feature, "r30", 30, 1, NULL, 32, "uint32"); ++ tdesc_create_reg (feature, "r31", 31, 1, NULL, 32, "uint32"); ++ tdesc_create_reg (feature, "pc", 64, 1, NULL, 32, "code_ptr"); ++ tdesc_create_reg (feature, "msr", 65, 1, NULL, 32, "uint32"); ++ tdesc_create_reg (feature, "cr", 66, 1, NULL, 32, "uint32"); ++ tdesc_create_reg (feature, "lr", 67, 1, NULL, 32, "code_ptr"); ++ tdesc_create_reg (feature, "ctr", 68, 1, NULL, 32, "uint32"); ++ tdesc_create_reg (feature, "xer", 69, 1, NULL, 32, "uint32"); ++ ++ feature = tdesc_create_feature (result, "org.gnu.gdb.power.fpu"); ++ tdesc_create_reg (feature, "f0", 32, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f1", 33, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f2", 34, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f3", 35, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f4", 36, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f5", 37, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f6", 38, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f7", 39, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f8", 40, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f9", 41, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f10", 42, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f11", 43, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f12", 44, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f13", 45, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f14", 46, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f15", 47, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f16", 48, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f17", 49, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f18", 50, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f19", 51, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f20", 52, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f21", 53, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f22", 54, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f23", 55, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f24", 56, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f25", 57, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f26", 58, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f27", 59, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f28", 60, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f29", 61, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f30", 62, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f31", 63, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "fpscr", 70, 1, "float", 32, "int"); ++ ++ feature = tdesc_create_feature (result, "org.gnu.gdb.power.linux"); ++ tdesc_create_reg (feature, "orig_r3", 71, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "trap", 72, 1, NULL, 32, "int"); ++ ++ feature = tdesc_create_feature (result, "org.gnu.gdb.power.altivec"); ++ field_type = tdesc_named_type (feature, "ieee_single"); ++ type = init_vector_type (field_type, 4); ++ TYPE_NAME (type) = xstrdup ("v4f"); ++ tdesc_record_type (feature, type); ++ ++ field_type = tdesc_named_type (feature, "int32"); ++ type = init_vector_type (field_type, 4); ++ TYPE_NAME (type) = xstrdup ("v4i32"); ++ tdesc_record_type (feature, type); ++ ++ field_type = tdesc_named_type (feature, "int16"); ++ type = init_vector_type (field_type, 8); ++ TYPE_NAME (type) = xstrdup ("v8i16"); ++ tdesc_record_type (feature, type); ++ ++ field_type = tdesc_named_type (feature, "int8"); ++ type = init_vector_type (field_type, 16); ++ TYPE_NAME (type) = xstrdup ("v16i8"); ++ tdesc_record_type (feature, type); ++ ++ type = init_composite_type (NULL, TYPE_CODE_UNION); ++ TYPE_NAME (type) = xstrdup ("vec128"); ++ field_type = tdesc_named_type (feature, "uint128"); ++ append_composite_type_field (type, xstrdup ("uint128"), field_type); ++ field_type = tdesc_named_type (feature, "v4f"); ++ append_composite_type_field (type, xstrdup ("v4_float"), field_type); ++ field_type = tdesc_named_type (feature, "v4i32"); ++ append_composite_type_field (type, xstrdup ("v4_int32"), field_type); ++ field_type = tdesc_named_type (feature, "v8i16"); ++ append_composite_type_field (type, xstrdup ("v8_int16"), field_type); ++ field_type = tdesc_named_type (feature, "v16i8"); ++ append_composite_type_field (type, xstrdup ("v16_int8"), field_type); ++ TYPE_VECTOR (type) = 1; ++ tdesc_record_type (feature, type); ++ ++ tdesc_create_reg (feature, "vr0", 73, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr1", 74, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr2", 75, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr3", 76, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr4", 77, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr5", 78, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr6", 79, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr7", 80, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr8", 81, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr9", 82, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr10", 83, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr11", 84, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr12", 85, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr13", 86, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr14", 87, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr15", 88, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr16", 89, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr17", 90, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr18", 91, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr19", 92, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr20", 93, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr21", 94, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr22", 95, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr23", 96, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr24", 97, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr25", 98, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr26", 99, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr27", 100, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr28", 101, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr29", 102, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr30", 103, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr31", 104, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vscr", 105, 1, "vector", 32, "int"); ++ tdesc_create_reg (feature, "vrsave", 106, 1, "vector", 32, "int"); ++ ++ tdesc_powerpc_cell32l = result; ++} +--- gdb-6.8.50.20081103-cvs/gdb/features/rs6000/powerpc-cell32l.xml ++++ gdb-6.8.50.20081103-cvs/gdb/features/rs6000/powerpc-cell32l.xml +@@ -0,0 +1,19 @@ ++ ++ ++ ++ ++ ++ ++ ++ powerpc:common ++ spu ++ ++ ++ ++ ++ +--- gdb-6.8.50.20081103-cvs/gdb/features/rs6000/powerpc-cell64l.c ++++ gdb-6.8.50.20081103-cvs/gdb/features/rs6000/powerpc-cell64l.c +@@ -0,0 +1,170 @@ ++/* THIS FILE IS GENERATED. Original: powerpc-cell64l.xml */ ++ ++#include "defs.h" ++#include "gdbtypes.h" ++#include "target-descriptions.h" ++ ++struct target_desc *tdesc_powerpc_cell64l; ++static void ++initialize_tdesc_powerpc_cell64l (void) ++{ ++ struct target_desc *result = allocate_target_description (); ++ struct tdesc_feature *feature; ++ struct type *field_type, *type; ++ ++ set_tdesc_architecture (result, bfd_scan_arch ("powerpc:common64")); ++ ++ tdesc_add_compatible (result, bfd_scan_arch ("spu:256K")); ++ ++ feature = tdesc_create_feature (result, "org.gnu.gdb.power.core"); ++ tdesc_create_reg (feature, "r0", 0, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r1", 1, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r2", 2, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r3", 3, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r4", 4, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r5", 5, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r6", 6, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r7", 7, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r8", 8, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r9", 9, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r10", 10, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r11", 11, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r12", 12, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r13", 13, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r14", 14, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r15", 15, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r16", 16, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r17", 17, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r18", 18, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r19", 19, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r20", 20, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r21", 21, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r22", 22, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r23", 23, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r24", 24, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r25", 25, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r26", 26, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r27", 27, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r28", 28, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r29", 29, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r30", 30, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r31", 31, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "pc", 64, 1, NULL, 64, "code_ptr"); ++ tdesc_create_reg (feature, "msr", 65, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "cr", 66, 1, NULL, 32, "uint32"); ++ tdesc_create_reg (feature, "lr", 67, 1, NULL, 64, "code_ptr"); ++ tdesc_create_reg (feature, "ctr", 68, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "xer", 69, 1, NULL, 32, "uint32"); ++ ++ feature = tdesc_create_feature (result, "org.gnu.gdb.power.fpu"); ++ tdesc_create_reg (feature, "f0", 32, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f1", 33, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f2", 34, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f3", 35, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f4", 36, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f5", 37, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f6", 38, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f7", 39, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f8", 40, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f9", 41, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f10", 42, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f11", 43, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f12", 44, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f13", 45, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f14", 46, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f15", 47, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f16", 48, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f17", 49, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f18", 50, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f19", 51, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f20", 52, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f21", 53, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f22", 54, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f23", 55, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f24", 56, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f25", 57, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f26", 58, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f27", 59, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f28", 60, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f29", 61, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f30", 62, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "f31", 63, 1, NULL, 64, "ieee_double"); ++ tdesc_create_reg (feature, "fpscr", 70, 1, "float", 32, "int"); ++ ++ feature = tdesc_create_feature (result, "org.gnu.gdb.power.linux"); ++ tdesc_create_reg (feature, "orig_r3", 71, 1, NULL, 64, "int"); ++ tdesc_create_reg (feature, "trap", 72, 1, NULL, 64, "int"); ++ ++ feature = tdesc_create_feature (result, "org.gnu.gdb.power.altivec"); ++ field_type = tdesc_named_type (feature, "ieee_single"); ++ type = init_vector_type (field_type, 4); ++ TYPE_NAME (type) = xstrdup ("v4f"); ++ tdesc_record_type (feature, type); ++ ++ field_type = tdesc_named_type (feature, "int32"); ++ type = init_vector_type (field_type, 4); ++ TYPE_NAME (type) = xstrdup ("v4i32"); ++ tdesc_record_type (feature, type); ++ ++ field_type = tdesc_named_type (feature, "int16"); ++ type = init_vector_type (field_type, 8); ++ TYPE_NAME (type) = xstrdup ("v8i16"); ++ tdesc_record_type (feature, type); ++ ++ field_type = tdesc_named_type (feature, "int8"); ++ type = init_vector_type (field_type, 16); ++ TYPE_NAME (type) = xstrdup ("v16i8"); ++ tdesc_record_type (feature, type); ++ ++ type = init_composite_type (NULL, TYPE_CODE_UNION); ++ TYPE_NAME (type) = xstrdup ("vec128"); ++ field_type = tdesc_named_type (feature, "uint128"); ++ append_composite_type_field (type, xstrdup ("uint128"), field_type); ++ field_type = tdesc_named_type (feature, "v4f"); ++ append_composite_type_field (type, xstrdup ("v4_float"), field_type); ++ field_type = tdesc_named_type (feature, "v4i32"); ++ append_composite_type_field (type, xstrdup ("v4_int32"), field_type); ++ field_type = tdesc_named_type (feature, "v8i16"); ++ append_composite_type_field (type, xstrdup ("v8_int16"), field_type); ++ field_type = tdesc_named_type (feature, "v16i8"); ++ append_composite_type_field (type, xstrdup ("v16_int8"), field_type); ++ TYPE_VECTOR (type) = 1; ++ tdesc_record_type (feature, type); ++ ++ tdesc_create_reg (feature, "vr0", 73, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr1", 74, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr2", 75, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr3", 76, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr4", 77, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr5", 78, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr6", 79, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr7", 80, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr8", 81, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr9", 82, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr10", 83, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr11", 84, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr12", 85, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr13", 86, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr14", 87, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr15", 88, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr16", 89, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr17", 90, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr18", 91, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr19", 92, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr20", 93, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr21", 94, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr22", 95, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr23", 96, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr24", 97, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr25", 98, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr26", 99, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr27", 100, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr28", 101, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr29", 102, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr30", 103, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vr31", 104, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "vscr", 105, 1, "vector", 32, "int"); ++ tdesc_create_reg (feature, "vrsave", 106, 1, "vector", 32, "int"); ++ ++ tdesc_powerpc_cell64l = result; ++} +--- gdb-6.8.50.20081103-cvs/gdb/features/rs6000/powerpc-cell64l.xml ++++ gdb-6.8.50.20081103-cvs/gdb/features/rs6000/powerpc-cell64l.xml +@@ -0,0 +1,19 @@ ++ ++ ++ ++ ++ ++ ++ ++ powerpc:common64 ++ spu ++ ++ ++ ++ ++ +--- gdb-6.8.50.20081103-cvs/gdb/findvar.c ++++ gdb-6.8.50.20081103-cvs/gdb/findvar.c +@@ -308,13 +308,15 @@ value_of_register_lazy (struct frame_inf + /* Given a pointer of type TYPE in target form in BUF, return the + address it represents. */ + CORE_ADDR +-unsigned_pointer_to_address (struct type *type, const gdb_byte *buf) ++unsigned_pointer_to_address (struct gdbarch *gdbarch, ++ struct type *type, const gdb_byte *buf) + { + return extract_unsigned_integer (buf, TYPE_LENGTH (type)); + } + + CORE_ADDR +-signed_pointer_to_address (struct type *type, const gdb_byte *buf) ++signed_pointer_to_address (struct gdbarch *gdbarch, ++ struct type *type, const gdb_byte *buf) + { + return extract_signed_integer (buf, TYPE_LENGTH (type)); + } +@@ -322,14 +324,15 @@ signed_pointer_to_address (struct type * + /* Given an address, store it as a pointer of type TYPE in target + format in BUF. */ + void +-unsigned_address_to_pointer (struct type *type, gdb_byte *buf, +- CORE_ADDR addr) ++unsigned_address_to_pointer (struct gdbarch *gdbarch, struct type *type, ++ gdb_byte *buf, CORE_ADDR addr) + { + store_unsigned_integer (buf, TYPE_LENGTH (type), addr); + } + + void +-address_to_signed_pointer (struct type *type, gdb_byte *buf, CORE_ADDR addr) ++address_to_signed_pointer (struct gdbarch *gdbarch, struct type *type, ++ gdb_byte *buf, CORE_ADDR addr) + { + store_signed_integer (buf, TYPE_LENGTH (type), addr); + } +--- gdb-6.8.50.20081103-cvs/gdb/frame-unwind.c ++++ gdb-6.8.50.20081103-cvs/gdb/frame-unwind.c +@@ -126,7 +126,7 @@ default_frame_sniffer (const struct fram + struct value * + frame_unwind_got_optimized (struct frame_info *frame, int regnum) + { +- struct gdbarch *gdbarch = get_frame_arch (frame); ++ struct gdbarch *gdbarch = frame_arch_unwind (frame); + struct value *reg_val; + + reg_val = value_zero (register_type (gdbarch, regnum), not_lval); +@@ -149,7 +149,7 @@ frame_unwind_got_register (struct frame_ + struct value * + frame_unwind_got_memory (struct frame_info *frame, int regnum, CORE_ADDR addr) + { +- struct gdbarch *gdbarch = get_frame_arch (frame); ++ struct gdbarch *gdbarch = frame_arch_unwind (frame); + + return value_at_lazy (register_type (gdbarch, regnum), addr); + } +@@ -161,7 +161,7 @@ struct value * + frame_unwind_got_constant (struct frame_info *frame, int regnum, + ULONGEST val) + { +- struct gdbarch *gdbarch = get_frame_arch (frame); ++ struct gdbarch *gdbarch = frame_arch_unwind (frame); + struct value *reg_val; + + reg_val = value_zero (register_type (gdbarch, regnum), not_lval); +@@ -173,7 +173,7 @@ frame_unwind_got_constant (struct frame_ + struct value * + frame_unwind_got_bytes (struct frame_info *frame, int regnum, gdb_byte *buf) + { +- struct gdbarch *gdbarch = get_frame_arch (frame); ++ struct gdbarch *gdbarch = frame_arch_unwind (frame); + struct value *reg_val; + + reg_val = value_zero (register_type (gdbarch, regnum), not_lval); +@@ -189,7 +189,7 @@ struct value * + frame_unwind_got_address (struct frame_info *frame, int regnum, + CORE_ADDR addr) + { +- struct gdbarch *gdbarch = get_frame_arch (frame); ++ struct gdbarch *gdbarch = frame_arch_unwind (frame); + struct value *reg_val; + + reg_val = value_zero (register_type (gdbarch, regnum), not_lval); +--- gdb-6.8.50.20081103-cvs/gdb/frame-unwind.h ++++ gdb-6.8.50.20081103-cvs/gdb/frame-unwind.h +@@ -121,6 +121,13 @@ typedef struct value * (frame_prev_regis + typedef void (frame_dealloc_cache_ftype) (struct frame_info *self, + void *this_cache); + ++/* Assuming the frame chain: (outer) prev <-> this <-> next (inner); ++ use THIS frame, and implicitly the NEXT frame's register unwind ++ method, return PREV frame's architecture. */ ++ ++typedef struct gdbarch *(frame_prev_arch_ftype) (struct frame_info *this_frame, ++ void **this_prologue_cache); ++ + struct frame_unwind + { + /* The frame's type. Should this instead be a collection of +@@ -133,6 +140,7 @@ struct frame_unwind + const struct frame_data *unwind_data; + frame_sniffer_ftype *sniffer; + frame_dealloc_cache_ftype *dealloc_cache; ++ frame_prev_arch_ftype *prev_arch; + }; + + /* Register a frame unwinder, _prepending_ it to the front of the +--- gdb-6.8.50.20081103-cvs/gdb/frame.c ++++ gdb-6.8.50.20081103-cvs/gdb/frame.c @@ -41,6 +41,7 @@ #include "objfiles.h" #include "exceptions.h" @@ -1226,7 +1495,7 @@ Index: gdb-head/gdb/frame.c regnum)); } -@@ -1046,6 +1068,8 @@ select_frame (struct frame_info *fi) +@@ -1067,6 +1089,8 @@ select_frame (struct frame_info *fi) source language of this frame, and switch to it if desired. */ if (fi) { @@ -1235,7 +1504,7 @@ Index: gdb-head/gdb/frame.c /* We retrieve the frame's symtab by using the frame PC. However we cannot use the frame PC as-is, because it usually points to the instruction following the "call", which is sometimes the -@@ -1702,9 +1726,17 @@ enum frame_type +@@ -1723,9 +1747,17 @@ enum frame_type get_frame_type (struct frame_info *frame) { if (frame->unwind == NULL) @@ -1256,7 +1525,7 @@ Index: gdb-head/gdb/frame.c return frame->unwind->type; } -@@ -1771,12 +1803,48 @@ safe_frame_unwind_memory (struct frame_i +@@ -1792,12 +1824,48 @@ safe_frame_unwind_memory (struct frame_i return !target_read_memory (addr, buf, len); } @@ -1307,10 +1576,8 @@ Index: gdb-head/gdb/frame.c } /* Stack pointer methods. */ -Index: gdb-head/gdb/frame.h -=================================================================== ---- gdb-head.orig/gdb/frame.h -+++ gdb-head/gdb/frame.h +--- gdb-6.8.50.20081103-cvs/gdb/frame.h ++++ gdb-6.8.50.20081103-cvs/gdb/frame.h @@ -180,6 +180,8 @@ enum frame_type /* In a signal handler, various OSs handle this in various ways. The main thing is that the frame may be far from normal. */ @@ -1328,321 +1595,56 @@ Index: gdb-head/gdb/frame.h /* Values for the source flag to be used in print_frame_info_base(). */ -Index: gdb-head/gdb/frame-unwind.c -=================================================================== ---- gdb-head.orig/gdb/frame-unwind.c -+++ gdb-head/gdb/frame-unwind.c -@@ -126,7 +126,7 @@ default_frame_sniffer (const struct fram - struct value * - frame_unwind_got_optimized (struct frame_info *frame, int regnum) +--- gdb-6.8.50.20081103-cvs/gdb/gcore.c ++++ gdb-6.8.50.20081103-cvs/gdb/gcore.c +@@ -35,7 +35,7 @@ + generate-core-file for programs with large resident data. */ + #define MAX_COPY_BYTES (1024 * 1024) + +-static char *default_gcore_target (void); ++static const char *default_gcore_target (void); + static enum bfd_architecture default_gcore_arch (void); + static unsigned long default_gcore_mach (void); + static int gcore_memory_sections (bfd *); +@@ -125,7 +125,7 @@ default_gcore_mach (void) + return 0; + #else + +- const struct bfd_arch_info *bfdarch = gdbarch_bfd_arch_info (current_gdbarch); ++ const struct bfd_arch_info *bfdarch = gdbarch_bfd_arch_info (target_gdbarch); + + if (bfdarch != NULL) + return bfdarch->mach; +@@ -139,8 +139,7 @@ default_gcore_mach (void) + static enum bfd_architecture + default_gcore_arch (void) { -- struct gdbarch *gdbarch = get_frame_arch (frame); -+ struct gdbarch *gdbarch = frame_arch_unwind (frame); - struct value *reg_val; +- const struct bfd_arch_info * bfdarch = gdbarch_bfd_arch_info +- (current_gdbarch); ++ const struct bfd_arch_info *bfdarch = gdbarch_bfd_arch_info (target_gdbarch); - reg_val = value_zero (register_type (gdbarch, regnum), not_lval); -@@ -149,7 +149,7 @@ frame_unwind_got_register (struct frame_ - struct value * - frame_unwind_got_memory (struct frame_info *frame, int regnum, CORE_ADDR addr) - { -- struct gdbarch *gdbarch = get_frame_arch (frame); -+ struct gdbarch *gdbarch = frame_arch_unwind (frame); - - return value_at_lazy (register_type (gdbarch, regnum), addr); - } -@@ -161,7 +161,7 @@ struct value * - frame_unwind_got_constant (struct frame_info *frame, int regnum, - ULONGEST val) - { -- struct gdbarch *gdbarch = get_frame_arch (frame); -+ struct gdbarch *gdbarch = frame_arch_unwind (frame); - struct value *reg_val; - - reg_val = value_zero (register_type (gdbarch, regnum), not_lval); -@@ -173,7 +173,7 @@ frame_unwind_got_constant (struct frame_ - struct value * - frame_unwind_got_bytes (struct frame_info *frame, int regnum, gdb_byte *buf) - { -- struct gdbarch *gdbarch = get_frame_arch (frame); -+ struct gdbarch *gdbarch = frame_arch_unwind (frame); - struct value *reg_val; - - reg_val = value_zero (register_type (gdbarch, regnum), not_lval); -@@ -189,7 +189,7 @@ struct value * - frame_unwind_got_address (struct frame_info *frame, int regnum, - CORE_ADDR addr) - { -- struct gdbarch *gdbarch = get_frame_arch (frame); -+ struct gdbarch *gdbarch = frame_arch_unwind (frame); - struct value *reg_val; - - reg_val = value_zero (register_type (gdbarch, regnum), not_lval); -Index: gdb-head/gdb/frame-unwind.h -=================================================================== ---- gdb-head.orig/gdb/frame-unwind.h -+++ gdb-head/gdb/frame-unwind.h -@@ -121,6 +121,13 @@ typedef struct value * (frame_prev_regis - typedef void (frame_dealloc_cache_ftype) (struct frame_info *self, - void *this_cache); - -+/* Assuming the frame chain: (outer) prev <-> this <-> next (inner); -+ use THIS frame, and implicitly the NEXT frame's register unwind -+ method, return PREV frame's architecture. */ -+ -+typedef struct gdbarch *(frame_prev_arch_ftype) (struct frame_info *this_frame, -+ void **this_prologue_cache); -+ - struct frame_unwind - { - /* The frame's type. Should this instead be a collection of -@@ -133,6 +140,7 @@ struct frame_unwind - const struct frame_data *unwind_data; - frame_sniffer_ftype *sniffer; - frame_dealloc_cache_ftype *dealloc_cache; -+ frame_prev_arch_ftype *prev_arch; - }; - - /* Register a frame unwinder, _prepending_ it to the front of the -Index: gdb-head/gdb/sentinel-frame.c -=================================================================== ---- gdb-head.orig/gdb/sentinel-frame.c -+++ gdb-head/gdb/sentinel-frame.c -@@ -76,11 +76,23 @@ sentinel_frame_this_id (struct frame_inf - internal_error (__FILE__, __LINE__, _("sentinel_frame_this_id called")); + if (bfdarch != NULL) + return bfdarch->arch; +@@ -150,10 +149,15 @@ default_gcore_arch (void) + return bfd_get_arch (exec_bfd); } -+static struct gdbarch * -+sentinel_frame_prev_arch (struct frame_info *this_frame, -+ void **this_prologue_cache) -+{ -+ struct frame_unwind_cache *cache = *this_prologue_cache; -+ return get_regcache_arch (cache->regcache); -+} -+ - const struct frame_unwind sentinel_frame_unwinder = +-static char * ++static const char * + default_gcore_target (void) { - SENTINEL_FRAME, - sentinel_frame_this_id, -- sentinel_frame_prev_register -+ sentinel_frame_prev_register, -+ NULL, -+ NULL, -+ NULL, -+ sentinel_frame_prev_arch, - }; - - const struct frame_unwind *const sentinel_frame_unwind = &sentinel_frame_unwinder; -Index: gdb-head/gdb/stack.c -=================================================================== ---- gdb-head.orig/gdb/stack.c -+++ gdb-head/gdb/stack.c -@@ -45,6 +45,7 @@ - #include "valprint.h" - #include "gdbthread.h" - #include "cp-support.h" -+#include "arch-utils.h" - - #include "gdb_assert.h" - #include -@@ -109,6 +110,8 @@ print_stack_frame (struct frame_info *fr - enum print_what print_what) - { - struct print_stack_frame_args args; -+ struct cleanup *old_chain = save_current_gdbarch (); -+ current_gdbarch = get_frame_arch (frame); - - args.frame = frame; - args.print_level = print_level; -@@ -118,6 +121,7 @@ print_stack_frame (struct frame_info *fr - args.print_args = 1; - - catch_errors (print_stack_frame_stub, &args, "", RETURN_MASK_ERROR); -+ do_cleanups (old_chain); - } - - struct print_args_args -@@ -223,6 +227,9 @@ print_frame_args (struct symbol *func, s - stb = ui_out_stream_new (uiout); - old_chain = make_cleanup_ui_out_stream_delete (stb); - -+ save_current_gdbarch (); -+ current_gdbarch = get_frame_arch (frame); +- /* FIXME: This may only work for ELF targets. */ ++ /* The gdbarch may define a target to use for core files. */ ++ if (gdbarch_gcore_bfd_target_p (target_gdbarch)) ++ return gdbarch_gcore_bfd_target (target_gdbarch); + - if (func) - { - struct block *b = SYMBOL_BLOCK_VALUE (func); -@@ -471,9 +478,11 @@ print_frame_info (struct frame_info *fra - struct symtab_and_line sal; - int source_print; - int location_print; -+ struct cleanup *old_chain; - - if (get_frame_type (frame) == DUMMY_FRAME -- || get_frame_type (frame) == SIGTRAMP_FRAME) -+ || get_frame_type (frame) == SIGTRAMP_FRAME -+ || get_frame_type (frame) == ARCH_FRAME) - { - struct cleanup *uiout_cleanup - = make_cleanup_ui_out_tuple_begin_end (uiout, "frame"); -@@ -506,6 +515,10 @@ print_frame_info (struct frame_info *fra - annotate_signal_handler_caller (); - ui_out_field_string (uiout, "func", ""); - } -+ else if (get_frame_type (frame) == ARCH_FRAME) -+ { -+ ui_out_field_string (uiout, "func", ""); -+ } - ui_out_text (uiout, "\n"); - annotate_frame_end (); - -@@ -519,6 +532,10 @@ print_frame_info (struct frame_info *fra - the next frame is a SIGTRAMP_FRAME or a DUMMY_FRAME, then the - next frame was not entered as the result of a call, and we want - to get the line containing FRAME->pc. */ -+ -+ old_chain = save_current_gdbarch (); -+ current_gdbarch = get_frame_arch (frame); -+ - find_frame_sal (frame, &sal); - - location_print = (print_what == LOCATION -@@ -572,6 +589,7 @@ print_frame_info (struct frame_info *fra - annotate_frame_end (); - - gdb_flush (gdb_stdout); -+ do_cleanups (old_chain); - } - - static void -@@ -1431,6 +1449,7 @@ static void - print_frame_local_vars (struct frame_info *frame, int num_tabs, - struct ui_file *stream) - { -+ struct cleanup *old_chain; - struct block *block = get_frame_block (frame, 0); - int values_printed = 0; - -@@ -1440,6 +1459,9 @@ print_frame_local_vars (struct frame_inf - return; - } - -+ old_chain = save_current_gdbarch (); -+ current_gdbarch = get_frame_arch (frame); -+ - while (block) - { - if (print_block_frame_locals (block, frame, num_tabs, stream)) -@@ -1453,6 +1475,8 @@ print_frame_local_vars (struct frame_inf - - if (!values_printed) - fprintf_filtered (stream, _("No locals.\n")); -+ -+ do_cleanups (old_chain); - } - - /* Same, but print labels. */ -Index: gdb-head/gdb/arch-utils.c -=================================================================== ---- gdb-head.orig/gdb/arch-utils.c -+++ gdb-head/gdb/arch-utils.c -@@ -326,15 +326,24 @@ set_endian (char *ignore_args, int from_ - } - - /* Given SELECTED, a currently selected BFD architecture, and -- FROM_TARGET, a BFD architecture reported by the target description, -- return what architecture to use. Either may be NULL; if both are -- specified, we use the more specific. If the two are obviously -- incompatible, warn the user. */ -+ TARGET_DESC, the current target description, return what -+ architecture to use. -+ -+ SELECTED may be NULL, in which case we return the architecture -+ associated with TARGET_DESC. If SELECTED specifies a variant -+ of the architecture associtated with TARGET_DESC, return the -+ more specific of the two. -+ -+ If SELECTED is a different architecture, but it is accepted as -+ compatible by the target, we can use the target architecture. -+ -+ If SELECTED is obviously incompatible, warn the user. */ - - static const struct bfd_arch_info * --choose_architecture_for_target (const struct bfd_arch_info *selected, -- const struct bfd_arch_info *from_target) -+choose_architecture_for_target (const struct target_desc *target_desc, -+ const struct bfd_arch_info *selected) - { -+ const struct bfd_arch_info *from_target = tdesc_architecture (target_desc); - const struct bfd_arch_info *compat1, *compat2; - - if (selected == NULL) -@@ -364,6 +373,11 @@ choose_architecture_for_target (const st - - if (compat1 == NULL && compat2 == NULL) - { -+ /* BFD considers the architectures incompatible. Check our target -+ description whether it accepts SELECTED as compatible anyway. */ -+ if (tdesc_compatible_p (target_desc, selected)) -+ return from_target; -+ - warning (_("Selected architecture %s is not compatible " - "with reported target architecture %s"), - selected->printable_name, from_target->printable_name); -@@ -692,7 +706,7 @@ gdbarch_info_fill (struct gdbarch_info * - /* From the target. */ - if (info->target_desc != NULL) - info->bfd_arch_info = choose_architecture_for_target -- (info->bfd_arch_info, tdesc_architecture (info->target_desc)); -+ (info->target_desc, info->bfd_arch_info); - /* From the default. */ - if (info->bfd_arch_info == NULL) - info->bfd_arch_info = default_bfd_arch; -@@ -720,6 +734,27 @@ gdbarch_info_fill (struct gdbarch_info * - gdb_assert (info->bfd_arch_info != NULL); - } - -+ -+/* restore_current_gdbarch() will be used by the cleanup machinery -+ to restore the current_gdbarch value saved in a call to -+ save_current_gdbarch(). */ -+ -+static void -+restore_current_gdbarch (void *arg) -+{ -+ current_gdbarch = arg; -+} -+ -+/* Save the value of current so that it may be restored by a -+ later call to do_cleanups(). Returns the struct cleanup pointer -+ needed for later doing the cleanup. */ -+ -+struct cleanup * -+save_current_gdbarch (void) -+{ -+ return make_cleanup (restore_current_gdbarch, current_gdbarch); -+} -+ - /* */ - - extern initialize_file_ftype _initialize_gdbarch_utils; /* -Wmissing-prototypes */ -Index: gdb-head/gdb/arch-utils.h -=================================================================== ---- gdb-head.orig/gdb/arch-utils.h -+++ gdb-head/gdb/arch-utils.h -@@ -139,4 +139,9 @@ extern void gdbarch_info_fill (struct gd - - extern struct gdbarch *gdbarch_from_bfd (bfd *abfd); - -+/* Save value of current_gdbarch so that it may be restored by -+ a later call to do_cleanups(). Returns the struct cleanup -+ pointer needed for later doing the cleanup. */ -+struct cleanup *save_current_gdbarch (void); -+ - #endif -Index: gdb-head/gdb/gdbarch.c -=================================================================== ---- gdb-head.orig/gdb/gdbarch.c -+++ gdb-head/gdb/gdbarch.c ++ /* Otherwise, try to fall back to the exec_bfd target. This will probably ++ not work for non-ELF targets. */ + if (exec_bfd == NULL) + return NULL; + else +--- gdb-6.8.50.20081103-cvs/gdb/gdbarch.c ++++ gdb-6.8.50.20081103-cvs/gdb/gdbarch.c @@ -225,6 +225,7 @@ struct gdbarch gdbarch_regset_from_core_section_ftype *regset_from_core_section; struct core_regset_section * core_regset_sections; @@ -1651,7 +1653,7 @@ Index: gdb-head/gdb/gdbarch.c int vtable_function_descriptors; int vbit_in_delta; gdbarch_skip_permanent_breakpoint_ftype *skip_permanent_breakpoint; -@@ -311,8 +312,8 @@ struct gdbarch startup_gdbarch = +@@ -312,8 +313,8 @@ struct gdbarch startup_gdbarch = 0, /* register_to_value */ 0, /* value_to_register */ 0, /* value_from_register */ @@ -1662,7 +1664,7 @@ Index: gdb-head/gdb/gdbarch.c 0, /* integer_to_address */ 0, /* return_value */ 0, /* skip_prologue */ -@@ -356,6 +357,7 @@ struct gdbarch startup_gdbarch = +@@ -357,6 +358,7 @@ struct gdbarch startup_gdbarch = 0, /* regset_from_core_section */ 0, /* core_regset_sections */ 0, /* core_xfer_shared_libraries */ @@ -1670,7 +1672,7 @@ Index: gdb-head/gdb/gdbarch.c 0, /* vtable_function_descriptors */ 0, /* vbit_in_delta */ 0, /* skip_permanent_breakpoint */ -@@ -606,6 +608,7 @@ verify_gdbarch (struct gdbarch *gdbarch) +@@ -608,6 +610,7 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of fetch_pointer_argument, has predicate */ /* Skip verify of regset_from_core_section, has predicate */ /* Skip verify of core_xfer_shared_libraries, has predicate */ @@ -1678,7 +1680,7 @@ Index: gdb-head/gdb/gdbarch.c /* Skip verify of vtable_function_descriptors, invalid_p == 0 */ /* Skip verify of vbit_in_delta, invalid_p == 0 */ /* Skip verify of skip_permanent_breakpoint, has predicate */ -@@ -826,6 +829,12 @@ gdbarch_dump (struct gdbarch *gdbarch, s +@@ -829,6 +832,12 @@ gdbarch_dump (struct gdbarch *gdbarch, s "gdbarch_dump: frame_red_zone_size = %s\n", plongest (gdbarch->frame_red_zone_size)); fprintf_unfiltered (file, @@ -1691,7 +1693,7 @@ Index: gdb-head/gdb/gdbarch.c "gdbarch_dump: gdbarch_get_longjmp_target_p() = %d\n", gdbarch_get_longjmp_target_p (gdbarch)); fprintf_unfiltered (file, -@@ -2049,7 +2058,7 @@ gdbarch_pointer_to_address (struct gdbar +@@ -2055,7 +2064,7 @@ gdbarch_pointer_to_address (struct gdbar gdb_assert (gdbarch->pointer_to_address != NULL); if (gdbarch_debug >= 2) fprintf_unfiltered (gdb_stdlog, "gdbarch_pointer_to_address called\n"); @@ -1700,7 +1702,7 @@ Index: gdb-head/gdb/gdbarch.c } void -@@ -2066,7 +2075,7 @@ gdbarch_address_to_pointer (struct gdbar +@@ -2072,7 +2081,7 @@ gdbarch_address_to_pointer (struct gdbar gdb_assert (gdbarch->address_to_pointer != NULL); if (gdbarch_debug >= 2) fprintf_unfiltered (gdb_stdlog, "gdbarch_address_to_pointer called\n"); @@ -1709,7 +1711,7 @@ Index: gdb-head/gdb/gdbarch.c } void -@@ -2925,6 +2934,31 @@ set_gdbarch_core_xfer_shared_libraries ( +@@ -2931,6 +2940,31 @@ set_gdbarch_core_xfer_shared_libraries ( } int @@ -1741,7 +1743,7 @@ Index: gdb-head/gdb/gdbarch.c gdbarch_vtable_function_descriptors (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); -@@ -3344,10 +3378,15 @@ gdbarch_data (struct gdbarch *gdbarch, s +@@ -3367,10 +3401,15 @@ gdbarch_data (struct gdbarch *gdbarch, s (as all fields are valid), but be careful to also detect recursive references. */ { @@ -1757,10 +1759,38 @@ Index: gdb-head/gdb/gdbarch.c } else /* The architecture initialization hasn't completed - punt - -Index: gdb-head/gdb/gdbarch.sh -=================================================================== ---- gdb-head.orig/gdb/gdbarch.sh -+++ gdb-head/gdb/gdbarch.sh +--- gdb-6.8.50.20081103-cvs/gdb/gdbarch.h ++++ gdb-6.8.50.20081103-cvs/gdb/gdbarch.h +@@ -348,11 +348,11 @@ typedef struct value * (gdbarch_value_fr + extern struct value * gdbarch_value_from_register (struct gdbarch *gdbarch, struct type *type, int regnum, struct frame_info *frame); + extern void set_gdbarch_value_from_register (struct gdbarch *gdbarch, gdbarch_value_from_register_ftype *value_from_register); + +-typedef CORE_ADDR (gdbarch_pointer_to_address_ftype) (struct type *type, const gdb_byte *buf); ++typedef CORE_ADDR (gdbarch_pointer_to_address_ftype) (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf); + extern CORE_ADDR gdbarch_pointer_to_address (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf); + extern void set_gdbarch_pointer_to_address (struct gdbarch *gdbarch, gdbarch_pointer_to_address_ftype *pointer_to_address); + +-typedef void (gdbarch_address_to_pointer_ftype) (struct type *type, gdb_byte *buf, CORE_ADDR addr); ++typedef void (gdbarch_address_to_pointer_ftype) (struct gdbarch *gdbarch, struct type *type, gdb_byte *buf, CORE_ADDR addr); + extern void gdbarch_address_to_pointer (struct gdbarch *gdbarch, struct type *type, gdb_byte *buf, CORE_ADDR addr); + extern void set_gdbarch_address_to_pointer (struct gdbarch *gdbarch, gdbarch_address_to_pointer_ftype *address_to_pointer); + +@@ -652,6 +652,13 @@ typedef LONGEST (gdbarch_core_xfer_share + extern LONGEST gdbarch_core_xfer_shared_libraries (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, LONGEST len); + extern void set_gdbarch_core_xfer_shared_libraries (struct gdbarch *gdbarch, gdbarch_core_xfer_shared_libraries_ftype *core_xfer_shared_libraries); + ++/* BFD target to use when generating a core file. */ ++ ++extern int gdbarch_gcore_bfd_target_p (struct gdbarch *gdbarch); ++ ++extern const char * gdbarch_gcore_bfd_target (struct gdbarch *gdbarch); ++extern void set_gdbarch_gcore_bfd_target (struct gdbarch *gdbarch, const char * gcore_bfd_target); ++ + /* If the elements of C++ vtables are in-place function descriptors rather + than normal function pointers (which may point to code or a descriptor), + set this to one. */ +--- gdb-6.8.50.20081103-cvs/gdb/gdbarch.sh ++++ gdb-6.8.50.20081103-cvs/gdb/gdbarch.sh @@ -466,8 +466,8 @@ f:void:value_to_register:struct frame_in # (but not the value contents) filled in. f:struct value *:value_from_register:struct type *type, int regnum, struct frame_info *frame:type, regnum, frame::default_value_from_register::0 @@ -1782,7 +1812,7 @@ Index: gdb-head/gdb/gdbarch.sh # If the elements of C++ vtables are in-place function descriptors rather # than normal function pointers (which may point to code or a descriptor), # set this to one. -@@ -1724,10 +1727,15 @@ gdbarch_data (struct gdbarch *gdbarch, s +@@ -1728,10 +1731,15 @@ gdbarch_data (struct gdbarch *gdbarch, s (as all fields are valid), but be careful to also detect recursive references. */ { @@ -1798,113 +1828,70 @@ Index: gdb-head/gdb/gdbarch.sh } else /* The architecture initialization hasn't completed - punt - -Index: gdb-head/gdb/corelow.c -=================================================================== ---- gdb-head.orig/gdb/corelow.c -+++ gdb-head/gdb/corelow.c -@@ -537,6 +537,33 @@ core_files_info (struct target_ops *t) - print_section_info (t, core_bfd); - } - -+struct spuid_list -+{ -+ gdb_byte *buf; -+ ULONGEST offset; -+ LONGEST len; -+ ULONGEST pos; -+ ULONGEST written; -+}; -+ -+static void -+add_to_spuid_list (bfd *abfd, asection *asect, void *list_p) -+{ -+ struct spuid_list *list = list_p; -+ int fd, pos = 0; -+ -+ sscanf (bfd_section_name (abfd, asect), "SPU/%d/regs%n", &fd, &pos); -+ if (pos == 0) -+ return; -+ -+ if (list->pos >= list->offset && list->pos + 4 <= list->offset + list->len) -+ { -+ store_unsigned_integer (list->buf + list->pos - list->offset, 4, fd); -+ list->written += 4; -+ } -+ list->pos += 4; -+} -+ - static LONGEST - core_xfer_partial (struct target_ops *ops, enum target_object object, - const char *annex, gdb_byte *readbuf, -@@ -629,6 +656,53 @@ core_xfer_partial (struct target_ops *op - } - /* FALL THROUGH */ +--- gdb-6.8.50.20081103-cvs/gdb/gdbserver/Makefile.in ++++ gdb-6.8.50.20081103-cvs/gdb/gdbserver/Makefile.in +@@ -213,8 +213,9 @@ clean: + rm -f reg-cris.c reg-crisv32.c reg-x86-64-linux.c reg-xtensa.c + rm -f arm-with-iwmmxt.c mips-linux.c mips64-linux.c + rm -f powerpc-32l.c powerpc-64l.c powerpc-e500l.c +- rm -f powerpc-altivec32l.c powerpc-vsx32l.c powerpc-altivec64l.c +- rm -f powerpc-vsx64l.c xml-builtin.c stamp-xml ++ rm -f powerpc-altivec32l.c powerpc-cell32l.c powerpc-vsx32l.c ++ rm -f powerpc-altivec64l.c powerpc-cell64l.c powerpc-vsx64l.c ++ rm -f xml-builtin.c stamp-xml -+ case TARGET_OBJECT_SPU: -+ if (readbuf && annex) -+ { -+ /* When the SPU contexts are stored in core file, BFD -+ represents this with a fake section called "SPU/". */ -+ -+ struct bfd_section *section; -+ bfd_size_type size; -+ char *contents; -+ -+ char sectionstr[100]; -+ xsnprintf (sectionstr, sizeof sectionstr, "SPU/%s", annex); -+ -+ section = bfd_get_section_by_name (core_bfd, sectionstr); -+ if (section == NULL) -+ return -1; -+ -+ size = bfd_section_size (core_bfd, section); -+ if (offset >= size) -+ return 0; -+ size -= offset; -+ if (size > len) -+ size = len; -+ if (size > 0 -+ && !bfd_get_section_contents (core_bfd, section, readbuf, -+ (file_ptr) offset, size)) -+ { -+ warning (_("Couldn't read SPU section in core file.")); -+ return -1; -+ } -+ -+ return size; -+ } -+ else if (readbuf) -+ { -+ /* NULL annex requests list of all present spuids. */ -+ struct spuid_list list; -+ list.buf = readbuf; -+ list.offset = offset; -+ list.len = len; -+ list.pos = 0; -+ list.written = 0; -+ bfd_map_over_sections (core_bfd, add_to_spuid_list, &list); -+ return list.written; -+ } -+ return -1; -+ - default: - if (ops->beneath != NULL) - return ops->beneath->to_xfer_partial (ops->beneath, object, annex, -@@ -668,8 +742,8 @@ core_file_thread_alive (ptid_t tid) - static const struct target_desc * - core_read_description (struct target_ops *target) - { -- if (gdbarch_core_read_description_p (current_gdbarch)) -- return gdbarch_core_read_description (current_gdbarch, target, core_bfd); -+ if (core_gdbarch && gdbarch_core_read_description_p (core_gdbarch)) -+ return gdbarch_core_read_description (core_gdbarch, target, core_bfd); - - return NULL; - } -Index: gdb-head/gdb/gdbserver/linux-low.c -=================================================================== ---- gdb-head.orig/gdb/gdbserver/linux-low.c -+++ gdb-head/gdb/gdbserver/linux-low.c + maintainer-clean realclean distclean: clean + rm -f nm.h tm.h xm.h config.status config.h stamp-h config.log +@@ -358,6 +359,9 @@ powerpc-32l.c : $(srcdir)/../regformats/ + powerpc-altivec32l.o : powerpc-altivec32l.c $(regdef_h) + powerpc-altivec32l.c : $(srcdir)/../regformats/rs6000/powerpc-altivec32l.dat $(regdat_sh) + $(SHELL) $(regdat_sh) $(srcdir)/../regformats/rs6000/powerpc-altivec32l.dat powerpc-altivec32l.c ++powerpc-cell32l.o : powerpc-cell32l.c $(regdef_h) ++powerpc-cell32l.c : $(srcdir)/../regformats/rs6000/powerpc-cell32l.dat $(regdat_sh) ++ $(SHELL) $(regdat_sh) $(srcdir)/../regformats/rs6000/powerpc-cell32l.dat powerpc-cell32l.c + powerpc-vsx32l.o : powerpc-vsx32l.c $(regdef_h) + powerpc-vsx32l.c : $(srcdir)/../regformats/rs6000/powerpc-vsx32l.dat $(regdat_sh) + $(SHELL) $(regdat_sh) $(srcdir)/../regformats/rs6000/powerpc-vsx32l.dat powerpc-vsx32l.c +@@ -370,6 +374,9 @@ powerpc-64l.c : $(srcdir)/../regformats/ + powerpc-altivec64l.o : powerpc-altivec64l.c $(regdef_h) + powerpc-altivec64l.c : $(srcdir)/../regformats/rs6000/powerpc-altivec64l.dat $(regdat_sh) + $(SHELL) $(regdat_sh) $(srcdir)/../regformats/rs6000/powerpc-altivec64l.dat powerpc-altivec64l.c ++powerpc-cell64l.o : powerpc-cell64l.c $(regdef_h) ++powerpc-cell64l.c : $(srcdir)/../regformats/rs6000/powerpc-cell64l.dat $(regdat_sh) ++ $(SHELL) $(regdat_sh) $(srcdir)/../regformats/rs6000/powerpc-cell64l.dat powerpc-cell64l.c + powerpc-vsx64l.o : powerpc-vsx64l.c $(regdef_h) + powerpc-vsx64l.c : $(srcdir)/../regformats/rs6000/powerpc-vsx64l.dat $(regdat_sh) + $(SHELL) $(regdat_sh) $(srcdir)/../regformats/rs6000/powerpc-vsx64l.dat powerpc-vsx64l.c +--- gdb-6.8.50.20081103-cvs/gdb/gdbserver/configure.srv ++++ gdb-6.8.50.20081103-cvs/gdb/gdbserver/configure.srv +@@ -102,14 +102,17 @@ case "${target}" in + ;; + powerpc*-*-linux*) srv_regobj="powerpc-32l.o" + srv_regobj="${srv_regobj} powerpc-altivec32l.o" ++ srv_regobj="${srv_regobj} powerpc-cell32l.o" + srv_regobj="${srv_regobj} powerpc-vsx32l.o" + srv_regobj="${srv_regobj} powerpc-e500l.o" + srv_regobj="${srv_regobj} powerpc-64l.o" + srv_regobj="${srv_regobj} powerpc-altivec64l.o" ++ srv_regobj="${srv_regobj} powerpc-cell64l.o" + srv_regobj="${srv_regobj} powerpc-vsx64l.o" + srv_tgtobj="linux-low.o linux-ppc-low.o" + srv_xmlfiles="rs6000/powerpc-32l.xml" + srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-altivec32l.xml" ++ srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-cell32l.xml" + srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-vsx32l.xml" + srv_xmlfiles="${srv_xmlfiles} rs6000/power-altivec.xml" + srv_xmlfiles="${srv_xmlfiles} rs6000/power-vsx.xml" +@@ -120,6 +123,7 @@ case "${target}" in + srv_xmlfiles="${srv_xmlfiles} rs6000/power-spe.xml" + srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-64l.xml" + srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-altivec64l.xml" ++ srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-cell64l.xml" + srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-vsx64l.xml" + srv_xmlfiles="${srv_xmlfiles} rs6000/power64-core.xml" + srv_xmlfiles="${srv_xmlfiles} rs6000/power64-linux.xml" +--- gdb-6.8.50.20081103-cvs/gdb/gdbserver/linux-low.c ++++ gdb-6.8.50.20081103-cvs/gdb/gdbserver/linux-low.c @@ -33,6 +33,14 @@ #include #include @@ -2032,178 +2019,179 @@ Index: gdb-head/gdb/gdbserver/linux-low.c hostio_last_error_from_errno, }; -Index: gdb-head/gdb/solib.c -=================================================================== ---- gdb-head.orig/gdb/solib.c -+++ gdb-head/gdb/solib.c -@@ -311,15 +311,22 @@ static int - solib_map_sections (void *arg) - { - struct so_list *so = (struct so_list *) arg; /* catch_errors bogon */ -+ struct target_so_ops *ops = solib_ops (target_gdbarch); - char *filename; - struct section_table *p; - struct cleanup *old_chain; -- bfd *abfd; -+ bfd *abfd = NULL; -+ -+ if (ops->open_bfd) -+ abfd = ops->open_bfd (so->so_name); +--- gdb-6.8.50.20081103-cvs/gdb/gdbserver/linux-ppc-low.c ++++ gdb-6.8.50.20081103-cvs/gdb/gdbserver/linux-ppc-low.c +@@ -28,6 +28,7 @@ + #define PPC_FEATURE_HAS_VSX 0x00000080 + #define PPC_FEATURE_HAS_ALTIVEC 0x10000000 + #define PPC_FEATURE_HAS_SPE 0x00800000 ++#define PPC_FEATURE_CELL 0x00010000 -- filename = tilde_expand (so->so_name); -- old_chain = make_cleanup (xfree, filename); -- abfd = solib_bfd_open (filename); -- do_cleanups (old_chain); -+ if (!abfd) -+ { -+ filename = tilde_expand (so->so_name); -+ old_chain = make_cleanup (xfree, filename); -+ abfd = solib_bfd_open (filename); -+ do_cleanups (old_chain); -+ } + static unsigned long ppc_hwcap; - /* Leave bfd open, core_xfer_memory and "info files" need it. */ - so->abfd = abfd; -@@ -338,8 +345,6 @@ solib_map_sections (void *arg) +@@ -36,6 +37,8 @@ static unsigned long ppc_hwcap; + void init_registers_powerpc_32l (void); + /* Defined in auto-generated file powerpc-altivec32l.c. */ + void init_registers_powerpc_altivec32l (void); ++/* Defined in auto-generated file powerpc-cell32l.c. */ ++void init_registers_powerpc_cell32l (void); + /* Defined in auto-generated file powerpc-vsx32l.c. */ + void init_registers_powerpc_vsx32l (void); + /* Defined in auto-generated file powerpc-e500l.c. */ +@@ -44,6 +47,8 @@ void init_registers_powerpc_e500l (void) + void init_registers_powerpc_64l (void); + /* Defined in auto-generated file powerpc-altivec64l.c. */ + void init_registers_powerpc_altivec64l (void); ++/* Defined in auto-generated file powerpc-cell64l.c. */ ++void init_registers_powerpc_cell64l (void); + /* Defined in auto-generated file powerpc-vsx64l.c. */ + void init_registers_powerpc_vsx64l (void); - for (p = so->sections; p < so->sections_end; p++) - { -- struct target_so_ops *ops = solib_ops (target_gdbarch); -- - /* Relocate the section binding addresses as recorded in the shared - object's file by the base address to which the object was actually - mapped. */ -@@ -420,7 +425,9 @@ static int - symbol_add_stub (void *arg) - { - struct so_list *so = (struct so_list *) arg; /* catch_errs bogon */ -+ struct target_so_ops *ops = solib_ops (target_gdbarch); - struct section_addr_info *sap; -+ bfd *abfd = NULL; - - /* Have we already loaded this shared object? */ - ALL_OBJFILES (so->objfile) -@@ -429,11 +436,18 @@ symbol_add_stub (void *arg) - return 1; - } - -+ /* Open a second BFD for this file. */ -+ if (ops->open_bfd) -+ abfd = ops->open_bfd (so->so_name); -+ -+ if (!abfd) -+ abfd = symfile_bfd_open (so->so_name); -+ - sap = build_section_addr_info_from_section_table (so->sections, - so->sections_end); - -- so->objfile = symbol_file_add (so->so_name, so->from_tty, -- sap, 0, OBJF_SHARED); -+ so->objfile = symbol_file_add_from_bfd (abfd, so->from_tty, -+ sap, 0, OBJF_SHARED); - free_section_addr_info (sap); - - return (1); -Index: gdb-head/gdb/solist.h -=================================================================== ---- gdb-head.orig/gdb/solist.h -+++ gdb-head/gdb/solist.h -@@ -118,6 +118,10 @@ struct target_so_ops - and another from the list returned by current_sos, return 1 - if they represent the same library. */ - int (*same) (struct so_list *gdb, struct so_list *inferior); -+ -+ /* Extra hook for opening a BFD for a solib. Can be used to -+ retrieve solibs from inferior memory instead of from files. */ -+ bfd *(*open_bfd) (char *pathname); - }; - - /* Free the memory associated with a (so_list *). */ -Index: gdb-head/gdb/breakpoint.c -=================================================================== ---- gdb-head.orig/gdb/breakpoint.c -+++ gdb-head/gdb/breakpoint.c -@@ -1162,7 +1162,7 @@ Note: automatically using hardware break - bpt->overlay_target_info = bpt->target_info; - bpt->overlay_target_info.placed_address = addr; - val = target_insert_breakpoint (&bpt->overlay_target_info); -- if (val != 0) -+ if (val > 0) - fprintf_unfiltered (tmp_error_stream, - "Overlay breakpoint %d failed: in ROM?", - bpt->owner->number); -@@ -1185,6 +1185,14 @@ Note: automatically using hardware break - } - } - -+ if (val < 0) -+ { -+ /* The target could not insert the breakpoint right away due -+ to a temporary issue. No error, but do not mark the bp -+ as 'inserted'. */ -+ return 0; -+ } -+ - if (val) - { - /* Can't set the breakpoint. */ -@@ -1666,6 +1674,14 @@ remove_breakpoint (struct bp_location *b - } - } - -+ if (val < 0) -+ { -+ /* The target could not remove the breakpoint right away due -+ to a temporary issue. No error, but keep the bp marked -+ as 'inserted'. */ -+ return 0; -+ } -+ - /* In some cases, we might not be able to remove a breakpoint - in a shared library that has already been removed, but we - have not yet processed the shlib unload event. */ -@@ -7674,6 +7690,37 @@ breakpoint_re_set (void) - - create_overlay_event_breakpoint ("_ovly_debug_event"); +@@ -173,10 +178,72 @@ ppc_supply_ptrace_register (int regno, c + supply_register (regno, buf); } + + -+/* Update breakpoint location list after an object file was relocated. */ -+void -+breakpoint_relocate (struct objfile *objfile, struct section_offsets *delta) ++#define INSTR_SC 0x44000002 ++#define NR_spu_run 0x0116 ++ ++/* If the PPU thread is currently stopped on a spu_run system call, ++ return to FD and ADDR the file handle and NPC parameter address ++ used with the system call. Return non-zero if successful. */ ++static int ++parse_spufs_run (int *fd, CORE_ADDR *addr) +{ -+ struct bp_location *b; -+ struct obj_section *s; ++ CORE_ADDR curr_pc; ++ int curr_insn; ++ int curr_r0; + -+ /* Update the breakpoint addresses so that breakpoint_re_set has a chance -+ to identify the previous locations (to carry over enabled state). */ -+ ALL_BP_LOCATIONS (b) ++ if (register_size (0) == 4) + { -+ if (b->inserted || b->loc_type == bp_loc_other) -+ continue; -+ -+ ALL_OBJFILE_OSECTIONS (objfile, s) -+ { -+ CORE_ADDR offset = ANOFFSET (delta, s->the_bfd_section->index); -+ -+ if (b->address >= obj_section_addr (s) - offset -+ && b->address < obj_section_endaddr (s) - offset) -+ { -+ b->address += offset; -+ break; -+ } -+ } ++ unsigned int pc, r0, r3, r4; ++ collect_register_by_name ("pc", &pc); ++ collect_register_by_name ("r0", &r0); ++ collect_register_by_name ("orig_r3", &r3); ++ collect_register_by_name ("r4", &r4); ++ curr_pc = (CORE_ADDR) pc; ++ curr_r0 = (int) r0; ++ *fd = (int) r3; ++ *addr = (CORE_ADDR) r4; ++ } ++ else ++ { ++ unsigned long pc, r0, r3, r4; ++ collect_register_by_name ("pc", &pc); ++ collect_register_by_name ("r0", &r0); ++ collect_register_by_name ("orig_r3", &r3); ++ collect_register_by_name ("r4", &r4); ++ curr_pc = (CORE_ADDR) pc; ++ curr_r0 = (int) r0; ++ *fd = (int) r3; ++ *addr = (CORE_ADDR) r4; + } + -+ /* Now reset all breakpoints. */ -+ breakpoint_re_set (); ++ /* Fetch instruction preceding current NIP. */ ++ if ((*the_target->read_memory) (curr_pc - 4, ++ (unsigned char *) &curr_insn, 4) != 0) ++ return 0; ++ /* It should be a "sc" instruction. */ ++ if (curr_insn != INSTR_SC) ++ return 0; ++ /* System call number should be NR_spu_run. */ ++ if (curr_r0 != NR_spu_run) ++ return 0; ++ ++ return 1; +} - - /* Reset the thread number of this breakpoint: ++ + static CORE_ADDR + ppc_get_pc (void) + { +- if (register_size (0) == 4) ++ CORE_ADDR addr; ++ int fd; ++ ++ if (parse_spufs_run (&fd, &addr)) ++ { ++ unsigned int pc; ++ (*the_target->read_memory) (addr, (unsigned char *) &pc, 4); ++ return ((CORE_ADDR)1 << 63) | ((CORE_ADDR)fd << 32) | (CORE_ADDR) (pc - 4); ++ } ++ else if (register_size (0) == 4) + { + unsigned int pc; + collect_register_by_name ("pc", &pc); +@@ -193,7 +260,15 @@ ppc_get_pc (void) + static void + ppc_set_pc (CORE_ADDR pc) + { +- if (register_size (0) == 4) ++ CORE_ADDR addr; ++ int fd; ++ ++ if (parse_spufs_run (&fd, &addr)) ++ { ++ unsigned int newpc = pc; ++ (*the_target->write_memory) (addr, (unsigned char *) &newpc, 4); ++ } ++ else if (register_size (0) == 4) + { + unsigned int newpc = pc; + supply_register_by_name ("pc", &newpc); +@@ -259,7 +334,9 @@ ppc_arch_setup (void) + if (msr < 0) + { + ppc_get_hwcap (&ppc_hwcap); +- if (ppc_hwcap & PPC_FEATURE_HAS_VSX) ++ if (ppc_hwcap & PPC_FEATURE_CELL) ++ init_registers_powerpc_cell64l (); ++ else if (ppc_hwcap & PPC_FEATURE_HAS_VSX) + init_registers_powerpc_vsx64l (); + else if (ppc_hwcap & PPC_FEATURE_HAS_ALTIVEC) + init_registers_powerpc_altivec64l (); +@@ -271,7 +348,9 @@ ppc_arch_setup (void) + init_registers_powerpc_32l (); -Index: gdb-head/gdb/i386-nat.c -=================================================================== ---- gdb-head.orig/gdb/i386-nat.c -+++ gdb-head/gdb/i386-nat.c + ppc_get_hwcap (&ppc_hwcap); +- if (ppc_hwcap & PPC_FEATURE_HAS_VSX) ++ if (ppc_hwcap & PPC_FEATURE_CELL) ++ init_registers_powerpc_cell32l (); ++ else if (ppc_hwcap & PPC_FEATURE_HAS_VSX) + init_registers_powerpc_vsx32l (); + else if (ppc_hwcap & PPC_FEATURE_HAS_ALTIVEC) + init_registers_powerpc_altivec32l (); +@@ -300,11 +379,24 @@ ppc_breakpoint_at (CORE_ADDR where) + { + unsigned int insn; + +- (*the_target->read_memory) (where, (unsigned char *) &insn, 4); +- if (insn == ppc_breakpoint) +- return 1; +- /* If necessary, recognize more trap instructions here. GDB only uses the +- one. */ ++ if (where & ((CORE_ADDR)1 << 63)) ++ { ++ char mem_annex[32]; ++ sprintf (mem_annex, "%d/mem", (int)((where >> 32) & 0x7fffffff)); ++ (*the_target->qxfer_spu) (mem_annex, (unsigned char *) &insn, ++ NULL, where & 0xffffffff, 4); ++ if (insn == 0x3fff) ++ return 1; ++ } ++ else ++ { ++ (*the_target->read_memory) (where, (unsigned char *) &insn, 4); ++ if (insn == ppc_breakpoint) ++ return 1; ++ /* If necessary, recognize more trap instructions here. GDB only uses ++ the one. */ ++ } ++ + return 0; + } + +--- gdb-6.8.50.20081103-cvs/gdb/i386-nat.c ++++ gdb-6.8.50.20081103-cvs/gdb/i386-nat.c @@ -640,14 +640,14 @@ i386_insert_hw_breakpoint (struct bp_tar } @@ -2221,259 +2209,9 @@ Index: gdb-head/gdb/i386-nat.c if (maint_show_dr) i386_show_dr ("remove_hwbp", addr, 1, hw_execute); -Index: gdb-head/gdb/breakpoint.h -=================================================================== ---- gdb-head.orig/gdb/breakpoint.h -+++ gdb-head/gdb/breakpoint.h -@@ -690,6 +690,8 @@ extern int breakpoint_thread_match (CORE - - extern void until_break_command (char *, int, int); - -+extern void breakpoint_relocate (struct objfile *, struct section_offsets *); -+ - extern void breakpoint_re_set (void); - - extern void breakpoint_re_set_thread (struct breakpoint *); -Index: gdb-head/gdb/objfiles.c -=================================================================== ---- gdb-head.orig/gdb/objfiles.c -+++ gdb-head/gdb/objfiles.c -@@ -672,7 +672,7 @@ objfile_relocate (struct objfile *objfil - } - - /* Relocate breakpoints as necessary, after things are relocated. */ -- breakpoint_re_set (); -+ breakpoint_relocate (objfile, delta); - } - - /* Many places in gdb want to test just to see if we have any partial -Index: gdb-head/gdb/printcmd.c -=================================================================== ---- gdb-head.orig/gdb/printcmd.c -+++ gdb-head/gdb/printcmd.c -@@ -391,7 +391,7 @@ print_scalar_formatted (const void *vala - /* If we are printing it as unsigned, truncate it in case it is actually - a negative signed value (e.g. "print/u (short)-1" should print 65535 - (if shorts are 16 bits) instead of 4294967295). */ -- if (format != 'd') -+ if (format != 'd' || TYPE_UNSIGNED (type)) - { - if (len < sizeof (LONGEST)) - val_long &= ((LONGEST) 1 << HOST_CHAR_BIT * len) - 1; -Index: gdb-head/gdb/cli/cli-dump.c -=================================================================== ---- gdb-head.orig/gdb/cli/cli-dump.c -+++ gdb-head/gdb/cli/cli-dump.c -@@ -441,7 +441,7 @@ add_dump_command (char *name, void (*fun - - /* Opaque data for restore_section_callback. */ - struct callback_data { -- long load_offset; -+ CORE_ADDR load_offset; - CORE_ADDR load_start; - CORE_ADDR load_end; - }; -@@ -546,8 +546,8 @@ restore_binary_file (char *filename, str - printf_filtered - ("Restoring binary file %s into memory (0x%lx to 0x%lx)\n", - filename, -- (unsigned long) data->load_start + data->load_offset, -- (unsigned long) data->load_start + data->load_offset + len); -+ (unsigned long) (data->load_start + data->load_offset), -+ (unsigned long) (data->load_start + data->load_offset + len)); - - /* Now set the file pos to the requested load start pos. */ - if (fseek (file, data->load_start, SEEK_SET) != 0) -@@ -597,7 +597,7 @@ restore_command (char *args, int from_tt - /* Parse offset (optional). */ - if (args != NULL && *args != '\0') - data.load_offset = -- parse_and_eval_long (scan_expression_with_cleanup (&args, NULL)); -+ parse_and_eval_address (scan_expression_with_cleanup (&args, NULL)); - if (args != NULL && *args != '\0') - { - /* Parse start address (optional). */ -Index: gdb-head/gdb/utils.c -=================================================================== ---- gdb-head.orig/gdb/utils.c -+++ gdb-head/gdb/utils.c -@@ -2943,7 +2943,6 @@ core_addr_to_string_nz (const CORE_ADDR - CORE_ADDR - string_to_core_addr (const char *my_string) - { -- int addr_bit = gdbarch_addr_bit (current_gdbarch); - CORE_ADDR addr = 0; - - if (my_string[0] == '0' && tolower (my_string[1]) == 'x') -@@ -2959,17 +2958,6 @@ string_to_core_addr (const char *my_stri - else - error (_("invalid hex \"%s\""), my_string); - } -- -- /* Not very modular, but if the executable format expects -- addresses to be sign-extended, then do so if the address was -- specified with only 32 significant bits. Really this should -- be determined by the target architecture, not by the object -- file. */ -- if (i - 2 == addr_bit / 4 -- && exec_bfd -- && bfd_get_sign_extend_vma (exec_bfd)) -- addr = (addr ^ ((CORE_ADDR) 1 << (addr_bit - 1))) -- - ((CORE_ADDR) 1 << (addr_bit - 1)); - } - else - { -Index: gdb-head/gdb/varobj.c -=================================================================== ---- gdb-head.orig/gdb/varobj.c -+++ gdb-head/gdb/varobj.c -@@ -426,6 +426,8 @@ static struct frame_info * - find_frame_addr_in_frame_chain (CORE_ADDR frame_addr) - { - struct frame_info *frame = NULL; -+ CORE_ADDR frame_base; -+ int addr_bit; - - if (frame_addr == (CORE_ADDR) 0) - return NULL; -@@ -435,7 +437,17 @@ find_frame_addr_in_frame_chain (CORE_ADD - frame = get_prev_frame (frame); - if (frame == NULL) - return NULL; -- if (get_frame_base_address (frame) == frame_addr) -+ -+ /* The CORE_ADDR we get as argument was parsed from a string GDB -+ output as $fp. This output got truncated to gdbarch_addr_bit. -+ Truncate the frame base address in the same manner before -+ comparing it against our argument. */ -+ frame_base = get_frame_base_address (frame); -+ addr_bit = gdbarch_addr_bit (get_frame_arch (frame)); -+ if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT)) -+ frame_base &= ((CORE_ADDR) 1 << addr_bit) - 1; -+ -+ if (frame_base == frame_addr) - return frame; - } - } -Index: gdb-head/gdb/testsuite/gdb.base/dump.exp -=================================================================== ---- gdb-head.orig/gdb/testsuite/gdb.base/dump.exp -+++ gdb-head/gdb/testsuite/gdb.base/dump.exp -@@ -42,6 +42,12 @@ if {[istarget "ia64*-*-*"] || [istarget - set is64bitonly "yes" - } - -+if {[istarget "spu*-*-*"]} then { -+ # The internal address format used for the combined Cell/B.E. -+ # debugger required 64-bit. -+ set is64bitonly "yes" -+} -+ - if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable ${options}] != "" } { - untested dump.exp - return -1 -Index: gdb-head/gdb/avr-tdep.c -=================================================================== ---- gdb-head.orig/gdb/avr-tdep.c -+++ gdb-head/gdb/avr-tdep.c -@@ -278,7 +278,8 @@ avr_convert_saddr_to_raw (CORE_ADDR x) - /* Convert from address to pointer and vice-versa. */ - - static void --avr_address_to_pointer (struct type *type, gdb_byte *buf, CORE_ADDR addr) -+avr_address_to_pointer (struct gdbarch *gdbarch, -+ struct type *type, gdb_byte *buf, CORE_ADDR addr) - { - /* Is it a code address? */ - if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC -@@ -296,7 +297,8 @@ avr_address_to_pointer (struct type *typ - } - - static CORE_ADDR --avr_pointer_to_address (struct type *type, const gdb_byte *buf) -+avr_pointer_to_address (struct gdbarch *gdbarch, -+ struct type *type, const gdb_byte *buf) - { - CORE_ADDR addr = extract_unsigned_integer (buf, TYPE_LENGTH (type)); - -Index: gdb-head/gdb/findvar.c -=================================================================== ---- gdb-head.orig/gdb/findvar.c -+++ gdb-head/gdb/findvar.c -@@ -308,13 +308,15 @@ value_of_register_lazy (struct frame_inf - /* Given a pointer of type TYPE in target form in BUF, return the - address it represents. */ - CORE_ADDR --unsigned_pointer_to_address (struct type *type, const gdb_byte *buf) -+unsigned_pointer_to_address (struct gdbarch *gdbarch, -+ struct type *type, const gdb_byte *buf) - { - return extract_unsigned_integer (buf, TYPE_LENGTH (type)); - } - - CORE_ADDR --signed_pointer_to_address (struct type *type, const gdb_byte *buf) -+signed_pointer_to_address (struct gdbarch *gdbarch, -+ struct type *type, const gdb_byte *buf) - { - return extract_signed_integer (buf, TYPE_LENGTH (type)); - } -@@ -322,14 +324,15 @@ signed_pointer_to_address (struct type * - /* Given an address, store it as a pointer of type TYPE in target - format in BUF. */ - void --unsigned_address_to_pointer (struct type *type, gdb_byte *buf, -- CORE_ADDR addr) -+unsigned_address_to_pointer (struct gdbarch *gdbarch, struct type *type, -+ gdb_byte *buf, CORE_ADDR addr) - { - store_unsigned_integer (buf, TYPE_LENGTH (type), addr); - } - - void --address_to_signed_pointer (struct type *type, gdb_byte *buf, CORE_ADDR addr) -+address_to_signed_pointer (struct gdbarch *gdbarch, struct type *type, -+ gdb_byte *buf, CORE_ADDR addr) - { - store_signed_integer (buf, TYPE_LENGTH (type), addr); - } -Index: gdb-head/gdb/gdbarch.h -=================================================================== ---- gdb-head.orig/gdb/gdbarch.h -+++ gdb-head/gdb/gdbarch.h -@@ -348,11 +348,11 @@ typedef struct value * (gdbarch_value_fr - extern struct value * gdbarch_value_from_register (struct gdbarch *gdbarch, struct type *type, int regnum, struct frame_info *frame); - extern void set_gdbarch_value_from_register (struct gdbarch *gdbarch, gdbarch_value_from_register_ftype *value_from_register); - --typedef CORE_ADDR (gdbarch_pointer_to_address_ftype) (struct type *type, const gdb_byte *buf); -+typedef CORE_ADDR (gdbarch_pointer_to_address_ftype) (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf); - extern CORE_ADDR gdbarch_pointer_to_address (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf); - extern void set_gdbarch_pointer_to_address (struct gdbarch *gdbarch, gdbarch_pointer_to_address_ftype *pointer_to_address); - --typedef void (gdbarch_address_to_pointer_ftype) (struct type *type, gdb_byte *buf, CORE_ADDR addr); -+typedef void (gdbarch_address_to_pointer_ftype) (struct gdbarch *gdbarch, struct type *type, gdb_byte *buf, CORE_ADDR addr); - extern void gdbarch_address_to_pointer (struct gdbarch *gdbarch, struct type *type, gdb_byte *buf, CORE_ADDR addr); - extern void set_gdbarch_address_to_pointer (struct gdbarch *gdbarch, gdbarch_address_to_pointer_ftype *address_to_pointer); - -@@ -652,6 +652,13 @@ typedef LONGEST (gdbarch_core_xfer_share - extern LONGEST gdbarch_core_xfer_shared_libraries (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, LONGEST len); - extern void set_gdbarch_core_xfer_shared_libraries (struct gdbarch *gdbarch, gdbarch_core_xfer_shared_libraries_ftype *core_xfer_shared_libraries); - -+/* BFD target to use when generating a core file. */ -+ -+extern int gdbarch_gcore_bfd_target_p (struct gdbarch *gdbarch); -+ -+extern const char * gdbarch_gcore_bfd_target (struct gdbarch *gdbarch); -+extern void set_gdbarch_gcore_bfd_target (struct gdbarch *gdbarch, const char * gcore_bfd_target); -+ - /* If the elements of C++ vtables are in-place function descriptors rather - than normal function pointers (which may point to code or a descriptor), - set this to one. */ -Index: gdb-head/gdb/inferior.h -=================================================================== ---- gdb-head.orig/gdb/inferior.h -+++ gdb-head/gdb/inferior.h -@@ -154,13 +154,17 @@ extern CORE_ADDR read_pc (void); +--- gdb-6.8.50.20081103-cvs/gdb/inferior.h ++++ gdb-6.8.50.20081103-cvs/gdb/inferior.h +@@ -146,13 +146,17 @@ extern CORE_ADDR read_pc (void); extern void write_pc (CORE_ADDR); @@ -2495,10 +2233,8 @@ Index: gdb-head/gdb/inferior.h CORE_ADDR addr); extern void wait_for_inferior (int treat_exec_as_sigtrap); -Index: gdb-head/gdb/iq2000-tdep.c -=================================================================== ---- gdb-head.orig/gdb/iq2000-tdep.c -+++ gdb-head/gdb/iq2000-tdep.c +--- gdb-6.8.50.20081103-cvs/gdb/iq2000-tdep.c ++++ gdb-6.8.50.20081103-cvs/gdb/iq2000-tdep.c @@ -86,7 +86,8 @@ insn_addr_from_ptr (CORE_ADDR ptr) /* ta Convert a target pointer to an address in host (CORE_ADDR) format. */ @@ -2519,10 +2255,274 @@ Index: gdb-head/gdb/iq2000-tdep.c { enum type_code target = TYPE_CODE (TYPE_TARGET_TYPE (type)); -Index: gdb-head/gdb/m32c-tdep.c -=================================================================== ---- gdb-head.orig/gdb/m32c-tdep.c -+++ gdb-head/gdb/m32c-tdep.c +--- gdb-6.8.50.20081103-cvs/gdb/linux-nat.c ++++ gdb-6.8.50.20081103-cvs/gdb/linux-nat.c +@@ -49,6 +49,12 @@ + #include "inf-loop.h" + #include "event-loop.h" + #include "event-top.h" ++#include /* for struct statfs */ ++#include /* for DIR etc. */ ++ ++#ifndef SPUFS_MAGIC ++#define SPUFS_MAGIC 0x23c9b64e ++#endif + + #ifdef HAVE_PERSONALITY + # include +@@ -3410,8 +3416,8 @@ linux_nat_do_thread_registers (bfd *obfd + gdb_gregset_t gregs; + gdb_fpregset_t fpregs; + unsigned long lwp = ptid_get_lwp (ptid); +- struct regcache *regcache = get_thread_regcache (ptid); +- struct gdbarch *gdbarch = get_regcache_arch (regcache); ++ struct gdbarch *gdbarch = target_gdbarch; ++ struct regcache *regcache = get_thread_arch_regcache (ptid, gdbarch); + const struct regset *regset; + int core_regset_p; + struct cleanup *old_chain; +@@ -3521,6 +3527,119 @@ linux_nat_corefile_thread_callback (stru + return 0; + } + ++/* Enumerate spufs IDs for process PID. */ ++ ++static void ++iterate_over_spus (int pid, void (*callback) (void *, int), void *data) ++{ ++ char path[128]; ++ DIR *dir; ++ struct dirent *entry; ++ ++ xsnprintf (path, sizeof path, "/proc/%d/fd", pid); ++ dir = opendir (path); ++ if (!dir) ++ return; ++ ++ rewinddir (dir); ++ while ((entry = readdir (dir)) != NULL) ++ { ++ struct stat st; ++ struct statfs stfs; ++ int fd; ++ ++ fd = atoi (entry->d_name); ++ if (!fd) ++ continue; ++ ++ xsnprintf (path, sizeof path, "/proc/%d/fd/%d", pid, fd); ++ if (stat (path, &st) != 0) ++ continue; ++ if (!S_ISDIR (st.st_mode)) ++ continue; ++ ++ if (statfs (path, &stfs) != 0) ++ continue; ++ if (stfs.f_type != SPUFS_MAGIC) ++ continue; ++ ++ callback (data, fd); ++ } ++ ++ closedir (dir); ++} ++ ++/* Generate corefile notes for SPU contexts. */ ++ ++struct linux_spu_corefile_data ++{ ++ bfd *obfd; ++ char *note_data; ++ int *note_size; ++}; ++ ++static void ++linux_spu_corefile_callback (void *data, int fd) ++{ ++ struct linux_spu_corefile_data *args = data; ++ int i; ++ ++ static const char *spu_files[] = ++ { ++ "object-id", ++ "mem", ++ "regs", ++ "fpcr", ++ "lslr", ++ "decr", ++ "decr_status", ++ "signal1", ++ "signal1_type", ++ "signal2", ++ "signal2_type", ++ "event_mask", ++ "event_status", ++ "mbox_info", ++ "ibox_info", ++ "wbox_info", ++ "dma_info", ++ "proxydma_info", ++ }; ++ ++ for (i = 0; i < sizeof (spu_files) / sizeof (spu_files[0]); i++) ++ { ++ char annex[32], note_name[32]; ++ gdb_byte *spu_data; ++ LONGEST spu_len; ++ ++ xsnprintf (annex, sizeof annex, "%d/%s", fd, spu_files[i]); ++ spu_len = target_read_alloc (¤t_target, TARGET_OBJECT_SPU, ++ annex, &spu_data); ++ if (spu_len > 0) ++ { ++ xsnprintf (note_name, sizeof note_name, "SPU/%s", annex); ++ args->note_data = elfcore_write_note (args->obfd, args->note_data, ++ args->note_size, note_name, ++ NT_SPU, spu_data, spu_len); ++ xfree (spu_data); ++ } ++ } ++} ++ ++static char * ++linux_spu_make_corefile_notes (bfd *obfd, char *note_data, int *note_size) ++{ ++ struct linux_spu_corefile_data args; ++ args.obfd = obfd; ++ args.note_data = note_data; ++ args.note_size = note_size; ++ ++ iterate_over_spus (PIDGET (inferior_ptid), ++ linux_spu_corefile_callback, &args); ++ ++ return args.note_data; ++} ++ + /* Fills the "to_make_corefile_note" target vector. Builds the note + section for a corefile, and returns it in a malloc buffer. */ + +@@ -3581,6 +3700,8 @@ linux_nat_make_corefile_notes (bfd *obfd + xfree (auxv); + } + ++ note_data = linux_spu_make_corefile_notes (obfd, note_data, note_size); ++ + make_cleanup (xfree, note_data); + return note_data; + } +@@ -3910,6 +4031,99 @@ linux_proc_xfer_partial (struct target_o + return ret; + } + ++ ++/* Enumerate spufs IDs for process PID. */ ++static LONGEST ++spu_enumerate_spu_ids (int pid, gdb_byte *buf, ULONGEST offset, LONGEST len) ++{ ++ LONGEST pos = 0; ++ LONGEST written = 0; ++ char path[128]; ++ DIR *dir; ++ struct dirent *entry; ++ ++ xsnprintf (path, sizeof path, "/proc/%d/fd", pid); ++ dir = opendir (path); ++ if (!dir) ++ return -1; ++ ++ rewinddir (dir); ++ while ((entry = readdir (dir)) != NULL) ++ { ++ struct stat st; ++ struct statfs stfs; ++ int fd; ++ ++ fd = atoi (entry->d_name); ++ if (!fd) ++ continue; ++ ++ xsnprintf (path, sizeof path, "/proc/%d/fd/%d", pid, fd); ++ if (stat (path, &st) != 0) ++ continue; ++ if (!S_ISDIR (st.st_mode)) ++ continue; ++ ++ if (statfs (path, &stfs) != 0) ++ continue; ++ if (stfs.f_type != SPUFS_MAGIC) ++ continue; ++ ++ if (pos >= offset && pos + 4 <= offset + len) ++ { ++ store_unsigned_integer (buf + pos - offset, 4, fd); ++ written += 4; ++ } ++ pos += 4; ++ } ++ ++ closedir (dir); ++ return written; ++} ++ ++/* Implement the to_xfer_partial interface for the TARGET_OBJECT_SPU ++ object type, using the /proc file system. */ ++static LONGEST ++linux_proc_xfer_spu (struct target_ops *ops, enum target_object object, ++ const char *annex, gdb_byte *readbuf, ++ const gdb_byte *writebuf, ++ ULONGEST offset, LONGEST len) ++{ ++ char buf[128]; ++ int fd = 0; ++ int ret = -1; ++ int pid = PIDGET (inferior_ptid); ++ ++ if (!annex) ++ { ++ if (!readbuf) ++ return -1; ++ else ++ return spu_enumerate_spu_ids (pid, readbuf, offset, len); ++ } ++ ++ xsnprintf (buf, sizeof buf, "/proc/%d/fd/%s", pid, annex); ++ fd = open (buf, writebuf? O_WRONLY : O_RDONLY); ++ if (fd <= 0) ++ return -1; ++ ++ if (offset != 0 ++ && lseek (fd, (off_t) offset, SEEK_SET) != (off_t) offset) ++ { ++ close (fd); ++ return 0; ++ } ++ ++ if (writebuf) ++ ret = write (fd, writebuf, (size_t) len); ++ else if (readbuf) ++ ret = read (fd, readbuf, (size_t) len); ++ ++ close (fd); ++ return ret; ++} ++ ++ + /* Parse LINE as a signal set and add its set bits to SIGS. */ + + static void +@@ -4004,6 +4218,10 @@ linux_xfer_partial (struct target_ops *o + return procfs_xfer_auxv (ops, object, annex, readbuf, writebuf, + offset, len); + ++ if (object == TARGET_OBJECT_SPU) ++ return linux_proc_xfer_spu (ops, object, annex, readbuf, writebuf, ++ offset, len); ++ + xfer = linux_proc_xfer_partial (ops, object, annex, readbuf, writebuf, + offset, len); + if (xfer != 0) +--- gdb-6.8.50.20081103-cvs/gdb/m32c-tdep.c ++++ gdb-6.8.50.20081103-cvs/gdb/m32c-tdep.c @@ -2397,7 +2397,8 @@ m32c_skip_trampoline_code (struct frame_ programmer! :) */ @@ -2543,817 +2543,54 @@ Index: gdb-head/gdb/m32c-tdep.c { CORE_ADDR ptr; enum type_code target_code; -Index: gdb-head/gdb/spu-tdep.c -=================================================================== ---- gdb-head.orig/gdb/spu-tdep.c -+++ gdb-head/gdb/spu-tdep.c -@@ -40,14 +40,31 @@ - #include "regcache.h" - #include "reggroups.h" - #include "floatformat.h" -+#include "block.h" - #include "observer.h" -+#include "infcall.h" - - #include "spu-tdep.h" - - -+/* The list of available "set spu " and "show spu " commands. */ -+static struct cmd_list_element *setspucmdlist = NULL; -+static struct cmd_list_element *showspucmdlist = NULL; -+ -+/* Whether to stop for new SPE contexts. */ -+static int spu_stop_on_load_p = 0; -+/* Whether to automatically flush the SW-managed cache. */ -+static int spu_auto_flush_cache_p = 1; -+ -+ - /* The tdep structure. */ - struct gdbarch_tdep - { -+ /* The spufs ID identifying our address space. */ -+ int id; -+ /* The size of this address space. */ -+ CORE_ADDR lslr; -+ - /* SPU-specific vector type. */ - struct type *spu_builtin_type_vec128; - }; -@@ -324,33 +341,87 @@ spu_register_reggroup_p (struct gdbarch - return default_register_reggroup_p (gdbarch, regnum, group); - } - --/* Address conversion. */ -+ -+/* Address handling. */ -+ -+static CORE_ADDR -+spu_lslr (int id) -+{ -+ gdb_byte buf[16]; -+ char annex[32]; -+ -+ xsnprintf (annex, sizeof annex, "%d/lslr", id); -+ memset (buf, 0, sizeof buf); -+ target_read (¤t_target, TARGET_OBJECT_SPU, annex, -+ buf, 0, sizeof buf); -+ -+ return strtoulst (buf, NULL, 16); -+} -+ -+static int -+spu_address_class_type_flags (int byte_size, int dwarf2_addr_class) -+{ -+ if (dwarf2_addr_class == 1) -+ return TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1; -+ else -+ return 0; -+} -+ -+static const char * -+spu_address_class_type_flags_to_name (struct gdbarch *gdbarch, int type_flags) -+{ -+ if (type_flags & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1) -+ return "__ea"; -+ else -+ return NULL; -+} -+ -+static int -+spu_address_class_name_to_type_flags (struct gdbarch *gdbarch, -+ const char *name, int *type_flags_ptr) -+{ -+ if (strcmp (name, "__ea") == 0) -+ { -+ *type_flags_ptr = TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1; -+ return 1; -+ } -+ else -+ return 0; -+} -+ -+static void -+spu_address_to_pointer (struct gdbarch *gdbarch, -+ struct type *type, gdb_byte *buf, CORE_ADDR addr) -+{ -+ store_unsigned_integer (buf, TYPE_LENGTH (type), SPUADDR_ADDR (addr)); -+} - - static CORE_ADDR --spu_pointer_to_address (struct type *type, const gdb_byte *buf) -+spu_pointer_to_address (struct gdbarch *gdbarch, -+ struct type *type, const gdb_byte *buf) - { -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - ULONGEST addr = extract_unsigned_integer (buf, TYPE_LENGTH (type)); -- ULONGEST lslr = SPU_LS_SIZE - 1; /* Hard-wired LS size. */ - -- if (target_has_registers && target_has_stack && target_has_memory) -- lslr = get_frame_register_unsigned (get_selected_frame (NULL), -- SPU_LSLR_REGNUM); -+ /* Do not convert __ea pointers. */ -+ if (TYPE_ADDRESS_CLASS_1 (type)) -+ return addr; - -- return addr & lslr; -+ return addr? SPUADDR (tdep->id, addr & tdep->lslr) : 0; - } - - static CORE_ADDR - spu_integer_to_address (struct gdbarch *gdbarch, - struct type *type, const gdb_byte *buf) - { -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - ULONGEST addr = unpack_long (type, buf); -- ULONGEST lslr = SPU_LS_SIZE - 1; /* Hard-wired LS size. */ - -- if (target_has_registers && target_has_stack && target_has_memory) -- lslr = get_frame_register_unsigned (get_selected_frame (NULL), -- SPU_LSLR_REGNUM); -+ /* Do not convert __ea pointers. */ -+ if (TYPE_ADDRESS_CLASS_1 (type)) -+ return addr; - -- return addr & lslr; -+ return SPUADDR (tdep->id, addr & tdep->lslr); - } - - -@@ -840,8 +911,11 @@ static struct spu_unwind_cache * - spu_frame_unwind_cache (struct frame_info *this_frame, - void **this_prologue_cache) - { -+ struct gdbarch *gdbarch = get_frame_arch (this_frame); -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - struct spu_unwind_cache *info; - struct spu_prologue_data data; -+ CORE_ADDR id = tdep->id; - gdb_byte buf[16]; - - if (*this_prologue_cache) -@@ -874,6 +948,7 @@ spu_frame_unwind_cache (struct frame_inf - /* Determine CFA via unwound CFA_REG plus CFA_OFFSET. */ - get_frame_register (this_frame, data.cfa_reg, buf); - cfa = extract_unsigned_integer (buf, 4) + data.cfa_offset; -+ cfa = SPUADDR (id, cfa); - - /* Call-saved register slots. */ - for (i = 0; i < SPU_NUM_GPRS; i++) -@@ -896,7 +971,7 @@ spu_frame_unwind_cache (struct frame_inf - - /* Get the backchain. */ - reg = get_frame_register_unsigned (this_frame, SPU_SP_REGNUM); -- status = safe_read_memory_integer (reg, 4, &backchain); -+ status = safe_read_memory_integer (SPUADDR (id, reg), 4, &backchain); - - /* A zero backchain terminates the frame chain. Also, sanity - check against the local store size limit. */ -@@ -904,11 +979,11 @@ spu_frame_unwind_cache (struct frame_inf - { - /* Assume the link register is saved into its slot. */ - if (backchain + 16 < SPU_LS_SIZE) -- info->saved_regs[SPU_LR_REGNUM].addr = backchain + 16; -+ info->saved_regs[SPU_LR_REGNUM].addr = SPUADDR (id, backchain + 16); - - /* Frame bases. */ -- info->frame_base = backchain; -- info->local_base = reg; -+ info->frame_base = SPUADDR (id, backchain); -+ info->local_base = SPUADDR (id, reg); - } +--- gdb-6.8.50.20081103-cvs/gdb/objfiles.c ++++ gdb-6.8.50.20081103-cvs/gdb/objfiles.c +@@ -672,7 +672,7 @@ objfile_relocate (struct objfile *objfil } -@@ -917,7 +992,8 @@ spu_frame_unwind_cache (struct frame_inf - return info; - - /* The previous SP is equal to the CFA. */ -- trad_frame_set_value (info->saved_regs, SPU_SP_REGNUM, info->frame_base); -+ trad_frame_set_value (info->saved_regs, SPU_SP_REGNUM, -+ SPUADDR_ADDR (info->frame_base)); - - /* Read full contents of the unwound link register in order to - be able to determine the return address. */ -@@ -995,24 +1071,28 @@ static const struct frame_base spu_frame - static CORE_ADDR - spu_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) - { -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - CORE_ADDR pc = frame_unwind_register_unsigned (next_frame, SPU_PC_REGNUM); - /* Mask off interrupt enable bit. */ -- return pc & -4; -+ return SPUADDR (tdep->id, pc & -4); + /* Relocate breakpoints as necessary, after things are relocated. */ +- breakpoint_re_set (); ++ breakpoint_relocate (objfile, delta); } + + /* Many places in gdb want to test just to see if we have any partial +--- gdb-6.8.50.20081103-cvs/gdb/ppc-linux-nat.c ++++ gdb-6.8.50.20081103-cvs/gdb/ppc-linux-nat.c +@@ -56,6 +56,10 @@ + #define PT_TRAP 40 + #endif - static CORE_ADDR - spu_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame) - { -- return frame_unwind_register_unsigned (next_frame, SPU_SP_REGNUM); -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ CORE_ADDR sp = frame_unwind_register_unsigned (next_frame, SPU_SP_REGNUM); -+ return SPUADDR (tdep->id, sp); - } ++#ifndef PPC_FEATURE_CELL ++#define PPC_FEATURE_CELL 0x00010000 ++#endif ++ + #ifndef PPC_FEATURE_BOOKE + #define PPC_FEATURE_BOOKE 0x00008000 + #endif +@@ -1283,7 +1287,9 @@ ppc_linux_read_description (struct targe + msr = (long) ptrace (PTRACE_PEEKUSER, tid, PT_MSR * 8, 0); + if (errno == 0 && msr < 0) + { +- if (vsx) ++ if (ppc_linux_get_hwcap () & PPC_FEATURE_CELL) ++ return tdesc_powerpc_cell64l; ++ else if (vsx) + return tdesc_powerpc_vsx64l; + else if (altivec) + return tdesc_powerpc_altivec64l; +@@ -1293,7 +1299,9 @@ ppc_linux_read_description (struct targe + } + #endif - static CORE_ADDR - spu_read_pc (struct regcache *regcache) - { -+ struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache)); - ULONGEST pc; - regcache_cooked_read_unsigned (regcache, SPU_PC_REGNUM, &pc); - /* Mask off interrupt enable bit. */ -- return pc & -4; -+ return SPUADDR (tdep->id, pc & -4); - } - - static void -@@ -1022,9 +1102,111 @@ spu_write_pc (struct regcache *regcache, - ULONGEST old_pc; - regcache_cooked_read_unsigned (regcache, SPU_PC_REGNUM, &old_pc); - regcache_cooked_write_unsigned (regcache, SPU_PC_REGNUM, -- (pc & -4) | (old_pc & 3)); -+ (SPUADDR_ADDR (pc) & -4) | (old_pc & 3)); -+} -+ -+ -+/* Cell/B.E. cross-architecture unwinder support. */ -+ -+struct spu2ppu_cache -+{ -+ struct frame_id frame_id; -+ struct regcache *regcache; -+}; -+ -+static struct gdbarch * -+spu2ppu_prev_arch (struct frame_info *this_frame, void **this_cache) -+{ -+ struct spu2ppu_cache *cache = *this_cache; -+ return get_regcache_arch (cache->regcache); -+} -+ -+static void -+spu2ppu_this_id (struct frame_info *this_frame, -+ void **this_cache, struct frame_id *this_id) -+{ -+ struct spu2ppu_cache *cache = *this_cache; -+ *this_id = cache->frame_id; -+} -+ -+static struct value * -+spu2ppu_prev_register (struct frame_info *this_frame, -+ void **this_cache, int regnum) -+{ -+ struct spu2ppu_cache *cache = *this_cache; -+ struct gdbarch *gdbarch = get_regcache_arch (cache->regcache); -+ gdb_byte *buf; -+ -+ buf = alloca (register_size (gdbarch, regnum)); -+ regcache_cooked_read (cache->regcache, regnum, buf); -+ return frame_unwind_got_bytes (this_frame, regnum, buf); -+} -+ -+static int -+spu2ppu_sniffer (const struct frame_unwind *self, -+ struct frame_info *this_frame, void **this_prologue_cache) -+{ -+ CORE_ADDR base, func, backchain; -+ gdb_byte buf[4]; -+ -+ if (gdbarch_bfd_arch_info (target_gdbarch)->arch == bfd_arch_spu) -+ return 0; -+ -+ base = get_frame_sp (this_frame); -+ func = get_frame_pc (this_frame); -+ if (target_read_memory (base, buf, 4)) -+ return 0; -+ backchain = extract_unsigned_integer (buf, 4); -+ -+ if (!backchain) -+ { -+ struct frame_info *fi; -+ -+ struct spu2ppu_cache *cache -+ = FRAME_OBSTACK_CALLOC (1, struct spu2ppu_cache); -+ -+ cache->frame_id = frame_id_build (base + 16, func); -+ -+ for (fi = get_next_frame (this_frame); fi; fi = get_next_frame (fi)) -+ if (gdbarch_bfd_arch_info (get_frame_arch (fi))->arch != bfd_arch_spu) -+ break; -+ -+ if (fi) -+ { -+ cache->regcache = frame_save_as_regcache (fi); -+ *this_prologue_cache = cache; -+ return 1; -+ } -+ else -+ { -+ struct regcache *regcache; -+ regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch); -+ cache->regcache = regcache_dup (regcache); -+ *this_prologue_cache = cache; -+ return 1; -+ } -+ } -+ -+ return 0; - } - -+static void -+spu2ppu_dealloc_cache (struct frame_info *self, void *this_cache) -+{ -+ struct spu2ppu_cache *cache = this_cache; -+ regcache_xfree (cache->regcache); -+} -+ -+static const struct frame_unwind spu2ppu_unwind = { -+ ARCH_FRAME, -+ spu2ppu_this_id, -+ spu2ppu_prev_register, -+ NULL, -+ spu2ppu_sniffer, -+ spu2ppu_dealloc_cache, -+ spu2ppu_prev_arch, -+}; -+ - - /* Function calling convention. */ - -@@ -1133,7 +1315,7 @@ spu_push_dummy_call (struct gdbarch *gdb - - /* Set the return address. */ - memset (buf, 0, sizeof buf); -- store_unsigned_integer (buf, 4, bp_addr); -+ store_unsigned_integer (buf, 4, SPUADDR_ADDR (bp_addr)); - regcache_cooked_write (regcache, SPU_LR_REGNUM, buf); - - /* If STRUCT_RETURN is true, then the struct return address (in -@@ -1142,7 +1324,7 @@ spu_push_dummy_call (struct gdbarch *gdb - if (struct_return) - { - memset (buf, 0, sizeof buf); -- store_unsigned_integer (buf, 4, struct_addr); -+ store_unsigned_integer (buf, 4, SPUADDR_ADDR (struct_addr)); - regcache_cooked_write (regcache, regnum++, buf); - } - -@@ -1220,9 +1402,10 @@ spu_push_dummy_call (struct gdbarch *gdb - static struct frame_id - spu_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame) - { -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - CORE_ADDR pc = get_frame_register_unsigned (this_frame, SPU_PC_REGNUM); - CORE_ADDR sp = get_frame_register_unsigned (this_frame, SPU_SP_REGNUM); -- return frame_id_build (sp, pc & -4); -+ return frame_id_build (SPUADDR (tdep->id, sp), SPUADDR (tdep->id, pc & -4)); - } - - /* Function return value access. */ -@@ -1302,18 +1485,18 @@ spu_software_single_step (struct frame_i - instruction is a PPE-assisted call, in which case it is at PC + 8. - Wrap around LS limit to be on the safe side. */ - if ((insn & 0xffffff00) == 0x00002100) -- next_pc = (pc + 8) & (SPU_LS_SIZE - 1); -+ next_pc = (SPUADDR_ADDR (pc) + 8) & (SPU_LS_SIZE - 1); - else -- next_pc = (pc + 4) & (SPU_LS_SIZE - 1); -+ next_pc = (SPUADDR_ADDR (pc) + 4) & (SPU_LS_SIZE - 1); - -- insert_single_step_breakpoint (next_pc); -+ insert_single_step_breakpoint (SPUADDR (SPUADDR_SPU (pc), next_pc)); - - if (is_branch (insn, &offset, ®)) - { - CORE_ADDR target = offset; - - if (reg == SPU_PC_REGNUM) -- target += pc; -+ target += SPUADDR_ADDR (pc); - else if (reg != -1) - { - get_frame_register_bytes (frame, reg, 0, 4, buf); -@@ -1322,12 +1505,35 @@ spu_software_single_step (struct frame_i - - target = target & (SPU_LS_SIZE - 1); - if (target != next_pc) -- insert_single_step_breakpoint (target); -+ insert_single_step_breakpoint (SPUADDR (SPUADDR_SPU (pc), target)); - } - - return 1; - } - -+ -+/* Disassembler. */ -+ -+static void -+spu_dis_asm_print_address (bfd_vma addr, struct disassemble_info *info) -+{ -+ int id = *(int *)info->application_data; -+ CORE_ADDR spu_addr = SPUADDR (id, addr); -+ print_address (spu_addr, info->stream); -+} -+ -+static int -+gdb_print_insn_spu (bfd_vma memaddr, disassemble_info * info) -+{ -+ /* The opcodes disassembler does 18-bit address arithmetic. Make sure the -+ SPU ID encoded in the high bits is added back when we call print_address. */ -+ int id = SPUADDR_SPU (memaddr); -+ info->application_data = &id; -+ info->print_address_func = spu_dis_asm_print_address; -+ return print_insn_spu (memaddr, info); -+} -+ -+ - /* Target overlays for the SPU overlay manager. - - See the documentation of simple_overlay_update for how the -@@ -1444,7 +1650,7 @@ static void - spu_overlay_update_osect (struct obj_section *osect) - { - struct spu_overlay_table *ovly_table; -- CORE_ADDR val; -+ CORE_ADDR id, val; - - ovly_table = spu_get_overlay_table (osect->objfile); - if (!ovly_table) -@@ -1454,7 +1660,8 @@ spu_overlay_update_osect (struct obj_sec - if (ovly_table->mapped_ptr == 0) - return; - -- val = read_memory_unsigned_integer (ovly_table->mapped_ptr, 4); -+ id = SPUADDR_SPU (obj_section_addr (osect)); -+ val = read_memory_unsigned_integer (SPUADDR (id, ovly_table->mapped_ptr), 4); - osect->ovly_mapped = (val == ovly_table->mapped_val); - } - -@@ -1516,6 +1723,131 @@ spu_overlay_new_objfile (struct objfile - } - - -+/* Insert temporary breakpoint on "main" function of newly loaded -+ SPE context OBJFILE. */ -+static void -+spu_catch_start (struct objfile *objfile) -+{ -+ struct minimal_symbol *minsym; -+ struct symtab *symtab; -+ CORE_ADDR pc; -+ char buf[32]; -+ -+ /* Do this only if requested by "set spu stop-on-load on". */ -+ if (!spu_stop_on_load_p) -+ return; -+ -+ /* Consider only SPU objfiles. */ -+ if (!objfile || bfd_get_arch (objfile->obfd) != bfd_arch_spu) -+ return; -+ -+ /* The main objfile is handled differently. */ -+ if (objfile == symfile_objfile) -+ return; -+ -+ /* There can be multiple symbols named "main". Search for the -+ "main" in *this* objfile. */ -+ minsym = lookup_minimal_symbol ("main", NULL, objfile); -+ if (!minsym) -+ return; -+ -+ /* If we have debugging information, try to use it -- this -+ will allow us to properly skip the prologue. */ -+ pc = SYMBOL_VALUE_ADDRESS (minsym); -+ symtab = find_pc_sect_symtab (pc, SYMBOL_OBJ_SECTION (minsym)); -+ if (symtab != NULL) -+ { -+ struct blockvector *bv = BLOCKVECTOR (symtab); -+ struct block *block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK); -+ struct symbol *sym; -+ struct symtab_and_line sal; -+ -+ sym = lookup_block_symbol (block, "main", NULL, VAR_DOMAIN); -+ if (sym) -+ { -+ fixup_symbol_section (sym, objfile); -+ sal = find_function_start_sal (sym, 1); -+ pc = sal.pc; -+ } -+ } -+ -+ /* Use a numerical address for the tbreak command to avoid having -+ the breakpoint re-set incorrectly. */ -+ xsnprintf (buf, sizeof buf, "*%s", core_addr_to_string (pc)); -+ tbreak_command (buf, 0); -+} -+ -+/* Lookup OBJFILE corresponding to the current SPU context. */ -+static struct objfile * -+spu_objfile_from_context (void) -+{ -+ struct frame_info *frame = get_current_frame (); -+ struct gdbarch *gdbarch = get_frame_arch (frame); -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ struct objfile *obj; -+ -+ if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_spu) -+ return NULL; -+ -+ ALL_OBJFILES (obj) -+ { -+ if (obj->sections != obj->sections_end -+ && SPUADDR_SPU (obj_section_addr (obj->sections)) == tdep->id) -+ return obj; -+ } -+ -+ return NULL; -+} -+ -+/* Flush cache for ea pointer access if available and return 1. Return 0 if -+ inferior call was not executed. */ -+static void -+flush_ea_cache (void) -+{ -+ struct value *ea_flush_fn = NULL; -+ struct minimal_symbol *msymbol; -+ struct objfile *obj; -+ -+ obj = spu_objfile_from_context (); -+ if (obj == NULL) -+ return; -+ -+ /* Lookup inferior function __cache_flush. */ -+ msymbol = lookup_minimal_symbol ("__cache_flush", NULL, obj); -+ if (msymbol != NULL) -+ { -+ struct type *type; -+ CORE_ADDR addr; -+ -+ type = builtin_type_void; -+ type = lookup_function_type (type); -+ type = lookup_pointer_type (type); -+ addr = SYMBOL_VALUE_ADDRESS (msymbol); -+ ea_flush_fn = value_from_pointer (type, addr); -+ } -+ -+ if (ea_flush_fn) -+ call_function_by_hand (ea_flush_fn, 0, NULL); -+} -+ -+/* This handler is called when the inferior has stopped. If it is stopped in -+ SPU architecture then flush the ea cache if used. */ -+static void -+spu_attach_normal_stop (struct bpstats *bs) -+{ -+ if (!spu_auto_flush_cache_p) -+ return; -+ -+ if (!target_has_registers || !target_has_stack || !target_has_memory) -+ return; -+ -+ /* Temporarily reset the spu_auto_flush_cache_p to avoid recursively -+ re-entering this function when __cache_flush stops. */ -+ spu_auto_flush_cache_p = 0; -+ flush_ea_cache (); -+ spu_auto_flush_cache_p = 1; -+} -+ - /* "info spu" commands. */ - - static void -@@ -2065,6 +2397,37 @@ info_spu_command (char *args, int from_t - } - - -+/* Root of all "set spu "/"show spu " commands. */ -+ -+static void -+show_spu_command (char *args, int from_tty) -+{ -+ help_list (showspucmdlist, "show spu ", all_commands, gdb_stdout); -+} -+ -+static void -+set_spu_command (char *args, int from_tty) -+{ -+ help_list (setspucmdlist, "set spu ", all_commands, gdb_stdout); -+} -+ -+static void -+show_spu_stop_on_load (struct ui_file *file, int from_tty, -+ struct cmd_list_element *c, const char *value) -+{ -+ fprintf_filtered (file, _("Stopping for new SPE threads is %s.\n"), -+ value); -+} -+ -+static void -+show_spu_auto_flush_cache (struct ui_file *file, int from_tty, -+ struct cmd_list_element *c, const char *value) -+{ -+ fprintf_filtered (file, _("Automatic software-cache flush is %s.\n"), -+ value); -+} -+ -+ - /* Set up gdbarch struct. */ - - static struct gdbarch * -@@ -2072,22 +2435,30 @@ spu_gdbarch_init (struct gdbarch_info in - { - struct gdbarch *gdbarch; - struct gdbarch_tdep *tdep; -+ int id = -1; - -- /* Find a candidate among the list of pre-declared architectures. */ -- arches = gdbarch_list_lookup_by_info (arches, &info); -- if (arches != NULL) -- return arches->gdbarch; -+ /* Which spufs ID was requested as address space? */ -+ if (info.tdep_info) -+ id = *(int *)info.tdep_info; - -- /* Is is for us? */ -- if (info.bfd_arch_info->mach != bfd_mach_spu) -- return NULL; -+ /* Find a candidate among extant architectures. */ -+ for (arches = gdbarch_list_lookup_by_info (arches, &info); -+ arches != NULL; -+ arches = gdbarch_list_lookup_by_info (arches->next, &info)) -+ { -+ tdep = gdbarch_tdep (arches->gdbarch); -+ if (tdep && tdep->id == id) -+ return arches->gdbarch; -+ } - -- /* Yes, create a new architecture. */ -+ /* None found, so create a new architecture. */ - tdep = XCALLOC (1, struct gdbarch_tdep); -+ tdep->id = id; -+ tdep->lslr = id != -1? spu_lslr (id) : SPU_LS_SIZE - 1; - gdbarch = gdbarch_alloc (&info, tdep); - - /* Disassembler. */ -- set_gdbarch_print_insn (gdbarch, print_insn_spu); -+ set_gdbarch_print_insn (gdbarch, gdb_print_insn_spu); - - /* Registers. */ - set_gdbarch_num_regs (gdbarch, SPU_NUM_REGS); -@@ -2118,9 +2489,16 @@ spu_gdbarch_init (struct gdbarch_info in - set_gdbarch_double_format (gdbarch, floatformats_ieee_double); - set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double); - -- /* Address conversion. */ -+ /* Address handling. */ -+ set_gdbarch_address_to_pointer (gdbarch, spu_address_to_pointer); - set_gdbarch_pointer_to_address (gdbarch, spu_pointer_to_address); - set_gdbarch_integer_to_address (gdbarch, spu_integer_to_address); -+ set_gdbarch_address_class_type_flags (gdbarch, spu_address_class_type_flags); -+ set_gdbarch_address_class_type_flags_to_name -+ (gdbarch, spu_address_class_type_flags_to_name); -+ set_gdbarch_address_class_name_to_type_flags -+ (gdbarch, spu_address_class_name_to_type_flags); -+ - - /* Inferior function calls. */ - set_gdbarch_call_dummy_location (gdbarch, ON_STACK); -@@ -2142,6 +2520,9 @@ spu_gdbarch_init (struct gdbarch_info in - set_gdbarch_skip_prologue (gdbarch, spu_skip_prologue); - set_gdbarch_in_function_epilogue_p (gdbarch, spu_in_function_epilogue_p); - -+ /* Cell/B.E. cross-architecture unwinder support. */ -+ frame_unwind_prepend_unwinder (gdbarch, &spu2ppu_unwind); -+ - /* Breakpoints. */ - set_gdbarch_decr_pc_after_break (gdbarch, 4); - set_gdbarch_breakpoint_from_pc (gdbarch, spu_breakpoint_from_pc); -@@ -2163,6 +2544,50 @@ _initialize_spu_tdep (void) - observer_attach_new_objfile (spu_overlay_new_objfile); - spu_overlay_data = register_objfile_data (); - -+ /* Install spu stop-on-load handler. */ -+ observer_attach_new_objfile (spu_catch_start); -+ -+ /* Add ourselves to normal_stop event chain. */ -+ observer_attach_normal_stop (spu_attach_normal_stop); -+ -+ /* Add root prefix command for all "set spu"/"show spu" commands. */ -+ add_prefix_cmd ("spu", no_class, set_spu_command, -+ _("Various SPU specific commands."), -+ &setspucmdlist, "set spu ", 0, &setlist); -+ add_prefix_cmd ("spu", no_class, show_spu_command, -+ _("Various SPU specific commands."), -+ &showspucmdlist, "show spu ", 0, &showlist); -+ -+ /* Toggle whether or not to add a temporary breakpoint at the "main" -+ function of new SPE contexts. */ -+ add_setshow_boolean_cmd ("stop-on-load", class_support, -+ &spu_stop_on_load_p, _("\ -+Set whether to stop for new SPE threads."), -+ _("\ -+Show whether to stop for new SPE threads."), -+ _("\ -+Use \"on\" to give control to the user when a new SPE thread\n\ -+enters its \"main\" function.\n\ -+Use \"off\" to disable stopping for new SPE threads."), -+ NULL, -+ show_spu_stop_on_load, -+ &setspucmdlist, &showspucmdlist); -+ -+ /* Toggle whether or not to automatically flush the software-managed -+ cache whenever SPE execution stops. */ -+ add_setshow_boolean_cmd ("auto-flush-cache", class_support, -+ &spu_auto_flush_cache_p, _("\ -+Set whether to automatically flush the software-managed cache."), -+ _("\ -+Show whether to automatically flush the software-managed cache."), -+ _("\ -+Use \"on\" to automatically flush the software-managed cache\n\ -+whenever SPE execution stops.\n\ -+Use \"off\" to never automatically flush the software-managed cache."), -+ NULL, -+ show_spu_auto_flush_cache, -+ &setspucmdlist, &showspucmdlist); -+ - /* Add root prefix command for all "info spu" commands. */ - add_prefix_cmd ("spu", class_info, info_spu_command, - _("Various SPU specific commands."), -Index: gdb-head/gdb/xstormy16-tdep.c -=================================================================== ---- gdb-head.orig/gdb/xstormy16-tdep.c -+++ gdb-head/gdb/xstormy16-tdep.c -@@ -592,7 +592,8 @@ xstormy16_skip_trampoline_code (struct f - and vice versa. */ - - static CORE_ADDR --xstormy16_pointer_to_address (struct type *type, const gdb_byte *buf) -+xstormy16_pointer_to_address (struct gdbarch *gdbarch, -+ struct type *type, const gdb_byte *buf) - { - enum type_code target = TYPE_CODE (TYPE_TARGET_TYPE (type)); - CORE_ADDR addr = extract_unsigned_integer (buf, TYPE_LENGTH (type)); -@@ -608,7 +609,8 @@ xstormy16_pointer_to_address (struct typ - } - - static void --xstormy16_address_to_pointer (struct type *type, gdb_byte *buf, CORE_ADDR addr) -+xstormy16_address_to_pointer (struct gdbarch *gdbarch, -+ struct type *type, gdb_byte *buf, CORE_ADDR addr) - { - enum type_code target = TYPE_CODE (TYPE_TARGET_TYPE (type)); - -Index: gdb-head/gdb/gcore.c -=================================================================== ---- gdb-head.orig/gdb/gcore.c -+++ gdb-head/gdb/gcore.c -@@ -35,7 +35,7 @@ - generate-core-file for programs with large resident data. */ - #define MAX_COPY_BYTES (1024 * 1024) - --static char *default_gcore_target (void); -+static const char *default_gcore_target (void); - static enum bfd_architecture default_gcore_arch (void); - static unsigned long default_gcore_mach (void); - static int gcore_memory_sections (bfd *); -@@ -125,7 +125,7 @@ default_gcore_mach (void) - return 0; - #else - -- const struct bfd_arch_info *bfdarch = gdbarch_bfd_arch_info (current_gdbarch); -+ const struct bfd_arch_info *bfdarch = gdbarch_bfd_arch_info (target_gdbarch); - - if (bfdarch != NULL) - return bfdarch->mach; -@@ -139,8 +139,7 @@ default_gcore_mach (void) - static enum bfd_architecture - default_gcore_arch (void) - { -- const struct bfd_arch_info * bfdarch = gdbarch_bfd_arch_info -- (current_gdbarch); -+ const struct bfd_arch_info *bfdarch = gdbarch_bfd_arch_info (target_gdbarch); - - if (bfdarch != NULL) - return bfdarch->arch; -@@ -150,10 +149,15 @@ default_gcore_arch (void) - return bfd_get_arch (exec_bfd); - } - --static char * -+static const char * - default_gcore_target (void) - { -- /* FIXME: This may only work for ELF targets. */ -+ /* The gdbarch may define a target to use for core files. */ -+ if (gdbarch_gcore_bfd_target_p (target_gdbarch)) -+ return gdbarch_gcore_bfd_target (target_gdbarch); -+ -+ /* Otherwise, try to fall back to the exec_bfd target. This will probably -+ not work for non-ELF targets. */ - if (exec_bfd == NULL) - return NULL; - else -Index: gdb-head/gdb/ppc-linux-tdep.c -=================================================================== ---- gdb-head.orig/gdb/ppc-linux-tdep.c -+++ gdb-head/gdb/ppc-linux-tdep.c +- if (vsx) ++ if (ppc_linux_get_hwcap () & PPC_FEATURE_CELL) ++ return tdesc_powerpc_cell32l; ++ else if (vsx) + return tdesc_powerpc_vsx32l; + else if (altivec) + return tdesc_powerpc_altivec32l; +--- gdb-6.8.50.20081103-cvs/gdb/ppc-linux-tdep.c ++++ gdb-6.8.50.20081103-cvs/gdb/ppc-linux-tdep.c @@ -38,12 +38,20 @@ #include "trad-frame.h" #include "frame-unwind.h" @@ -3441,7 +2678,7 @@ Index: gdb-head/gdb/ppc-linux-tdep.c asection *altivec = bfd_get_section_by_name (abfd, ".reg-ppc-vmx"); asection *vsx = bfd_get_section_by_name (abfd, ".reg-ppc-vsx"); asection *section = bfd_get_section_by_name (abfd, ".reg"); -@@ -1036,7 +1091,9 @@ ppc_linux_core_read_description (struct +@@ -1036,7 +1091,9 @@ ppc_linux_core_read_description (struct switch (bfd_section_size (abfd, section)) { case 48 * 4: @@ -3452,7 +2689,7 @@ Index: gdb-head/gdb/ppc-linux-tdep.c return tdesc_powerpc_vsx32l; else if (altivec) return tdesc_powerpc_altivec32l; -@@ -1044,7 +1101,9 @@ ppc_linux_core_read_description (struct +@@ -1044,7 +1101,9 @@ ppc_linux_core_read_description (struct return tdesc_powerpc_32l; case 48 * 8: @@ -3463,7 +2700,7 @@ Index: gdb-head/gdb/ppc-linux-tdep.c return tdesc_powerpc_vsx64l; else if (altivec) return tdesc_powerpc_altivec64l; -@@ -1056,6 +1115,249 @@ ppc_linux_core_read_description (struct +@@ -1056,6 +1115,249 @@ ppc_linux_core_read_description (struct } } @@ -3713,7 +2950,7 @@ Index: gdb-head/gdb/ppc-linux-tdep.c static void ppc_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) -@@ -1096,6 +1398,12 @@ ppc_linux_init_abi (struct gdbarch_info +@@ -1096,6 +1398,12 @@ ppc_linux_init_abi (struct gdbarch_info /* Trampolines. */ tramp_frame_prepend_unwinder (gdbarch, &ppc32_linux_sigaction_tramp_frame); tramp_frame_prepend_unwinder (gdbarch, &ppc32_linux_sighandler_tramp_frame); @@ -3726,7 +2963,7 @@ Index: gdb-head/gdb/ppc-linux-tdep.c } if (tdep->wordsize == 8) -@@ -1113,6 +1421,12 @@ ppc_linux_init_abi (struct gdbarch_info +@@ -1113,6 +1421,12 @@ ppc_linux_init_abi (struct gdbarch_info /* Trampolines. */ tramp_frame_prepend_unwinder (gdbarch, &ppc64_linux_sigaction_tramp_frame); tramp_frame_prepend_unwinder (gdbarch, &ppc64_linux_sighandler_tramp_frame); @@ -3739,7 +2976,7 @@ Index: gdb-head/gdb/ppc-linux-tdep.c } set_gdbarch_regset_from_core_section (gdbarch, ppc_linux_regset_from_core_section); set_gdbarch_core_read_description (gdbarch, ppc_linux_core_read_description); -@@ -1152,6 +1466,22 @@ ppc_linux_init_abi (struct gdbarch_info +@@ -1152,6 +1466,22 @@ ppc_linux_init_abi (struct gdbarch_info PPC_TRAP_REGNUM, "trap"); } } @@ -3783,972 +3020,8 @@ Index: gdb-head/gdb/ppc-linux-tdep.c initialize_tdesc_powerpc_vsx64l (); initialize_tdesc_powerpc_e500l (); } -Index: gdb-head/gdb/target-descriptions.c -=================================================================== ---- gdb-head.orig/gdb/target-descriptions.c -+++ gdb-head/gdb/target-descriptions.c -@@ -104,6 +104,10 @@ typedef struct tdesc_feature - } *tdesc_feature_p; - DEF_VEC_P(tdesc_feature_p); - -+/* A compatible architecture from a target description. */ -+typedef const struct bfd_arch_info *arch_p; -+DEF_VEC_P(arch_p); -+ - /* A target description. */ - - struct target_desc -@@ -111,6 +115,9 @@ struct target_desc - /* The architecture reported by the target, if any. */ - const struct bfd_arch_info *arch; - -+ /* The list of compatible architectures reported by the target. */ -+ VEC(arch_p) *compatible; -+ - /* Any architecture-specific properties specified by the target. */ - VEC(property_s) *properties; - -@@ -290,6 +297,28 @@ tdesc_architecture (const struct target_ - { - return target_desc->arch; - } -+ -+/* Return non-zero if this target description is compatible -+ with the given BFD architecture. */ -+ -+int -+tdesc_compatible_p (const struct target_desc *target_desc, -+ const struct bfd_arch_info *arch) -+{ -+ const struct bfd_arch_info *compat; -+ int ix; -+ -+ for (ix = 0; VEC_iterate (arch_p, target_desc->compatible, ix, compat); -+ ix++) -+ { -+ if (compat == arch -+ || arch->compatible (arch, compat) -+ || compat->compatible (compat, arch)) -+ return 1; -+ } -+ -+ return 0; -+} - - - /* Return 1 if this target description includes any registers. */ -@@ -885,6 +914,8 @@ free_target_description (void *arg) - } - VEC_free (property_s, target_desc->properties); - -+ VEC_free (arch_p, target_desc->compatible); -+ - xfree (target_desc); - } - -@@ -895,6 +926,30 @@ make_cleanup_free_target_description (st - } - - void -+tdesc_add_compatible (struct target_desc *target_desc, -+ const struct bfd_arch_info *compatible) -+{ -+ const struct bfd_arch_info *compat; -+ int ix; -+ -+ /* If this instance of GDB is compiled without BFD support for the -+ compatible architecture, simply ignore it -- we would not be able -+ to handle it anyway. */ -+ if (compatible == NULL) -+ return; -+ -+ for (ix = 0; VEC_iterate (arch_p, target_desc->compatible, ix, compat); -+ ix++) -+ if (compat == compatible) -+ internal_error (__FILE__, __LINE__, -+ _("Attempted to add duplicate " -+ "compatible architecture \"%s\""), -+ compatible->printable_name); -+ -+ VEC_safe_push (arch_p, target_desc->compatible, compatible); -+} -+ -+void - set_tdesc_property (struct target_desc *target_desc, - const char *key, const char *value) - { -@@ -993,6 +1048,7 @@ static void - maint_print_c_tdesc_cmd (char *args, int from_tty) - { - const struct target_desc *tdesc; -+ const struct bfd_arch_info *compatible; - const char *filename, *inp; - char *function, *outp; - struct property *prop; -@@ -1049,6 +1105,16 @@ maint_print_c_tdesc_cmd (char *args, int - printf_unfiltered ("\n"); - } - -+ for (ix = 0; VEC_iterate (arch_p, tdesc->compatible, ix, compatible); -+ ix++) -+ { -+ printf_unfiltered -+ (" tdesc_add_compatible (result, bfd_scan_arch (\"%s\"));\n", -+ compatible->printable_name); -+ } -+ if (ix) -+ printf_unfiltered ("\n"); -+ - for (ix = 0; VEC_iterate (property_s, tdesc->properties, ix, prop); - ix++) - { -Index: gdb-head/gdb/target-descriptions.h -=================================================================== ---- gdb-head.orig/gdb/target-descriptions.h -+++ gdb-head/gdb/target-descriptions.h -@@ -123,6 +123,12 @@ int tdesc_numbered_register_choices (con - const struct bfd_arch_info *tdesc_architecture - (const struct target_desc *); - -+/* Return non-zero if this target description is compatible -+ with the given BFD architecture. */ -+ -+int tdesc_compatible_p (const struct target_desc *, -+ const struct bfd_arch_info *); -+ - /* Return the string value of a property named KEY, or NULL if the - property was not specified. */ - -@@ -169,6 +175,8 @@ void set_tdesc_architecture (struct targ - const struct bfd_arch_info *); - void set_tdesc_property (struct target_desc *, - const char *key, const char *value); -+void tdesc_add_compatible (struct target_desc *, -+ const struct bfd_arch_info *); - - struct tdesc_feature *tdesc_create_feature (struct target_desc *tdesc, - const char *name); -Index: gdb-head/gdb/xml-tdesc.c -=================================================================== ---- gdb-head.orig/gdb/xml-tdesc.c -+++ gdb-head/gdb/xml-tdesc.c -@@ -106,6 +106,20 @@ tdesc_end_arch (struct gdb_xml_parser *p - set_tdesc_architecture (data->tdesc, arch); - } - -+/* Handle the end of a element and its value. */ -+ -+static void -+tdesc_end_compatible (struct gdb_xml_parser *parser, -+ const struct gdb_xml_element *element, -+ void *user_data, const char *body_text) -+{ -+ struct tdesc_parsing_data *data = user_data; -+ const struct bfd_arch_info *arch; -+ -+ arch = bfd_scan_arch (body_text); -+ tdesc_add_compatible (data->tdesc, arch); -+} -+ - /* Handle the start of a element. */ - - static void -@@ -345,6 +359,8 @@ static const struct gdb_xml_attribute ta - static const struct gdb_xml_element target_children[] = { - { "architecture", NULL, NULL, GDB_XML_EF_OPTIONAL, - NULL, tdesc_end_arch }, -+ { "compatible", NULL, NULL, GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE, -+ NULL, tdesc_end_compatible }, - { "feature", feature_attributes, feature_children, - GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE, - tdesc_start_feature, NULL }, -Index: gdb-head/gdb/doc/gdb.texinfo -=================================================================== ---- gdb-head.orig/gdb/doc/gdb.texinfo -+++ gdb-head/gdb/doc/gdb.texinfo -@@ -16431,6 +16431,33 @@ and local store addresses and transfer s - - @end table - -+When @value{GDBN} is debugging a combined PowerPC/SPU application -+on the Cell Broadband Engine, it provides in addition the following -+special commands: -+ -+@table @code -+@item set spu stop-on-load @var{arg} -+@kindex set spu -+Set whether to stop for new SPE threads. When set to @code{on}, @value{GDBN} -+will give control to the user when a new SPE thread enters its @code{main} -+function. The default is @code{off}. -+ -+@item show spu stop-on-load -+@kindex show spu -+Show whether to stop for new SPE threads. -+ -+@item set spu auto-flush-cache @var{arg} -+Set whether to automatically flush the software-managed cache. When set to -+@code{on}, @value{GDBN} will automatically cause the SPE software-managed -+cache to be flushed whenever SPE execution stops. This provides a consistent -+view of PowerPC memory that is accessed via the cache. If an application -+does not use the software-managed cache, this option has no effect. -+ -+@item show spu auto-flush-cache -+Show whether to automatically flush the software-managed cache. -+ -+@end table -+ - @node PowerPC - @subsection PowerPC - @cindex PowerPC architecture -@@ -27586,6 +27613,7 @@ are explained further below. - - - @r{[}@var{architecture}@r{]} -+ @r{[}@var{compatible}@dots{}@r{]} - @r{[}@var{feature}@dots{}@r{]} - - @end smallexample -@@ -27637,9 +27665,33 @@ An @samp{} element has thi - @var{arch} - @end smallexample - --@var{arch} is an architecture name from the same selection --accepted by @code{set architecture} (@pxref{Targets, ,Specifying a --Debugging Target}). -+@var{arch} is one of the architectures from the set accepted by -+@code{set architecture} (@pxref{Targets, ,Specifying a Debugging Target}). -+ -+@subsection Compatible Architecture -+@cindex -+ -+A @samp{} element has this form: -+ -+@smallexample -+ @var{arch} -+@end smallexample -+ -+@var{arch} is one of the architectures from the set accepted by -+@code{set architecture} (@pxref{Targets, ,Specifying a Debugging Target}). -+ -+A @samp{} element is used to specify that the target -+is able to run binaries in some other than the main target architecture -+given by the @samp{} element. For example, on the -+Cell Broadband Engine, the main architecture is @code{powerpc:common} -+or @code{powerpc:common64}, but the system is able to run binaries -+in the @code{spu} architecture as well. The way to describe this -+capability with @samp{} is as follows: -+ -+@smallexample -+ @code{powerpc:common} -+ @code{spu} -+@end smallexample - - @subsection Features - @cindex -Index: gdb-head/gdb/features/Makefile -=================================================================== ---- gdb-head.orig/gdb/features/Makefile -+++ gdb-head/gdb/features/Makefile -@@ -34,7 +34,7 @@ - WHICH = arm-with-iwmmxt mips-linux mips64-linux \ - rs6000/powerpc-32l rs6000/powerpc-altivec32l rs6000/powerpc-e500l \ - rs6000/powerpc-64l rs6000/powerpc-altivec64l rs6000/powerpc-vsx32l \ -- rs6000/powerpc-vsx64l -+ rs6000/powerpc-vsx64l rs6000/powerpc-cell32l rs6000/powerpc-cell64l - - # Record which registers should be sent to GDB by default after stop. - arm-with-iwmmxt-expedite = r11,sp,pc -@@ -42,10 +42,12 @@ mips-linux-expedite = r29,pc - mips64-linux-expedite = r29,pc - rs6000/powerpc-32l-expedite = r1,pc - rs6000/powerpc-altivec32l-expedite = r1,pc -+rs6000/powerpc-cell32l-expedite = r1,pc,r0,orig_r3,r4 - rs6000/powerpc-vsx32l-expedite = r1,pc - rs6000/powerpc-e500l-expedite = r1,pc - rs6000/powerpc-64l-expedite = r1,pc - rs6000/powerpc-altivec64l-expedite = r1,pc -+rs6000/powerpc-cell64l-expedite = r1,pc,r0,orig_r3,r4 - rs6000/powerpc-vsx64l-expedite = r1,pc - - -Index: gdb-head/gdb/features/rs6000/powerpc-cell32l.c -=================================================================== ---- /dev/null -+++ gdb-head/gdb/features/rs6000/powerpc-cell32l.c -@@ -0,0 +1,170 @@ -+/* THIS FILE IS GENERATED. Original: powerpc-cell32l.xml */ -+ -+#include "defs.h" -+#include "gdbtypes.h" -+#include "target-descriptions.h" -+ -+struct target_desc *tdesc_powerpc_cell32l; -+static void -+initialize_tdesc_powerpc_cell32l (void) -+{ -+ struct target_desc *result = allocate_target_description (); -+ struct tdesc_feature *feature; -+ struct type *field_type, *type; -+ -+ set_tdesc_architecture (result, bfd_scan_arch ("powerpc:common")); -+ -+ tdesc_add_compatible (result, bfd_scan_arch ("spu:256K")); -+ -+ feature = tdesc_create_feature (result, "org.gnu.gdb.power.core"); -+ tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "uint32"); -+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "uint32"); -+ tdesc_create_reg (feature, "r2", 2, 1, NULL, 32, "uint32"); -+ tdesc_create_reg (feature, "r3", 3, 1, NULL, 32, "uint32"); -+ tdesc_create_reg (feature, "r4", 4, 1, NULL, 32, "uint32"); -+ tdesc_create_reg (feature, "r5", 5, 1, NULL, 32, "uint32"); -+ tdesc_create_reg (feature, "r6", 6, 1, NULL, 32, "uint32"); -+ tdesc_create_reg (feature, "r7", 7, 1, NULL, 32, "uint32"); -+ tdesc_create_reg (feature, "r8", 8, 1, NULL, 32, "uint32"); -+ tdesc_create_reg (feature, "r9", 9, 1, NULL, 32, "uint32"); -+ tdesc_create_reg (feature, "r10", 10, 1, NULL, 32, "uint32"); -+ tdesc_create_reg (feature, "r11", 11, 1, NULL, 32, "uint32"); -+ tdesc_create_reg (feature, "r12", 12, 1, NULL, 32, "uint32"); -+ tdesc_create_reg (feature, "r13", 13, 1, NULL, 32, "uint32"); -+ tdesc_create_reg (feature, "r14", 14, 1, NULL, 32, "uint32"); -+ tdesc_create_reg (feature, "r15", 15, 1, NULL, 32, "uint32"); -+ tdesc_create_reg (feature, "r16", 16, 1, NULL, 32, "uint32"); -+ tdesc_create_reg (feature, "r17", 17, 1, NULL, 32, "uint32"); -+ tdesc_create_reg (feature, "r18", 18, 1, NULL, 32, "uint32"); -+ tdesc_create_reg (feature, "r19", 19, 1, NULL, 32, "uint32"); -+ tdesc_create_reg (feature, "r20", 20, 1, NULL, 32, "uint32"); -+ tdesc_create_reg (feature, "r21", 21, 1, NULL, 32, "uint32"); -+ tdesc_create_reg (feature, "r22", 22, 1, NULL, 32, "uint32"); -+ tdesc_create_reg (feature, "r23", 23, 1, NULL, 32, "uint32"); -+ tdesc_create_reg (feature, "r24", 24, 1, NULL, 32, "uint32"); -+ tdesc_create_reg (feature, "r25", 25, 1, NULL, 32, "uint32"); -+ tdesc_create_reg (feature, "r26", 26, 1, NULL, 32, "uint32"); -+ tdesc_create_reg (feature, "r27", 27, 1, NULL, 32, "uint32"); -+ tdesc_create_reg (feature, "r28", 28, 1, NULL, 32, "uint32"); -+ tdesc_create_reg (feature, "r29", 29, 1, NULL, 32, "uint32"); -+ tdesc_create_reg (feature, "r30", 30, 1, NULL, 32, "uint32"); -+ tdesc_create_reg (feature, "r31", 31, 1, NULL, 32, "uint32"); -+ tdesc_create_reg (feature, "pc", 64, 1, NULL, 32, "code_ptr"); -+ tdesc_create_reg (feature, "msr", 65, 1, NULL, 32, "uint32"); -+ tdesc_create_reg (feature, "cr", 66, 1, NULL, 32, "uint32"); -+ tdesc_create_reg (feature, "lr", 67, 1, NULL, 32, "code_ptr"); -+ tdesc_create_reg (feature, "ctr", 68, 1, NULL, 32, "uint32"); -+ tdesc_create_reg (feature, "xer", 69, 1, NULL, 32, "uint32"); -+ -+ feature = tdesc_create_feature (result, "org.gnu.gdb.power.fpu"); -+ tdesc_create_reg (feature, "f0", 32, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f1", 33, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f2", 34, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f3", 35, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f4", 36, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f5", 37, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f6", 38, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f7", 39, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f8", 40, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f9", 41, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f10", 42, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f11", 43, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f12", 44, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f13", 45, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f14", 46, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f15", 47, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f16", 48, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f17", 49, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f18", 50, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f19", 51, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f20", 52, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f21", 53, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f22", 54, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f23", 55, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f24", 56, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f25", 57, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f26", 58, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f27", 59, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f28", 60, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f29", 61, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f30", 62, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f31", 63, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "fpscr", 70, 1, "float", 32, "int"); -+ -+ feature = tdesc_create_feature (result, "org.gnu.gdb.power.linux"); -+ tdesc_create_reg (feature, "orig_r3", 71, 1, NULL, 32, "int"); -+ tdesc_create_reg (feature, "trap", 72, 1, NULL, 32, "int"); -+ -+ feature = tdesc_create_feature (result, "org.gnu.gdb.power.altivec"); -+ field_type = tdesc_named_type (feature, "ieee_single"); -+ type = init_vector_type (field_type, 4); -+ TYPE_NAME (type) = xstrdup ("v4f"); -+ tdesc_record_type (feature, type); -+ -+ field_type = tdesc_named_type (feature, "int32"); -+ type = init_vector_type (field_type, 4); -+ TYPE_NAME (type) = xstrdup ("v4i32"); -+ tdesc_record_type (feature, type); -+ -+ field_type = tdesc_named_type (feature, "int16"); -+ type = init_vector_type (field_type, 8); -+ TYPE_NAME (type) = xstrdup ("v8i16"); -+ tdesc_record_type (feature, type); -+ -+ field_type = tdesc_named_type (feature, "int8"); -+ type = init_vector_type (field_type, 16); -+ TYPE_NAME (type) = xstrdup ("v16i8"); -+ tdesc_record_type (feature, type); -+ -+ type = init_composite_type (NULL, TYPE_CODE_UNION); -+ TYPE_NAME (type) = xstrdup ("vec128"); -+ field_type = tdesc_named_type (feature, "uint128"); -+ append_composite_type_field (type, xstrdup ("uint128"), field_type); -+ field_type = tdesc_named_type (feature, "v4f"); -+ append_composite_type_field (type, xstrdup ("v4_float"), field_type); -+ field_type = tdesc_named_type (feature, "v4i32"); -+ append_composite_type_field (type, xstrdup ("v4_int32"), field_type); -+ field_type = tdesc_named_type (feature, "v8i16"); -+ append_composite_type_field (type, xstrdup ("v8_int16"), field_type); -+ field_type = tdesc_named_type (feature, "v16i8"); -+ append_composite_type_field (type, xstrdup ("v16_int8"), field_type); -+ TYPE_VECTOR (type) = 1; -+ tdesc_record_type (feature, type); -+ -+ tdesc_create_reg (feature, "vr0", 73, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr1", 74, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr2", 75, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr3", 76, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr4", 77, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr5", 78, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr6", 79, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr7", 80, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr8", 81, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr9", 82, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr10", 83, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr11", 84, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr12", 85, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr13", 86, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr14", 87, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr15", 88, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr16", 89, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr17", 90, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr18", 91, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr19", 92, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr20", 93, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr21", 94, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr22", 95, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr23", 96, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr24", 97, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr25", 98, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr26", 99, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr27", 100, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr28", 101, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr29", 102, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr30", 103, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr31", 104, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vscr", 105, 1, "vector", 32, "int"); -+ tdesc_create_reg (feature, "vrsave", 106, 1, "vector", 32, "int"); -+ -+ tdesc_powerpc_cell32l = result; -+} -Index: gdb-head/gdb/features/rs6000/powerpc-cell32l.xml -=================================================================== ---- /dev/null -+++ gdb-head/gdb/features/rs6000/powerpc-cell32l.xml -@@ -0,0 +1,19 @@ -+ -+ -+ -+ -+ -+ -+ -+ powerpc:common -+ spu -+ -+ -+ -+ -+ -Index: gdb-head/gdb/features/rs6000/powerpc-cell64l.c -=================================================================== ---- /dev/null -+++ gdb-head/gdb/features/rs6000/powerpc-cell64l.c -@@ -0,0 +1,170 @@ -+/* THIS FILE IS GENERATED. Original: powerpc-cell64l.xml */ -+ -+#include "defs.h" -+#include "gdbtypes.h" -+#include "target-descriptions.h" -+ -+struct target_desc *tdesc_powerpc_cell64l; -+static void -+initialize_tdesc_powerpc_cell64l (void) -+{ -+ struct target_desc *result = allocate_target_description (); -+ struct tdesc_feature *feature; -+ struct type *field_type, *type; -+ -+ set_tdesc_architecture (result, bfd_scan_arch ("powerpc:common64")); -+ -+ tdesc_add_compatible (result, bfd_scan_arch ("spu:256K")); -+ -+ feature = tdesc_create_feature (result, "org.gnu.gdb.power.core"); -+ tdesc_create_reg (feature, "r0", 0, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "r2", 2, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "r3", 3, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "r4", 4, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "r5", 5, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "r6", 6, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "r7", 7, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "r8", 8, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "r9", 9, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "r10", 10, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "r11", 11, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "r12", 12, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "r13", 13, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "r14", 14, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "r15", 15, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "r16", 16, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "r17", 17, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "r18", 18, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "r19", 19, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "r20", 20, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "r21", 21, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "r22", 22, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "r23", 23, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "r24", 24, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "r25", 25, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "r26", 26, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "r27", 27, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "r28", 28, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "r29", 29, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "r30", 30, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "r31", 31, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "pc", 64, 1, NULL, 64, "code_ptr"); -+ tdesc_create_reg (feature, "msr", 65, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "cr", 66, 1, NULL, 32, "uint32"); -+ tdesc_create_reg (feature, "lr", 67, 1, NULL, 64, "code_ptr"); -+ tdesc_create_reg (feature, "ctr", 68, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "xer", 69, 1, NULL, 32, "uint32"); -+ -+ feature = tdesc_create_feature (result, "org.gnu.gdb.power.fpu"); -+ tdesc_create_reg (feature, "f0", 32, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f1", 33, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f2", 34, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f3", 35, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f4", 36, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f5", 37, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f6", 38, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f7", 39, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f8", 40, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f9", 41, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f10", 42, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f11", 43, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f12", 44, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f13", 45, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f14", 46, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f15", 47, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f16", 48, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f17", 49, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f18", 50, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f19", 51, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f20", 52, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f21", 53, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f22", 54, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f23", 55, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f24", 56, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f25", 57, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f26", 58, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f27", 59, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f28", 60, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f29", 61, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f30", 62, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "f31", 63, 1, NULL, 64, "ieee_double"); -+ tdesc_create_reg (feature, "fpscr", 70, 1, "float", 32, "int"); -+ -+ feature = tdesc_create_feature (result, "org.gnu.gdb.power.linux"); -+ tdesc_create_reg (feature, "orig_r3", 71, 1, NULL, 64, "int"); -+ tdesc_create_reg (feature, "trap", 72, 1, NULL, 64, "int"); -+ -+ feature = tdesc_create_feature (result, "org.gnu.gdb.power.altivec"); -+ field_type = tdesc_named_type (feature, "ieee_single"); -+ type = init_vector_type (field_type, 4); -+ TYPE_NAME (type) = xstrdup ("v4f"); -+ tdesc_record_type (feature, type); -+ -+ field_type = tdesc_named_type (feature, "int32"); -+ type = init_vector_type (field_type, 4); -+ TYPE_NAME (type) = xstrdup ("v4i32"); -+ tdesc_record_type (feature, type); -+ -+ field_type = tdesc_named_type (feature, "int16"); -+ type = init_vector_type (field_type, 8); -+ TYPE_NAME (type) = xstrdup ("v8i16"); -+ tdesc_record_type (feature, type); -+ -+ field_type = tdesc_named_type (feature, "int8"); -+ type = init_vector_type (field_type, 16); -+ TYPE_NAME (type) = xstrdup ("v16i8"); -+ tdesc_record_type (feature, type); -+ -+ type = init_composite_type (NULL, TYPE_CODE_UNION); -+ TYPE_NAME (type) = xstrdup ("vec128"); -+ field_type = tdesc_named_type (feature, "uint128"); -+ append_composite_type_field (type, xstrdup ("uint128"), field_type); -+ field_type = tdesc_named_type (feature, "v4f"); -+ append_composite_type_field (type, xstrdup ("v4_float"), field_type); -+ field_type = tdesc_named_type (feature, "v4i32"); -+ append_composite_type_field (type, xstrdup ("v4_int32"), field_type); -+ field_type = tdesc_named_type (feature, "v8i16"); -+ append_composite_type_field (type, xstrdup ("v8_int16"), field_type); -+ field_type = tdesc_named_type (feature, "v16i8"); -+ append_composite_type_field (type, xstrdup ("v16_int8"), field_type); -+ TYPE_VECTOR (type) = 1; -+ tdesc_record_type (feature, type); -+ -+ tdesc_create_reg (feature, "vr0", 73, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr1", 74, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr2", 75, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr3", 76, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr4", 77, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr5", 78, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr6", 79, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr7", 80, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr8", 81, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr9", 82, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr10", 83, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr11", 84, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr12", 85, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr13", 86, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr14", 87, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr15", 88, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr16", 89, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr17", 90, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr18", 91, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr19", 92, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr20", 93, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr21", 94, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr22", 95, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr23", 96, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr24", 97, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr25", 98, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr26", 99, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr27", 100, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr28", 101, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr29", 102, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr30", 103, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vr31", 104, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "vscr", 105, 1, "vector", 32, "int"); -+ tdesc_create_reg (feature, "vrsave", 106, 1, "vector", 32, "int"); -+ -+ tdesc_powerpc_cell64l = result; -+} -Index: gdb-head/gdb/features/rs6000/powerpc-cell64l.xml -=================================================================== ---- /dev/null -+++ gdb-head/gdb/features/rs6000/powerpc-cell64l.xml -@@ -0,0 +1,19 @@ -+ -+ -+ -+ -+ -+ -+ -+ powerpc:common64 -+ spu -+ -+ -+ -+ -+ -Index: gdb-head/gdb/gdbserver/configure.srv -=================================================================== ---- gdb-head.orig/gdb/gdbserver/configure.srv -+++ gdb-head/gdb/gdbserver/configure.srv -@@ -102,14 +102,17 @@ case "${target}" in - ;; - powerpc*-*-linux*) srv_regobj="powerpc-32l.o" - srv_regobj="${srv_regobj} powerpc-altivec32l.o" -+ srv_regobj="${srv_regobj} powerpc-cell32l.o" - srv_regobj="${srv_regobj} powerpc-vsx32l.o" - srv_regobj="${srv_regobj} powerpc-e500l.o" - srv_regobj="${srv_regobj} powerpc-64l.o" - srv_regobj="${srv_regobj} powerpc-altivec64l.o" -+ srv_regobj="${srv_regobj} powerpc-cell64l.o" - srv_regobj="${srv_regobj} powerpc-vsx64l.o" - srv_tgtobj="linux-low.o linux-ppc-low.o" - srv_xmlfiles="rs6000/powerpc-32l.xml" - srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-altivec32l.xml" -+ srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-cell32l.xml" - srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-vsx32l.xml" - srv_xmlfiles="${srv_xmlfiles} rs6000/power-altivec.xml" - srv_xmlfiles="${srv_xmlfiles} rs6000/power-vsx.xml" -@@ -120,6 +123,7 @@ case "${target}" in - srv_xmlfiles="${srv_xmlfiles} rs6000/power-spe.xml" - srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-64l.xml" - srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-altivec64l.xml" -+ srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-cell64l.xml" - srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-vsx64l.xml" - srv_xmlfiles="${srv_xmlfiles} rs6000/power64-core.xml" - srv_xmlfiles="${srv_xmlfiles} rs6000/power64-linux.xml" -Index: gdb-head/gdb/gdbserver/linux-ppc-low.c -=================================================================== ---- gdb-head.orig/gdb/gdbserver/linux-ppc-low.c -+++ gdb-head/gdb/gdbserver/linux-ppc-low.c -@@ -28,6 +28,7 @@ - #define PPC_FEATURE_HAS_VSX 0x00000080 - #define PPC_FEATURE_HAS_ALTIVEC 0x10000000 - #define PPC_FEATURE_HAS_SPE 0x00800000 -+#define PPC_FEATURE_CELL 0x00010000 - - static unsigned long ppc_hwcap; - -@@ -36,6 +37,8 @@ static unsigned long ppc_hwcap; - void init_registers_powerpc_32l (void); - /* Defined in auto-generated file powerpc-altivec32l.c. */ - void init_registers_powerpc_altivec32l (void); -+/* Defined in auto-generated file powerpc-cell32l.c. */ -+void init_registers_powerpc_cell32l (void); - /* Defined in auto-generated file powerpc-vsx32l.c. */ - void init_registers_powerpc_vsx32l (void); - /* Defined in auto-generated file powerpc-e500l.c. */ -@@ -44,6 +47,8 @@ void init_registers_powerpc_e500l (void) - void init_registers_powerpc_64l (void); - /* Defined in auto-generated file powerpc-altivec64l.c. */ - void init_registers_powerpc_altivec64l (void); -+/* Defined in auto-generated file powerpc-cell64l.c. */ -+void init_registers_powerpc_cell64l (void); - /* Defined in auto-generated file powerpc-vsx64l.c. */ - void init_registers_powerpc_vsx64l (void); - -@@ -173,10 +178,72 @@ ppc_supply_ptrace_register (int regno, c - supply_register (regno, buf); - } - -+ -+#define INSTR_SC 0x44000002 -+#define NR_spu_run 0x0116 -+ -+/* If the PPU thread is currently stopped on a spu_run system call, -+ return to FD and ADDR the file handle and NPC parameter address -+ used with the system call. Return non-zero if successful. */ -+static int -+parse_spufs_run (int *fd, CORE_ADDR *addr) -+{ -+ CORE_ADDR curr_pc; -+ int curr_insn; -+ int curr_r0; -+ -+ if (register_size (0) == 4) -+ { -+ unsigned int pc, r0, r3, r4; -+ collect_register_by_name ("pc", &pc); -+ collect_register_by_name ("r0", &r0); -+ collect_register_by_name ("orig_r3", &r3); -+ collect_register_by_name ("r4", &r4); -+ curr_pc = (CORE_ADDR) pc; -+ curr_r0 = (int) r0; -+ *fd = (int) r3; -+ *addr = (CORE_ADDR) r4; -+ } -+ else -+ { -+ unsigned long pc, r0, r3, r4; -+ collect_register_by_name ("pc", &pc); -+ collect_register_by_name ("r0", &r0); -+ collect_register_by_name ("orig_r3", &r3); -+ collect_register_by_name ("r4", &r4); -+ curr_pc = (CORE_ADDR) pc; -+ curr_r0 = (int) r0; -+ *fd = (int) r3; -+ *addr = (CORE_ADDR) r4; -+ } -+ -+ /* Fetch instruction preceding current NIP. */ -+ if ((*the_target->read_memory) (curr_pc - 4, -+ (unsigned char *) &curr_insn, 4) != 0) -+ return 0; -+ /* It should be a "sc" instruction. */ -+ if (curr_insn != INSTR_SC) -+ return 0; -+ /* System call number should be NR_spu_run. */ -+ if (curr_r0 != NR_spu_run) -+ return 0; -+ -+ return 1; -+} -+ - static CORE_ADDR - ppc_get_pc (void) - { -- if (register_size (0) == 4) -+ CORE_ADDR addr; -+ int fd; -+ -+ if (parse_spufs_run (&fd, &addr)) -+ { -+ unsigned int pc; -+ (*the_target->read_memory) (addr, (unsigned char *) &pc, 4); -+ return ((CORE_ADDR)1 << 63) | ((CORE_ADDR)fd << 32) | (CORE_ADDR) (pc - 4); -+ } -+ else if (register_size (0) == 4) - { - unsigned int pc; - collect_register_by_name ("pc", &pc); -@@ -193,7 +260,15 @@ ppc_get_pc (void) - static void - ppc_set_pc (CORE_ADDR pc) - { -- if (register_size (0) == 4) -+ CORE_ADDR addr; -+ int fd; -+ -+ if (parse_spufs_run (&fd, &addr)) -+ { -+ unsigned int newpc = pc; -+ (*the_target->write_memory) (addr, (unsigned char *) &newpc, 4); -+ } -+ else if (register_size (0) == 4) - { - unsigned int newpc = pc; - supply_register_by_name ("pc", &newpc); -@@ -259,7 +334,9 @@ ppc_arch_setup (void) - if (msr < 0) - { - ppc_get_hwcap (&ppc_hwcap); -- if (ppc_hwcap & PPC_FEATURE_HAS_VSX) -+ if (ppc_hwcap & PPC_FEATURE_CELL) -+ init_registers_powerpc_cell64l (); -+ else if (ppc_hwcap & PPC_FEATURE_HAS_VSX) - init_registers_powerpc_vsx64l (); - else if (ppc_hwcap & PPC_FEATURE_HAS_ALTIVEC) - init_registers_powerpc_altivec64l (); -@@ -271,7 +348,9 @@ ppc_arch_setup (void) - init_registers_powerpc_32l (); - - ppc_get_hwcap (&ppc_hwcap); -- if (ppc_hwcap & PPC_FEATURE_HAS_VSX) -+ if (ppc_hwcap & PPC_FEATURE_CELL) -+ init_registers_powerpc_cell32l (); -+ else if (ppc_hwcap & PPC_FEATURE_HAS_VSX) - init_registers_powerpc_vsx32l (); - else if (ppc_hwcap & PPC_FEATURE_HAS_ALTIVEC) - init_registers_powerpc_altivec32l (); -@@ -300,11 +379,24 @@ ppc_breakpoint_at (CORE_ADDR where) - { - unsigned int insn; - -- (*the_target->read_memory) (where, (unsigned char *) &insn, 4); -- if (insn == ppc_breakpoint) -- return 1; -- /* If necessary, recognize more trap instructions here. GDB only uses the -- one. */ -+ if (where & ((CORE_ADDR)1 << 63)) -+ { -+ char mem_annex[32]; -+ sprintf (mem_annex, "%d/mem", (int)((where >> 32) & 0x7fffffff)); -+ (*the_target->qxfer_spu) (mem_annex, (unsigned char *) &insn, -+ NULL, where & 0xffffffff, 4); -+ if (insn == 0x3fff) -+ return 1; -+ } -+ else -+ { -+ (*the_target->read_memory) (where, (unsigned char *) &insn, 4); -+ if (insn == ppc_breakpoint) -+ return 1; -+ /* If necessary, recognize more trap instructions here. GDB only uses -+ the one. */ -+ } -+ - return 0; - } - -Index: gdb-head/gdb/gdbserver/Makefile.in -=================================================================== ---- gdb-head.orig/gdb/gdbserver/Makefile.in -+++ gdb-head/gdb/gdbserver/Makefile.in -@@ -224,8 +224,9 @@ clean: - rm -f reg-cris.c reg-crisv32.c reg-x86-64-linux.c reg-xtensa.c - rm -f arm-with-iwmmxt.c mips-linux.c mips64-linux.c - rm -f powerpc-32l.c powerpc-64l.c powerpc-e500l.c -- rm -f powerpc-altivec32l.c powerpc-vsx32l.c powerpc-altivec64l.c -- rm -f powerpc-vsx64l.c xml-builtin.c stamp-xml -+ rm -f powerpc-altivec32l.c powerpc-cell32l.c powerpc-vsx32l.c -+ rm -f powerpc-altivec64l.c powerpc-cell64l.c powerpc-vsx64l.c -+ rm -f xml-builtin.c stamp-xml - - maintainer-clean realclean distclean: clean - rm -f nm.h tm.h xm.h config.status config.h stamp-h config.log -@@ -369,6 +370,9 @@ powerpc-32l.c : $(srcdir)/../regformats/ - powerpc-altivec32l.o : powerpc-altivec32l.c $(regdef_h) - powerpc-altivec32l.c : $(srcdir)/../regformats/rs6000/powerpc-altivec32l.dat $(regdat_sh) - $(SHELL) $(regdat_sh) $(srcdir)/../regformats/rs6000/powerpc-altivec32l.dat powerpc-altivec32l.c -+powerpc-cell32l.o : powerpc-cell32l.c $(regdef_h) -+powerpc-cell32l.c : $(srcdir)/../regformats/rs6000/powerpc-cell32l.dat $(regdat_sh) -+ $(SHELL) $(regdat_sh) $(srcdir)/../regformats/rs6000/powerpc-cell32l.dat powerpc-cell32l.c - powerpc-vsx32l.o : powerpc-vsx32l.c $(regdef_h) - powerpc-vsx32l.c : $(srcdir)/../regformats/rs6000/powerpc-vsx32l.dat $(regdat_sh) - $(SHELL) $(regdat_sh) $(srcdir)/../regformats/rs6000/powerpc-vsx32l.dat powerpc-vsx32l.c -@@ -381,6 +385,9 @@ powerpc-64l.c : $(srcdir)/../regformats/ - powerpc-altivec64l.o : powerpc-altivec64l.c $(regdef_h) - powerpc-altivec64l.c : $(srcdir)/../regformats/rs6000/powerpc-altivec64l.dat $(regdat_sh) - $(SHELL) $(regdat_sh) $(srcdir)/../regformats/rs6000/powerpc-altivec64l.dat powerpc-altivec64l.c -+powerpc-cell64l.o : powerpc-cell64l.c $(regdef_h) -+powerpc-cell64l.c : $(srcdir)/../regformats/rs6000/powerpc-cell64l.dat $(regdat_sh) -+ $(SHELL) $(regdat_sh) $(srcdir)/../regformats/rs6000/powerpc-cell64l.dat powerpc-cell64l.c - powerpc-vsx64l.o : powerpc-vsx64l.c $(regdef_h) - powerpc-vsx64l.c : $(srcdir)/../regformats/rs6000/powerpc-vsx64l.dat $(regdat_sh) - $(SHELL) $(regdat_sh) $(srcdir)/../regformats/rs6000/powerpc-vsx64l.dat powerpc-vsx64l.c -Index: gdb-head/gdb/ppc-linux-nat.c -=================================================================== ---- gdb-head.orig/gdb/ppc-linux-nat.c -+++ gdb-head/gdb/ppc-linux-nat.c -@@ -56,6 +56,10 @@ - #define PT_TRAP 40 - #endif - -+#ifndef PPC_FEATURE_CELL -+#define PPC_FEATURE_CELL 0x00010000 -+#endif -+ - #ifndef PPC_FEATURE_BOOKE - #define PPC_FEATURE_BOOKE 0x00008000 - #endif -@@ -1283,7 +1287,9 @@ ppc_linux_read_description (struct targe - msr = (long) ptrace (PTRACE_PEEKUSER, tid, PT_MSR * 8, 0); - if (errno == 0 && msr < 0) - { -- if (vsx) -+ if (ppc_linux_get_hwcap () & PPC_FEATURE_CELL) -+ return tdesc_powerpc_cell64l; -+ else if (vsx) - return tdesc_powerpc_vsx64l; - else if (altivec) - return tdesc_powerpc_altivec64l; -@@ -1293,7 +1299,9 @@ ppc_linux_read_description (struct targe - } - #endif - -- if (vsx) -+ if (ppc_linux_get_hwcap () & PPC_FEATURE_CELL) -+ return tdesc_powerpc_cell32l; -+ else if (vsx) - return tdesc_powerpc_vsx32l; - else if (altivec) - return tdesc_powerpc_altivec32l; -Index: gdb-head/gdb/ppc-linux-tdep.h -=================================================================== ---- gdb-head.orig/gdb/ppc-linux-tdep.h -+++ gdb-head/gdb/ppc-linux-tdep.h +--- gdb-6.8.50.20081103-cvs/gdb/ppc-linux-tdep.h ++++ gdb-6.8.50.20081103-cvs/gdb/ppc-linux-tdep.h @@ -41,10 +41,12 @@ int ppc_linux_trap_reg_p (struct gdbarch /* Linux target descriptions. */ extern struct target_desc *tdesc_powerpc_32l; @@ -4762,10 +3035,211 @@ Index: gdb-head/gdb/ppc-linux-tdep.h extern struct target_desc *tdesc_powerpc_vsx64l; #endif /* PPC_LINUX_TDEP_H */ -Index: gdb-head/gdb/regformats/rs6000/powerpc-cell32l.dat -=================================================================== ---- /dev/null -+++ gdb-head/gdb/regformats/rs6000/powerpc-cell32l.dat +--- gdb-6.8.50.20081103-cvs/gdb/printcmd.c ++++ gdb-6.8.50.20081103-cvs/gdb/printcmd.c +@@ -386,7 +386,7 @@ print_scalar_formatted (const void *vala + /* If we are printing it as unsigned, truncate it in case it is actually + a negative signed value (e.g. "print/u (short)-1" should print 65535 + (if shorts are 16 bits) instead of 4294967295). */ +- if (options->format != 'd') ++ if (options->format != 'd' || TYPE_UNSIGNED (type)) + { + if (len < sizeof (LONGEST)) + val_long &= ((LONGEST) 1 << HOST_CHAR_BIT * len) - 1; +--- gdb-6.8.50.20081103-cvs/gdb/proc-service.c ++++ gdb-6.8.50.20081103-cvs/gdb/proc-service.c +@@ -257,7 +257,7 @@ ps_lgetregs (gdb_ps_prochandle_t ph, lwp + struct regcache *regcache; + + inferior_ptid = BUILD_LWP (lwpid, ph->pid); +- regcache = get_thread_regcache (inferior_ptid); ++ regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch); + + target_fetch_registers (regcache, -1); + fill_gregset (regcache, (gdb_gregset_t *) gregset, -1); +@@ -276,7 +276,7 @@ ps_lsetregs (gdb_ps_prochandle_t ph, lwp + struct regcache *regcache; + + inferior_ptid = BUILD_LWP (lwpid, ph->pid); +- regcache = get_thread_regcache (inferior_ptid); ++ regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch); + + supply_gregset (regcache, (const gdb_gregset_t *) gregset); + target_store_registers (regcache, -1); +@@ -296,7 +296,7 @@ ps_lgetfpregs (gdb_ps_prochandle_t ph, l + struct regcache *regcache; + + inferior_ptid = BUILD_LWP (lwpid, ph->pid); +- regcache = get_thread_regcache (inferior_ptid); ++ regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch); + + target_fetch_registers (regcache, -1); + fill_fpregset (regcache, (gdb_fpregset_t *) fpregset, -1); +@@ -316,7 +316,7 @@ ps_lsetfpregs (gdb_ps_prochandle_t ph, l + struct regcache *regcache; + + inferior_ptid = BUILD_LWP (lwpid, ph->pid); +- regcache = get_thread_regcache (inferior_ptid); ++ regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch); + + supply_fpregset (regcache, (const gdb_fpregset_t *) fpregset); + target_store_registers (regcache, -1); +--- gdb-6.8.50.20081103-cvs/gdb/regcache.c ++++ gdb-6.8.50.20081103-cvs/gdb/regcache.c +@@ -29,6 +29,7 @@ + #include "gdb_string.h" + #include "gdbcmd.h" /* For maintenanceprintlist. */ + #include "observer.h" ++#include "arch-utils.h" + + /* + * DATA STRUCTURE +@@ -410,36 +411,60 @@ regcache_invalidate (struct regcache *re + + + /* Global structure containing the current regcache. */ +-/* FIXME: cagney/2002-05-11: The two global arrays registers[] and +- deprecated_register_valid[] currently point into this structure. */ +-static struct regcache *current_regcache; + + /* NOTE: this is a write-through cache. There is no "dirty" bit for + recording if the register values have been changed (eg. by the + user). Therefore all registers must be written back to the + target when appropriate. */ + +-struct regcache *get_thread_regcache (ptid_t ptid) ++struct regcache_list + { +- /* NOTE: uweigand/2007-05-05: We need to detect the thread's +- current architecture at this point. */ +- struct gdbarch *thread_gdbarch = current_gdbarch; ++ struct regcache *regcache; ++ struct regcache_list *next; ++}; ++ ++static struct regcache_list *current_regcache; ++ ++struct regcache * ++get_thread_arch_regcache (ptid_t ptid, struct gdbarch *gdbarch) ++{ ++ struct regcache_list *list; ++ struct regcache *new_regcache; + +- if (current_regcache && ptid_equal (current_regcache->ptid, ptid) +- && get_regcache_arch (current_regcache) == thread_gdbarch) +- return current_regcache; ++ for (list = current_regcache; list; list = list->next) ++ if (ptid_equal (list->regcache->ptid, ptid) ++ && get_regcache_arch (list->regcache) == gdbarch) ++ return list->regcache; + +- if (current_regcache) +- regcache_xfree (current_regcache); ++ new_regcache = regcache_xmalloc (gdbarch); ++ new_regcache->readonly_p = 0; ++ new_regcache->ptid = ptid; + +- current_regcache = regcache_xmalloc (thread_gdbarch); +- current_regcache->readonly_p = 0; +- current_regcache->ptid = ptid; ++ list = xmalloc (sizeof (struct regcache_list)); ++ list->regcache = new_regcache; ++ list->next = current_regcache; ++ current_regcache = list; + +- return current_regcache; ++ return new_regcache; + } + +-struct regcache *get_current_regcache (void) ++static ptid_t current_thread_ptid; ++static struct gdbarch *current_thread_arch; ++ ++struct regcache * ++get_thread_regcache (ptid_t ptid) ++{ ++ if (!current_thread_arch || !ptid_equal (current_thread_ptid, ptid)) ++ { ++ current_thread_ptid = ptid; ++ current_thread_arch = target_thread_architecture (ptid); ++ } ++ ++ return get_thread_arch_regcache (ptid, current_thread_arch); ++} ++ ++struct regcache * ++get_current_regcache (void) + { + return get_thread_regcache (inferior_ptid); + } +@@ -458,9 +483,11 @@ regcache_observer_target_changed (struct + static void + regcache_thread_ptid_changed (ptid_t old_ptid, ptid_t new_ptid) + { +- if (current_regcache != NULL +- && ptid_equal (current_regcache->ptid, old_ptid)) +- current_regcache->ptid = new_ptid; ++ struct regcache_list *list; ++ ++ for (list = current_regcache; list; list = list->next) ++ if (ptid_equal (list->regcache->ptid, old_ptid)) ++ list->regcache->ptid = new_ptid; + } + + /* Low level examining and depositing of registers. +@@ -477,11 +504,20 @@ regcache_thread_ptid_changed (ptid_t old + void + registers_changed (void) + { +- int i; ++ struct regcache_list *list, *next; ++ ++ for (list = current_regcache; list; list = next) ++ { ++ next = list->next; ++ regcache_xfree (list->regcache); ++ xfree (list); ++ } + +- regcache_xfree (current_regcache); + current_regcache = NULL; + ++ current_thread_ptid = null_ptid; ++ current_thread_arch = NULL; ++ + /* Need to forget about any frames we have cached, too. */ + reinit_frame_cache (); + +@@ -509,6 +545,8 @@ regcache_raw_read (struct regcache *regc + { + struct cleanup *old_chain = save_inferior_ptid (); + inferior_ptid = regcache->ptid; ++ save_current_gdbarch (); ++ current_gdbarch = get_regcache_arch (regcache); + target_fetch_registers (regcache, regnum); + do_cleanups (old_chain); + } +@@ -667,6 +705,8 @@ regcache_raw_write (struct regcache *reg + + old_chain = save_inferior_ptid (); + inferior_ptid = regcache->ptid; ++ save_current_gdbarch (); ++ current_gdbarch = get_regcache_arch (regcache); + + target_prepare_to_store (regcache); + memcpy (register_buffer (regcache, regnum), buf, +--- gdb-6.8.50.20081103-cvs/gdb/regcache.h ++++ gdb-6.8.50.20081103-cvs/gdb/regcache.h +@@ -26,6 +26,7 @@ struct gdbarch; + + extern struct regcache *get_current_regcache (void); + extern struct regcache *get_thread_regcache (ptid_t ptid); ++extern struct regcache *get_thread_arch_regcache (ptid_t, struct gdbarch *); + + void regcache_xfree (struct regcache *regcache); + struct cleanup *make_cleanup_regcache_xfree (struct regcache *regcache); +--- gdb-6.8.50.20081103-cvs/gdb/regformats/rs6000/powerpc-cell32l.dat ++++ gdb-6.8.50.20081103-cvs/gdb/regformats/rs6000/powerpc-cell32l.dat @@ -0,0 +1,111 @@ +# DO NOT EDIT: generated from rs6000/powerpc-cell32l.xml +name:powerpc_cell32l @@ -4878,10 +3352,8 @@ Index: gdb-head/gdb/regformats/rs6000/powerpc-cell32l.dat +128:vr31 +32:vscr +32:vrsave -Index: gdb-head/gdb/regformats/rs6000/powerpc-cell64l.dat -=================================================================== ---- /dev/null -+++ gdb-head/gdb/regformats/rs6000/powerpc-cell64l.dat +--- gdb-6.8.50.20081103-cvs/gdb/regformats/rs6000/powerpc-cell64l.dat ++++ gdb-6.8.50.20081103-cvs/gdb/regformats/rs6000/powerpc-cell64l.dat @@ -0,0 +1,111 @@ +# DO NOT EDIT: generated from rs6000/powerpc-cell64l.xml +name:powerpc_cell64l @@ -4994,46 +3466,120 @@ Index: gdb-head/gdb/regformats/rs6000/powerpc-cell64l.dat +128:vr31 +32:vscr +32:vrsave -Index: gdb-head/gdb/configure.tgt -=================================================================== ---- gdb-head.orig/gdb/configure.tgt -+++ gdb-head/gdb/configure.tgt -@@ -349,7 +349,8 @@ powerpc-*-aix* | rs6000-*-*) - powerpc-*-linux* | powerpc64-*-linux*) - # Target: PowerPC running Linux - gdb_target_obs="rs6000-tdep.o ppc-linux-tdep.o ppc-sysv-tdep.o \ -- solib.o solib-svr4.o corelow.o symfile-mem.o" -+ solib.o solib-svr4.o solib-spu.o spu-multiarch.o \ -+ corelow.o symfile-mem.o" - gdb_sim=../sim/ppc/libsim.a - build_gdbserver=yes - ;; -Index: gdb-head/gdb/Makefile.in -=================================================================== ---- gdb-head.orig/gdb/Makefile.in -+++ gdb-head/gdb/Makefile.in -@@ -498,7 +498,7 @@ ALL_TARGET_OBS = \ - sh64-tdep.o sh-linux-tdep.o shnbsd-tdep.o sh-tdep.o \ - sparc-linux-tdep.o sparcnbsd-tdep.o sparcobsd-tdep.o \ - sparc-sol2-tdep.o sparc-tdep.o \ -- spu-tdep.o \ -+ spu-tdep.o spu-multiarch.o solib-spu.o \ - v850-tdep.o \ - vaxnbsd-tdep.o vaxobsd-tdep.o vax-tdep.o \ - xstormy16-tdep.o \ -@@ -1331,7 +1331,7 @@ ALLDEPFILES = \ - sparc64-tdep.c sparc64fbsd-nat.c sparc64fbsd-tdep.c \ - sparc64nbsd-nat.c sparc64nbsd-tdep.c sparc64obsd-tdep.c \ - sparcnbsd-nat.c sparcnbsd-tdep.c sparcobsd-tdep.c \ -- spu-linux-nat.c spu-tdep.c \ -+ spu-linux-nat.c spu-tdep.c spu-multiarch.c solib-spu.c \ - v850-tdep.c \ - vax-nat.c vax-tdep.c vaxbsd-nat.c vaxnbsd-tdep.c \ - win32-nat.c \ -Index: gdb-head/gdb/solib-spu.c -=================================================================== ---- /dev/null -+++ gdb-head/gdb/solib-spu.c +--- gdb-6.8.50.20081103-cvs/gdb/remote.c ++++ gdb-6.8.50.20081103-cvs/gdb/remote.c +@@ -6700,7 +6700,7 @@ remote_insert_breakpoint (struct bp_targ + switch (packet_ok (rs->buf, &remote_protocol_packets[PACKET_Z0])) + { + case PACKET_ERROR: +- return -1; ++ return 1; + case PACKET_OK: + bp_tgt->placed_address = addr; + bp_tgt->placed_size = bpsize; +@@ -6887,7 +6887,7 @@ remote_insert_hw_breakpoint (struct bp_t + (target_gdbarch, &bp_tgt->placed_address, &bp_tgt->placed_size); + + if (remote_protocol_packets[PACKET_Z1].support == PACKET_DISABLE) +- return -1; ++ return 1; + + rs = get_remote_state (); + p = rs->buf; +@@ -6907,7 +6907,7 @@ remote_insert_hw_breakpoint (struct bp_t + { + case PACKET_ERROR: + case PACKET_UNKNOWN: +- return -1; ++ return 1; + case PACKET_OK: + return 0; + } +@@ -6924,7 +6924,7 @@ remote_remove_hw_breakpoint (struct bp_t + char *p = rs->buf; + + if (remote_protocol_packets[PACKET_Z1].support == PACKET_DISABLE) +- return -1; ++ return 1; + + *(p++) = 'z'; + *(p++) = '1'; +@@ -6941,7 +6941,7 @@ remote_remove_hw_breakpoint (struct bp_t + { + case PACKET_ERROR: + case PACKET_UNKNOWN: +- return -1; ++ return 1; + case PACKET_OK: + return 0; + } +--- gdb-6.8.50.20081103-cvs/gdb/sentinel-frame.c ++++ gdb-6.8.50.20081103-cvs/gdb/sentinel-frame.c +@@ -76,11 +76,23 @@ sentinel_frame_this_id (struct frame_inf + internal_error (__FILE__, __LINE__, _("sentinel_frame_this_id called")); + } + ++static struct gdbarch * ++sentinel_frame_prev_arch (struct frame_info *this_frame, ++ void **this_prologue_cache) ++{ ++ struct frame_unwind_cache *cache = *this_prologue_cache; ++ return get_regcache_arch (cache->regcache); ++} ++ + const struct frame_unwind sentinel_frame_unwinder = + { + SENTINEL_FRAME, + sentinel_frame_this_id, +- sentinel_frame_prev_register ++ sentinel_frame_prev_register, ++ NULL, ++ NULL, ++ NULL, ++ sentinel_frame_prev_arch, + }; + + const struct frame_unwind *const sentinel_frame_unwind = &sentinel_frame_unwinder; +--- gdb-6.8.50.20081103-cvs/gdb/sol-thread.c ++++ gdb-6.8.50.20081103-cvs/gdb/sol-thread.c +@@ -1093,7 +1093,7 @@ ps_lgetregs (gdb_ps_prochandle_t ph, lwp + old_chain = save_inferior_ptid (); + + inferior_ptid = BUILD_LWP (lwpid, PIDGET (inferior_ptid)); +- regcache = get_thread_regcache (inferior_ptid); ++ regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch); + + if (target_has_execution) + procfs_ops.to_fetch_registers (regcache, -1); +@@ -1118,7 +1118,7 @@ ps_lsetregs (gdb_ps_prochandle_t ph, lwp + old_chain = save_inferior_ptid (); + + inferior_ptid = BUILD_LWP (lwpid, PIDGET (inferior_ptid)); +- regcache = get_thread_regcache (inferior_ptid); ++ regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch); + + supply_gregset (regcache, (const gdb_gregset_t *) gregset); + if (target_has_execution) +@@ -1229,7 +1229,7 @@ ps_lgetfpregs (gdb_ps_prochandle_t ph, l + old_chain = save_inferior_ptid (); + + inferior_ptid = BUILD_LWP (lwpid, PIDGET (inferior_ptid)); +- regcache = get_thread_regcache (inferior_ptid); ++ regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch); + + if (target_has_execution) + procfs_ops.to_fetch_registers (regcache, -1); +@@ -1254,7 +1254,7 @@ ps_lsetfpregs (gdb_ps_prochandle_t ph, l + old_chain = save_inferior_ptid (); + + inferior_ptid = BUILD_LWP (lwpid, PIDGET (inferior_ptid)); +- regcache = get_thread_regcache (inferior_ptid); ++ regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch); + + supply_fpregset (regcache, (const gdb_fpregset_t *) fpregset); + if (target_has_execution) +--- gdb-6.8.50.20081103-cvs/gdb/solib-spu.c ++++ gdb-6.8.50.20081103-cvs/gdb/solib-spu.c @@ -0,0 +1,478 @@ +/* Cell SPU GNU/Linux support -- shared library handling. + Copyright (C) 2008 Free Software Foundation, Inc. @@ -5513,10 +4059,91 @@ Index: gdb-head/gdb/solib-spu.c + observer_attach_solib_loaded (spu_solib_loaded); +} + -Index: gdb-head/gdb/spu-multiarch.c -=================================================================== ---- /dev/null -+++ gdb-head/gdb/spu-multiarch.c +--- gdb-6.8.50.20081103-cvs/gdb/solib.c ++++ gdb-6.8.50.20081103-cvs/gdb/solib.c +@@ -311,15 +311,22 @@ static int + solib_map_sections (void *arg) + { + struct so_list *so = (struct so_list *) arg; /* catch_errors bogon */ ++ struct target_so_ops *ops = solib_ops (target_gdbarch); + char *filename; + struct section_table *p; + struct cleanup *old_chain; +- bfd *abfd; ++ bfd *abfd = NULL; ++ ++ if (ops->open_bfd) ++ abfd = ops->open_bfd (so->so_name); + +- filename = tilde_expand (so->so_name); +- old_chain = make_cleanup (xfree, filename); +- abfd = solib_bfd_open (filename); +- do_cleanups (old_chain); ++ if (!abfd) ++ { ++ filename = tilde_expand (so->so_name); ++ old_chain = make_cleanup (xfree, filename); ++ abfd = solib_bfd_open (filename); ++ do_cleanups (old_chain); ++ } + + /* Leave bfd open, core_xfer_memory and "info files" need it. */ + so->abfd = abfd; +@@ -338,8 +345,6 @@ solib_map_sections (void *arg) + + for (p = so->sections; p < so->sections_end; p++) + { +- struct target_so_ops *ops = solib_ops (target_gdbarch); +- + /* Relocate the section binding addresses as recorded in the shared + object's file by the base address to which the object was actually + mapped. */ +@@ -420,7 +425,9 @@ static int + symbol_add_stub (void *arg) + { + struct so_list *so = (struct so_list *) arg; /* catch_errs bogon */ ++ struct target_so_ops *ops = solib_ops (target_gdbarch); + struct section_addr_info *sap; ++ bfd *abfd = NULL; + + /* Have we already loaded this shared object? */ + ALL_OBJFILES (so->objfile) +@@ -429,11 +436,18 @@ symbol_add_stub (void *arg) + return 1; + } + ++ /* Open a second BFD for this file. */ ++ if (ops->open_bfd) ++ abfd = ops->open_bfd (so->so_name); ++ ++ if (!abfd) ++ abfd = symfile_bfd_open (so->so_name); ++ + sap = build_section_addr_info_from_section_table (so->sections, + so->sections_end); + +- so->objfile = symbol_file_add (so->so_name, so->from_tty, +- sap, 0, OBJF_SHARED); ++ so->objfile = symbol_file_add_from_bfd (abfd, so->from_tty, ++ sap, 0, OBJF_SHARED); + free_section_addr_info (sap); + + return (1); +--- gdb-6.8.50.20081103-cvs/gdb/solist.h ++++ gdb-6.8.50.20081103-cvs/gdb/solist.h +@@ -118,6 +118,10 @@ struct target_so_ops + and another from the list returned by current_sos, return 1 + if they represent the same library. */ + int (*same) (struct so_list *gdb, struct so_list *inferior); ++ ++ /* Extra hook for opening a BFD for a solib. Can be used to ++ retrieve solibs from inferior memory instead of from files. */ ++ bfd *(*open_bfd) (char *pathname); + }; + + /* Free the memory associated with a (so_list *). */ +--- gdb-6.8.50.20081103-cvs/gdb/spu-multiarch.c ++++ gdb-6.8.50.20081103-cvs/gdb/spu-multiarch.c @@ -0,0 +1,450 @@ +/* Cell SPU GNU/Linux multi-architecture debugging support. + Copyright (C) 2008 Free Software Foundation, Inc. @@ -5968,10 +4595,739 @@ Index: gdb-head/gdb/spu-multiarch.c + add_target (&spu_ops); +} + -Index: gdb-head/gdb/spu-tdep.h -=================================================================== ---- gdb-head.orig/gdb/spu-tdep.h -+++ gdb-head/gdb/spu-tdep.h +--- gdb-6.8.50.20081103-cvs/gdb/spu-tdep.c ++++ gdb-6.8.50.20081103-cvs/gdb/spu-tdep.c +@@ -40,14 +40,31 @@ + #include "regcache.h" + #include "reggroups.h" + #include "floatformat.h" ++#include "block.h" + #include "observer.h" ++#include "infcall.h" + + #include "spu-tdep.h" + + ++/* The list of available "set spu " and "show spu " commands. */ ++static struct cmd_list_element *setspucmdlist = NULL; ++static struct cmd_list_element *showspucmdlist = NULL; ++ ++/* Whether to stop for new SPE contexts. */ ++static int spu_stop_on_load_p = 0; ++/* Whether to automatically flush the SW-managed cache. */ ++static int spu_auto_flush_cache_p = 1; ++ ++ + /* The tdep structure. */ + struct gdbarch_tdep + { ++ /* The spufs ID identifying our address space. */ ++ int id; ++ /* The size of this address space. */ ++ CORE_ADDR lslr; ++ + /* SPU-specific vector type. */ + struct type *spu_builtin_type_vec128; + }; +@@ -324,33 +341,87 @@ spu_register_reggroup_p (struct gdbarch + return default_register_reggroup_p (gdbarch, regnum, group); + } + +-/* Address conversion. */ ++ ++/* Address handling. */ + + static CORE_ADDR +-spu_pointer_to_address (struct type *type, const gdb_byte *buf) ++spu_lslr (int id) + { ++ gdb_byte buf[16]; ++ char annex[32]; ++ ++ xsnprintf (annex, sizeof annex, "%d/lslr", id); ++ memset (buf, 0, sizeof buf); ++ target_read (¤t_target, TARGET_OBJECT_SPU, annex, ++ buf, 0, sizeof buf); ++ ++ return strtoulst (buf, NULL, 16); ++} ++ ++static int ++spu_address_class_type_flags (int byte_size, int dwarf2_addr_class) ++{ ++ if (dwarf2_addr_class == 1) ++ return TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1; ++ else ++ return 0; ++} ++ ++static const char * ++spu_address_class_type_flags_to_name (struct gdbarch *gdbarch, int type_flags) ++{ ++ if (type_flags & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1) ++ return "__ea"; ++ else ++ return NULL; ++} ++ ++static int ++spu_address_class_name_to_type_flags (struct gdbarch *gdbarch, ++ const char *name, int *type_flags_ptr) ++{ ++ if (strcmp (name, "__ea") == 0) ++ { ++ *type_flags_ptr = TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1; ++ return 1; ++ } ++ else ++ return 0; ++} ++ ++static void ++spu_address_to_pointer (struct gdbarch *gdbarch, ++ struct type *type, gdb_byte *buf, CORE_ADDR addr) ++{ ++ store_unsigned_integer (buf, TYPE_LENGTH (type), SPUADDR_ADDR (addr)); ++} ++ ++static CORE_ADDR ++spu_pointer_to_address (struct gdbarch *gdbarch, ++ struct type *type, const gdb_byte *buf) ++{ ++ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + ULONGEST addr = extract_unsigned_integer (buf, TYPE_LENGTH (type)); +- ULONGEST lslr = SPU_LS_SIZE - 1; /* Hard-wired LS size. */ + +- if (target_has_registers && target_has_stack && target_has_memory) +- lslr = get_frame_register_unsigned (get_selected_frame (NULL), +- SPU_LSLR_REGNUM); ++ /* Do not convert __ea pointers. */ ++ if (TYPE_ADDRESS_CLASS_1 (type)) ++ return addr; + +- return addr & lslr; ++ return addr? SPUADDR (tdep->id, addr & tdep->lslr) : 0; + } + + static CORE_ADDR + spu_integer_to_address (struct gdbarch *gdbarch, + struct type *type, const gdb_byte *buf) + { ++ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + ULONGEST addr = unpack_long (type, buf); +- ULONGEST lslr = SPU_LS_SIZE - 1; /* Hard-wired LS size. */ + +- if (target_has_registers && target_has_stack && target_has_memory) +- lslr = get_frame_register_unsigned (get_selected_frame (NULL), +- SPU_LSLR_REGNUM); ++ /* Do not convert __ea pointers. */ ++ if (TYPE_ADDRESS_CLASS_1 (type)) ++ return addr; + +- return addr & lslr; ++ return SPUADDR (tdep->id, addr & tdep->lslr); + } + + +@@ -840,8 +911,11 @@ static struct spu_unwind_cache * + spu_frame_unwind_cache (struct frame_info *this_frame, + void **this_prologue_cache) + { ++ struct gdbarch *gdbarch = get_frame_arch (this_frame); ++ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + struct spu_unwind_cache *info; + struct spu_prologue_data data; ++ CORE_ADDR id = tdep->id; + gdb_byte buf[16]; + + if (*this_prologue_cache) +@@ -874,6 +948,7 @@ spu_frame_unwind_cache (struct frame_inf + /* Determine CFA via unwound CFA_REG plus CFA_OFFSET. */ + get_frame_register (this_frame, data.cfa_reg, buf); + cfa = extract_unsigned_integer (buf, 4) + data.cfa_offset; ++ cfa = SPUADDR (id, cfa); + + /* Call-saved register slots. */ + for (i = 0; i < SPU_NUM_GPRS; i++) +@@ -896,7 +971,7 @@ spu_frame_unwind_cache (struct frame_inf + + /* Get the backchain. */ + reg = get_frame_register_unsigned (this_frame, SPU_SP_REGNUM); +- status = safe_read_memory_integer (reg, 4, &backchain); ++ status = safe_read_memory_integer (SPUADDR (id, reg), 4, &backchain); + + /* A zero backchain terminates the frame chain. Also, sanity + check against the local store size limit. */ +@@ -904,11 +979,11 @@ spu_frame_unwind_cache (struct frame_inf + { + /* Assume the link register is saved into its slot. */ + if (backchain + 16 < SPU_LS_SIZE) +- info->saved_regs[SPU_LR_REGNUM].addr = backchain + 16; ++ info->saved_regs[SPU_LR_REGNUM].addr = SPUADDR (id, backchain + 16); + + /* Frame bases. */ +- info->frame_base = backchain; +- info->local_base = reg; ++ info->frame_base = SPUADDR (id, backchain); ++ info->local_base = SPUADDR (id, reg); + } + } + +@@ -917,7 +992,8 @@ spu_frame_unwind_cache (struct frame_inf + return info; + + /* The previous SP is equal to the CFA. */ +- trad_frame_set_value (info->saved_regs, SPU_SP_REGNUM, info->frame_base); ++ trad_frame_set_value (info->saved_regs, SPU_SP_REGNUM, ++ SPUADDR_ADDR (info->frame_base)); + + /* Read full contents of the unwound link register in order to + be able to determine the return address. */ +@@ -995,24 +1071,28 @@ static const struct frame_base spu_frame + static CORE_ADDR + spu_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) + { ++ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + CORE_ADDR pc = frame_unwind_register_unsigned (next_frame, SPU_PC_REGNUM); + /* Mask off interrupt enable bit. */ +- return pc & -4; ++ return SPUADDR (tdep->id, pc & -4); + } + + static CORE_ADDR + spu_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame) + { +- return frame_unwind_register_unsigned (next_frame, SPU_SP_REGNUM); ++ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); ++ CORE_ADDR sp = frame_unwind_register_unsigned (next_frame, SPU_SP_REGNUM); ++ return SPUADDR (tdep->id, sp); + } + + static CORE_ADDR + spu_read_pc (struct regcache *regcache) + { ++ struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache)); + ULONGEST pc; + regcache_cooked_read_unsigned (regcache, SPU_PC_REGNUM, &pc); + /* Mask off interrupt enable bit. */ +- return pc & -4; ++ return SPUADDR (tdep->id, pc & -4); + } + + static void +@@ -1022,9 +1102,111 @@ spu_write_pc (struct regcache *regcache, + ULONGEST old_pc; + regcache_cooked_read_unsigned (regcache, SPU_PC_REGNUM, &old_pc); + regcache_cooked_write_unsigned (regcache, SPU_PC_REGNUM, +- (pc & -4) | (old_pc & 3)); ++ (SPUADDR_ADDR (pc) & -4) | (old_pc & 3)); ++} ++ ++ ++/* Cell/B.E. cross-architecture unwinder support. */ ++ ++struct spu2ppu_cache ++{ ++ struct frame_id frame_id; ++ struct regcache *regcache; ++}; ++ ++static struct gdbarch * ++spu2ppu_prev_arch (struct frame_info *this_frame, void **this_cache) ++{ ++ struct spu2ppu_cache *cache = *this_cache; ++ return get_regcache_arch (cache->regcache); ++} ++ ++static void ++spu2ppu_this_id (struct frame_info *this_frame, ++ void **this_cache, struct frame_id *this_id) ++{ ++ struct spu2ppu_cache *cache = *this_cache; ++ *this_id = cache->frame_id; + } + ++static struct value * ++spu2ppu_prev_register (struct frame_info *this_frame, ++ void **this_cache, int regnum) ++{ ++ struct spu2ppu_cache *cache = *this_cache; ++ struct gdbarch *gdbarch = get_regcache_arch (cache->regcache); ++ gdb_byte *buf; ++ ++ buf = alloca (register_size (gdbarch, regnum)); ++ regcache_cooked_read (cache->regcache, regnum, buf); ++ return frame_unwind_got_bytes (this_frame, regnum, buf); ++} ++ ++static int ++spu2ppu_sniffer (const struct frame_unwind *self, ++ struct frame_info *this_frame, void **this_prologue_cache) ++{ ++ CORE_ADDR base, func, backchain; ++ gdb_byte buf[4]; ++ ++ if (gdbarch_bfd_arch_info (target_gdbarch)->arch == bfd_arch_spu) ++ return 0; ++ ++ base = get_frame_sp (this_frame); ++ func = get_frame_pc (this_frame); ++ if (target_read_memory (base, buf, 4)) ++ return 0; ++ backchain = extract_unsigned_integer (buf, 4); ++ ++ if (!backchain) ++ { ++ struct frame_info *fi; ++ ++ struct spu2ppu_cache *cache ++ = FRAME_OBSTACK_CALLOC (1, struct spu2ppu_cache); ++ ++ cache->frame_id = frame_id_build (base + 16, func); ++ ++ for (fi = get_next_frame (this_frame); fi; fi = get_next_frame (fi)) ++ if (gdbarch_bfd_arch_info (get_frame_arch (fi))->arch != bfd_arch_spu) ++ break; ++ ++ if (fi) ++ { ++ cache->regcache = frame_save_as_regcache (fi); ++ *this_prologue_cache = cache; ++ return 1; ++ } ++ else ++ { ++ struct regcache *regcache; ++ regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch); ++ cache->regcache = regcache_dup (regcache); ++ *this_prologue_cache = cache; ++ return 1; ++ } ++ } ++ ++ return 0; ++} ++ ++static void ++spu2ppu_dealloc_cache (struct frame_info *self, void *this_cache) ++{ ++ struct spu2ppu_cache *cache = this_cache; ++ regcache_xfree (cache->regcache); ++} ++ ++static const struct frame_unwind spu2ppu_unwind = { ++ ARCH_FRAME, ++ spu2ppu_this_id, ++ spu2ppu_prev_register, ++ NULL, ++ spu2ppu_sniffer, ++ spu2ppu_dealloc_cache, ++ spu2ppu_prev_arch, ++}; ++ + + /* Function calling convention. */ + +@@ -1133,7 +1315,7 @@ spu_push_dummy_call (struct gdbarch *gdb + + /* Set the return address. */ + memset (buf, 0, sizeof buf); +- store_unsigned_integer (buf, 4, bp_addr); ++ store_unsigned_integer (buf, 4, SPUADDR_ADDR (bp_addr)); + regcache_cooked_write (regcache, SPU_LR_REGNUM, buf); + + /* If STRUCT_RETURN is true, then the struct return address (in +@@ -1142,7 +1324,7 @@ spu_push_dummy_call (struct gdbarch *gdb + if (struct_return) + { + memset (buf, 0, sizeof buf); +- store_unsigned_integer (buf, 4, struct_addr); ++ store_unsigned_integer (buf, 4, SPUADDR_ADDR (struct_addr)); + regcache_cooked_write (regcache, regnum++, buf); + } + +@@ -1220,9 +1402,10 @@ spu_push_dummy_call (struct gdbarch *gdb + static struct frame_id + spu_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame) + { ++ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + CORE_ADDR pc = get_frame_register_unsigned (this_frame, SPU_PC_REGNUM); + CORE_ADDR sp = get_frame_register_unsigned (this_frame, SPU_SP_REGNUM); +- return frame_id_build (sp, pc & -4); ++ return frame_id_build (SPUADDR (tdep->id, sp), SPUADDR (tdep->id, pc & -4)); + } + + /* Function return value access. */ +@@ -1302,18 +1485,18 @@ spu_software_single_step (struct frame_i + instruction is a PPE-assisted call, in which case it is at PC + 8. + Wrap around LS limit to be on the safe side. */ + if ((insn & 0xffffff00) == 0x00002100) +- next_pc = (pc + 8) & (SPU_LS_SIZE - 1); ++ next_pc = (SPUADDR_ADDR (pc) + 8) & (SPU_LS_SIZE - 1); + else +- next_pc = (pc + 4) & (SPU_LS_SIZE - 1); ++ next_pc = (SPUADDR_ADDR (pc) + 4) & (SPU_LS_SIZE - 1); + +- insert_single_step_breakpoint (next_pc); ++ insert_single_step_breakpoint (SPUADDR (SPUADDR_SPU (pc), next_pc)); + + if (is_branch (insn, &offset, ®)) + { + CORE_ADDR target = offset; + + if (reg == SPU_PC_REGNUM) +- target += pc; ++ target += SPUADDR_ADDR (pc); + else if (reg != -1) + { + get_frame_register_bytes (frame, reg, 0, 4, buf); +@@ -1322,12 +1505,35 @@ spu_software_single_step (struct frame_i + + target = target & (SPU_LS_SIZE - 1); + if (target != next_pc) +- insert_single_step_breakpoint (target); ++ insert_single_step_breakpoint (SPUADDR (SPUADDR_SPU (pc), target)); + } + + return 1; + } + ++ ++/* Disassembler. */ ++ ++static void ++spu_dis_asm_print_address (bfd_vma addr, struct disassemble_info *info) ++{ ++ int id = *(int *)info->application_data; ++ CORE_ADDR spu_addr = SPUADDR (id, addr); ++ print_address (spu_addr, info->stream); ++} ++ ++static int ++gdb_print_insn_spu (bfd_vma memaddr, disassemble_info * info) ++{ ++ /* The opcodes disassembler does 18-bit address arithmetic. Make sure the ++ SPU ID encoded in the high bits is added back when we call print_address. */ ++ int id = SPUADDR_SPU (memaddr); ++ info->application_data = &id; ++ info->print_address_func = spu_dis_asm_print_address; ++ return print_insn_spu (memaddr, info); ++} ++ ++ + /* Target overlays for the SPU overlay manager. + + See the documentation of simple_overlay_update for how the +@@ -1444,7 +1650,7 @@ static void + spu_overlay_update_osect (struct obj_section *osect) + { + struct spu_overlay_table *ovly_table; +- CORE_ADDR val; ++ CORE_ADDR id, val; + + ovly_table = spu_get_overlay_table (osect->objfile); + if (!ovly_table) +@@ -1454,7 +1660,8 @@ spu_overlay_update_osect (struct obj_sec + if (ovly_table->mapped_ptr == 0) + return; + +- val = read_memory_unsigned_integer (ovly_table->mapped_ptr, 4); ++ id = SPUADDR_SPU (obj_section_addr (osect)); ++ val = read_memory_unsigned_integer (SPUADDR (id, ovly_table->mapped_ptr), 4); + osect->ovly_mapped = (val == ovly_table->mapped_val); + } + +@@ -1516,6 +1723,131 @@ spu_overlay_new_objfile (struct objfile + } + + ++/* Insert temporary breakpoint on "main" function of newly loaded ++ SPE context OBJFILE. */ ++static void ++spu_catch_start (struct objfile *objfile) ++{ ++ struct minimal_symbol *minsym; ++ struct symtab *symtab; ++ CORE_ADDR pc; ++ char buf[32]; ++ ++ /* Do this only if requested by "set spu stop-on-load on". */ ++ if (!spu_stop_on_load_p) ++ return; ++ ++ /* Consider only SPU objfiles. */ ++ if (!objfile || bfd_get_arch (objfile->obfd) != bfd_arch_spu) ++ return; ++ ++ /* The main objfile is handled differently. */ ++ if (objfile == symfile_objfile) ++ return; ++ ++ /* There can be multiple symbols named "main". Search for the ++ "main" in *this* objfile. */ ++ minsym = lookup_minimal_symbol ("main", NULL, objfile); ++ if (!minsym) ++ return; ++ ++ /* If we have debugging information, try to use it -- this ++ will allow us to properly skip the prologue. */ ++ pc = SYMBOL_VALUE_ADDRESS (minsym); ++ symtab = find_pc_sect_symtab (pc, SYMBOL_OBJ_SECTION (minsym)); ++ if (symtab != NULL) ++ { ++ struct blockvector *bv = BLOCKVECTOR (symtab); ++ struct block *block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK); ++ struct symbol *sym; ++ struct symtab_and_line sal; ++ ++ sym = lookup_block_symbol (block, "main", NULL, VAR_DOMAIN); ++ if (sym) ++ { ++ fixup_symbol_section (sym, objfile); ++ sal = find_function_start_sal (sym, 1); ++ pc = sal.pc; ++ } ++ } ++ ++ /* Use a numerical address for the tbreak command to avoid having ++ the breakpoint re-set incorrectly. */ ++ xsnprintf (buf, sizeof buf, "*%s", core_addr_to_string (pc)); ++ tbreak_command (buf, 0); ++} ++ ++/* Lookup OBJFILE corresponding to the current SPU context. */ ++static struct objfile * ++spu_objfile_from_context (void) ++{ ++ struct frame_info *frame = get_current_frame (); ++ struct gdbarch *gdbarch = get_frame_arch (frame); ++ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); ++ struct objfile *obj; ++ ++ if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_spu) ++ return NULL; ++ ++ ALL_OBJFILES (obj) ++ { ++ if (obj->sections != obj->sections_end ++ && SPUADDR_SPU (obj_section_addr (obj->sections)) == tdep->id) ++ return obj; ++ } ++ ++ return NULL; ++} ++ ++/* Flush cache for ea pointer access if available and return 1. Return 0 if ++ inferior call was not executed. */ ++static void ++flush_ea_cache (void) ++{ ++ struct value *ea_flush_fn = NULL; ++ struct minimal_symbol *msymbol; ++ struct objfile *obj; ++ ++ obj = spu_objfile_from_context (); ++ if (obj == NULL) ++ return; ++ ++ /* Lookup inferior function __cache_flush. */ ++ msymbol = lookup_minimal_symbol ("__cache_flush", NULL, obj); ++ if (msymbol != NULL) ++ { ++ struct type *type; ++ CORE_ADDR addr; ++ ++ type = builtin_type_void; ++ type = lookup_function_type (type); ++ type = lookup_pointer_type (type); ++ addr = SYMBOL_VALUE_ADDRESS (msymbol); ++ ea_flush_fn = value_from_pointer (type, addr); ++ } ++ ++ if (ea_flush_fn) ++ call_function_by_hand (ea_flush_fn, 0, NULL); ++} ++ ++/* This handler is called when the inferior has stopped. If it is stopped in ++ SPU architecture then flush the ea cache if used. */ ++static void ++spu_attach_normal_stop (struct bpstats *bs) ++{ ++ if (!spu_auto_flush_cache_p) ++ return; ++ ++ if (!target_has_registers || !target_has_stack || !target_has_memory) ++ return; ++ ++ /* Temporarily reset the spu_auto_flush_cache_p to avoid recursively ++ re-entering this function when __cache_flush stops. */ ++ spu_auto_flush_cache_p = 0; ++ flush_ea_cache (); ++ spu_auto_flush_cache_p = 1; ++} ++ + /* "info spu" commands. */ + + static void +@@ -2065,6 +2397,37 @@ info_spu_command (char *args, int from_t + } + + ++/* Root of all "set spu "/"show spu " commands. */ ++ ++static void ++show_spu_command (char *args, int from_tty) ++{ ++ help_list (showspucmdlist, "show spu ", all_commands, gdb_stdout); ++} ++ ++static void ++set_spu_command (char *args, int from_tty) ++{ ++ help_list (setspucmdlist, "set spu ", all_commands, gdb_stdout); ++} ++ ++static void ++show_spu_stop_on_load (struct ui_file *file, int from_tty, ++ struct cmd_list_element *c, const char *value) ++{ ++ fprintf_filtered (file, _("Stopping for new SPE threads is %s.\n"), ++ value); ++} ++ ++static void ++show_spu_auto_flush_cache (struct ui_file *file, int from_tty, ++ struct cmd_list_element *c, const char *value) ++{ ++ fprintf_filtered (file, _("Automatic software-cache flush is %s.\n"), ++ value); ++} ++ ++ + /* Set up gdbarch struct. */ + + static struct gdbarch * +@@ -2072,22 +2435,30 @@ spu_gdbarch_init (struct gdbarch_info in + { + struct gdbarch *gdbarch; + struct gdbarch_tdep *tdep; ++ int id = -1; + +- /* Find a candidate among the list of pre-declared architectures. */ +- arches = gdbarch_list_lookup_by_info (arches, &info); +- if (arches != NULL) +- return arches->gdbarch; ++ /* Which spufs ID was requested as address space? */ ++ if (info.tdep_info) ++ id = *(int *)info.tdep_info; + +- /* Is is for us? */ +- if (info.bfd_arch_info->mach != bfd_mach_spu) +- return NULL; ++ /* Find a candidate among extant architectures. */ ++ for (arches = gdbarch_list_lookup_by_info (arches, &info); ++ arches != NULL; ++ arches = gdbarch_list_lookup_by_info (arches->next, &info)) ++ { ++ tdep = gdbarch_tdep (arches->gdbarch); ++ if (tdep && tdep->id == id) ++ return arches->gdbarch; ++ } + +- /* Yes, create a new architecture. */ ++ /* None found, so create a new architecture. */ + tdep = XCALLOC (1, struct gdbarch_tdep); ++ tdep->id = id; ++ tdep->lslr = id != -1? spu_lslr (id) : SPU_LS_SIZE - 1; + gdbarch = gdbarch_alloc (&info, tdep); + + /* Disassembler. */ +- set_gdbarch_print_insn (gdbarch, print_insn_spu); ++ set_gdbarch_print_insn (gdbarch, gdb_print_insn_spu); + + /* Registers. */ + set_gdbarch_num_regs (gdbarch, SPU_NUM_REGS); +@@ -2118,9 +2489,16 @@ spu_gdbarch_init (struct gdbarch_info in + set_gdbarch_double_format (gdbarch, floatformats_ieee_double); + set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double); + +- /* Address conversion. */ ++ /* Address handling. */ ++ set_gdbarch_address_to_pointer (gdbarch, spu_address_to_pointer); + set_gdbarch_pointer_to_address (gdbarch, spu_pointer_to_address); + set_gdbarch_integer_to_address (gdbarch, spu_integer_to_address); ++ set_gdbarch_address_class_type_flags (gdbarch, spu_address_class_type_flags); ++ set_gdbarch_address_class_type_flags_to_name ++ (gdbarch, spu_address_class_type_flags_to_name); ++ set_gdbarch_address_class_name_to_type_flags ++ (gdbarch, spu_address_class_name_to_type_flags); ++ + + /* Inferior function calls. */ + set_gdbarch_call_dummy_location (gdbarch, ON_STACK); +@@ -2142,6 +2520,9 @@ spu_gdbarch_init (struct gdbarch_info in + set_gdbarch_skip_prologue (gdbarch, spu_skip_prologue); + set_gdbarch_in_function_epilogue_p (gdbarch, spu_in_function_epilogue_p); + ++ /* Cell/B.E. cross-architecture unwinder support. */ ++ frame_unwind_prepend_unwinder (gdbarch, &spu2ppu_unwind); ++ + /* Breakpoints. */ + set_gdbarch_decr_pc_after_break (gdbarch, 4); + set_gdbarch_breakpoint_from_pc (gdbarch, spu_breakpoint_from_pc); +@@ -2163,6 +2544,50 @@ _initialize_spu_tdep (void) + observer_attach_new_objfile (spu_overlay_new_objfile); + spu_overlay_data = register_objfile_data (); + ++ /* Install spu stop-on-load handler. */ ++ observer_attach_new_objfile (spu_catch_start); ++ ++ /* Add ourselves to normal_stop event chain. */ ++ observer_attach_normal_stop (spu_attach_normal_stop); ++ ++ /* Add root prefix command for all "set spu"/"show spu" commands. */ ++ add_prefix_cmd ("spu", no_class, set_spu_command, ++ _("Various SPU specific commands."), ++ &setspucmdlist, "set spu ", 0, &setlist); ++ add_prefix_cmd ("spu", no_class, show_spu_command, ++ _("Various SPU specific commands."), ++ &showspucmdlist, "show spu ", 0, &showlist); ++ ++ /* Toggle whether or not to add a temporary breakpoint at the "main" ++ function of new SPE contexts. */ ++ add_setshow_boolean_cmd ("stop-on-load", class_support, ++ &spu_stop_on_load_p, _("\ ++Set whether to stop for new SPE threads."), ++ _("\ ++Show whether to stop for new SPE threads."), ++ _("\ ++Use \"on\" to give control to the user when a new SPE thread\n\ ++enters its \"main\" function.\n\ ++Use \"off\" to disable stopping for new SPE threads."), ++ NULL, ++ show_spu_stop_on_load, ++ &setspucmdlist, &showspucmdlist); ++ ++ /* Toggle whether or not to automatically flush the software-managed ++ cache whenever SPE execution stops. */ ++ add_setshow_boolean_cmd ("auto-flush-cache", class_support, ++ &spu_auto_flush_cache_p, _("\ ++Set whether to automatically flush the software-managed cache."), ++ _("\ ++Show whether to automatically flush the software-managed cache."), ++ _("\ ++Use \"on\" to automatically flush the software-managed cache\n\ ++whenever SPE execution stops.\n\ ++Use \"off\" to never automatically flush the software-managed cache."), ++ NULL, ++ show_spu_auto_flush_cache, ++ &setspucmdlist, &showspucmdlist); ++ + /* Add root prefix command for all "info spu" commands. */ + add_prefix_cmd ("spu", class_info, info_spu_command, + _("Various SPU specific commands."), +--- gdb-6.8.50.20081103-cvs/gdb/spu-tdep.h ++++ gdb-6.8.50.20081103-cvs/gdb/spu-tdep.h @@ -50,4 +50,17 @@ enum spu_regnum /* Local store. */ #define SPU_LS_SIZE 0x40000 @@ -5990,10 +5346,385 @@ Index: gdb-head/gdb/spu-tdep.h +extern void spu_multiarch_disable (void); + #endif -Index: gdb-head/gdb/testsuite/gdb.xml/tdesc-regs.exp -=================================================================== ---- gdb-head.orig/gdb/testsuite/gdb.xml/tdesc-regs.exp -+++ gdb-head/gdb/testsuite/gdb.xml/tdesc-regs.exp +--- gdb-6.8.50.20081103-cvs/gdb/stack.c ++++ gdb-6.8.50.20081103-cvs/gdb/stack.c +@@ -45,6 +45,7 @@ + #include "valprint.h" + #include "gdbthread.h" + #include "cp-support.h" ++#include "arch-utils.h" + + #include "gdb_assert.h" + #include +@@ -109,6 +110,8 @@ print_stack_frame (struct frame_info *fr + enum print_what print_what) + { + struct print_stack_frame_args args; ++ struct cleanup *old_chain = save_current_gdbarch (); ++ current_gdbarch = get_frame_arch (frame); + + args.frame = frame; + args.print_level = print_level; +@@ -118,6 +121,7 @@ print_stack_frame (struct frame_info *fr + args.print_args = 1; + + catch_errors (print_stack_frame_stub, &args, "", RETURN_MASK_ERROR); ++ do_cleanups (old_chain); + } + + struct print_args_args +@@ -223,6 +227,9 @@ print_frame_args (struct symbol *func, s + stb = ui_out_stream_new (uiout); + old_chain = make_cleanup_ui_out_stream_delete (stb); + ++ save_current_gdbarch (); ++ current_gdbarch = get_frame_arch (frame); ++ + if (func) + { + struct block *b = SYMBOL_BLOCK_VALUE (func); +@@ -474,9 +481,11 @@ print_frame_info (struct frame_info *fra + struct symtab_and_line sal; + int source_print; + int location_print; ++ struct cleanup *old_chain; + + if (get_frame_type (frame) == DUMMY_FRAME +- || get_frame_type (frame) == SIGTRAMP_FRAME) ++ || get_frame_type (frame) == SIGTRAMP_FRAME ++ || get_frame_type (frame) == ARCH_FRAME) + { + struct cleanup *uiout_cleanup + = make_cleanup_ui_out_tuple_begin_end (uiout, "frame"); +@@ -509,6 +518,10 @@ print_frame_info (struct frame_info *fra + annotate_signal_handler_caller (); + ui_out_field_string (uiout, "func", ""); + } ++ else if (get_frame_type (frame) == ARCH_FRAME) ++ { ++ ui_out_field_string (uiout, "func", ""); ++ } + ui_out_text (uiout, "\n"); + annotate_frame_end (); + +@@ -522,6 +535,10 @@ print_frame_info (struct frame_info *fra + the next frame is a SIGTRAMP_FRAME or a DUMMY_FRAME, then the + next frame was not entered as the result of a call, and we want + to get the line containing FRAME->pc. */ ++ ++ old_chain = save_current_gdbarch (); ++ current_gdbarch = get_frame_arch (frame); ++ + find_frame_sal (frame, &sal); + + location_print = (print_what == LOCATION +@@ -577,6 +594,7 @@ print_frame_info (struct frame_info *fra + annotate_frame_end (); + + gdb_flush (gdb_stdout); ++ do_cleanups (old_chain); + } + + static void +@@ -1440,6 +1458,7 @@ static void + print_frame_local_vars (struct frame_info *frame, int num_tabs, + struct ui_file *stream) + { ++ struct cleanup *old_chain; + struct block *block = get_frame_block (frame, 0); + int values_printed = 0; + +@@ -1449,6 +1468,9 @@ print_frame_local_vars (struct frame_inf + return; + } + ++ old_chain = save_current_gdbarch (); ++ current_gdbarch = get_frame_arch (frame); ++ + while (block) + { + if (print_block_frame_locals (block, frame, num_tabs, stream)) +@@ -1462,6 +1484,8 @@ print_frame_local_vars (struct frame_inf + + if (!values_printed) + fprintf_filtered (stream, _("No locals.\n")); ++ ++ do_cleanups (old_chain); + } + + /* Same, but print labels. */ +--- gdb-6.8.50.20081103-cvs/gdb/target-descriptions.c ++++ gdb-6.8.50.20081103-cvs/gdb/target-descriptions.c +@@ -104,6 +104,10 @@ typedef struct tdesc_feature + } *tdesc_feature_p; + DEF_VEC_P(tdesc_feature_p); + ++/* A compatible architecture from a target description. */ ++typedef const struct bfd_arch_info *arch_p; ++DEF_VEC_P(arch_p); ++ + /* A target description. */ + + struct target_desc +@@ -111,6 +115,9 @@ struct target_desc + /* The architecture reported by the target, if any. */ + const struct bfd_arch_info *arch; + ++ /* The list of compatible architectures reported by the target. */ ++ VEC(arch_p) *compatible; ++ + /* Any architecture-specific properties specified by the target. */ + VEC(property_s) *properties; + +@@ -290,6 +297,28 @@ tdesc_architecture (const struct target_ + { + return target_desc->arch; + } ++ ++/* Return non-zero if this target description is compatible ++ with the given BFD architecture. */ ++ ++int ++tdesc_compatible_p (const struct target_desc *target_desc, ++ const struct bfd_arch_info *arch) ++{ ++ const struct bfd_arch_info *compat; ++ int ix; ++ ++ for (ix = 0; VEC_iterate (arch_p, target_desc->compatible, ix, compat); ++ ix++) ++ { ++ if (compat == arch ++ || arch->compatible (arch, compat) ++ || compat->compatible (compat, arch)) ++ return 1; ++ } ++ ++ return 0; ++} + + + /* Return 1 if this target description includes any registers. */ +@@ -885,6 +914,8 @@ free_target_description (void *arg) + } + VEC_free (property_s, target_desc->properties); + ++ VEC_free (arch_p, target_desc->compatible); ++ + xfree (target_desc); + } + +@@ -895,6 +926,30 @@ make_cleanup_free_target_description (st + } + + void ++tdesc_add_compatible (struct target_desc *target_desc, ++ const struct bfd_arch_info *compatible) ++{ ++ const struct bfd_arch_info *compat; ++ int ix; ++ ++ /* If this instance of GDB is compiled without BFD support for the ++ compatible architecture, simply ignore it -- we would not be able ++ to handle it anyway. */ ++ if (compatible == NULL) ++ return; ++ ++ for (ix = 0; VEC_iterate (arch_p, target_desc->compatible, ix, compat); ++ ix++) ++ if (compat == compatible) ++ internal_error (__FILE__, __LINE__, ++ _("Attempted to add duplicate " ++ "compatible architecture \"%s\""), ++ compatible->printable_name); ++ ++ VEC_safe_push (arch_p, target_desc->compatible, compatible); ++} ++ ++void + set_tdesc_property (struct target_desc *target_desc, + const char *key, const char *value) + { +@@ -993,6 +1048,7 @@ static void + maint_print_c_tdesc_cmd (char *args, int from_tty) + { + const struct target_desc *tdesc; ++ const struct bfd_arch_info *compatible; + const char *filename, *inp; + char *function, *outp; + struct property *prop; +@@ -1049,6 +1105,16 @@ maint_print_c_tdesc_cmd (char *args, int + printf_unfiltered ("\n"); + } + ++ for (ix = 0; VEC_iterate (arch_p, tdesc->compatible, ix, compatible); ++ ix++) ++ { ++ printf_unfiltered ++ (" tdesc_add_compatible (result, bfd_scan_arch (\"%s\"));\n", ++ compatible->printable_name); ++ } ++ if (ix) ++ printf_unfiltered ("\n"); ++ + for (ix = 0; VEC_iterate (property_s, tdesc->properties, ix, prop); + ix++) + { +--- gdb-6.8.50.20081103-cvs/gdb/target-descriptions.h ++++ gdb-6.8.50.20081103-cvs/gdb/target-descriptions.h +@@ -123,6 +123,12 @@ int tdesc_numbered_register_choices (con + const struct bfd_arch_info *tdesc_architecture + (const struct target_desc *); + ++/* Return non-zero if this target description is compatible ++ with the given BFD architecture. */ ++ ++int tdesc_compatible_p (const struct target_desc *, ++ const struct bfd_arch_info *); ++ + /* Return the string value of a property named KEY, or NULL if the + property was not specified. */ + +@@ -169,6 +175,8 @@ void set_tdesc_architecture (struct targ + const struct bfd_arch_info *); + void set_tdesc_property (struct target_desc *, + const char *key, const char *value); ++void tdesc_add_compatible (struct target_desc *, ++ const struct bfd_arch_info *); + + struct tdesc_feature *tdesc_create_feature (struct target_desc *tdesc, + const char *name); +--- gdb-6.8.50.20081103-cvs/gdb/target.c ++++ gdb-6.8.50.20081103-cvs/gdb/target.c +@@ -91,6 +91,9 @@ static LONGEST target_xfer_partial (stru + void *readbuf, const void *writebuf, + ULONGEST offset, LONGEST len); + ++static struct gdbarch *default_thread_architecture (struct target_ops *ops, ++ ptid_t ptid); ++ + static void init_dummy_target (void); + + static struct target_ops debug_target; +@@ -467,6 +470,7 @@ update_current_target (void) + INHERIT (to_find_memory_regions, t); + INHERIT (to_make_corefile_notes, t); + INHERIT (to_get_thread_local_address, t); ++ INHERIT (to_thread_architecture, t); + INHERIT (to_can_execute_reverse, t); + /* Do not inherit to_read_description. */ + INHERIT (to_get_ada_task_ptid, t); +@@ -635,6 +639,8 @@ update_current_target (void) + de_fault (to_async_mask, + (int (*) (int)) + return_one); ++ de_fault (to_thread_architecture, ++ default_thread_architecture); + current_target.to_read_description = NULL; + de_fault (to_get_ada_task_ptid, + (ptid_t (*) (long, long)) +@@ -2058,7 +2064,8 @@ target_require_runnable (void) + /* Do not worry about thread_stratum targets that can not + create inferiors. Assume they will be pushed again if + necessary, and continue to the process_stratum. */ +- if (t->to_stratum == thread_stratum) ++ if (t->to_stratum == thread_stratum ++ || t->to_stratum == arch_stratum) + continue; + + error (_("\ +@@ -2197,6 +2204,12 @@ default_watchpoint_addr_within_range (st + return addr >= start && addr < start + length; + } + ++static struct gdbarch * ++default_thread_architecture (struct target_ops *ops, ptid_t ptid) ++{ ++ return target_gdbarch; ++} ++ + static int + return_zero (void) + { +@@ -3069,6 +3082,19 @@ debug_to_find_new_threads (void) + fputs_unfiltered ("target_find_new_threads ()\n", gdb_stdlog); + } + ++static struct gdbarch * ++debug_to_thread_architecture (struct target_ops *ops, ptid_t ptid) ++{ ++ struct gdbarch *retval; ++ ++ retval = debug_target.to_thread_architecture (ops, ptid); ++ ++ fprintf_unfiltered (gdb_stdlog, "target_thread_architecture (%s) = %p [%s]\n", ++ target_pid_to_str (ptid), retval, ++ gdbarch_bfd_arch_info (retval)->printable_name); ++ return retval; ++} ++ + static void + debug_to_stop (ptid_t ptid) + { +@@ -3154,6 +3180,7 @@ setup_target_debug (void) + current_target.to_stop = debug_to_stop; + current_target.to_rcmd = debug_to_rcmd; + current_target.to_pid_to_exec_file = debug_to_pid_to_exec_file; ++ current_target.to_thread_architecture = debug_to_thread_architecture; + } + + +--- gdb-6.8.50.20081103-cvs/gdb/target.h ++++ gdb-6.8.50.20081103-cvs/gdb/target.h +@@ -62,7 +62,8 @@ enum strata + file_stratum, /* Executable files, etc */ + core_stratum, /* Core dump files */ + process_stratum, /* Executing processes */ +- thread_stratum /* Executing threads */ ++ thread_stratum, /* Executing threads */ ++ arch_stratum /* Architecture overrides */ + }; + + enum thread_control_capabilities +@@ -540,6 +541,9 @@ struct target_ops + simultaneously? */ + int (*to_supports_multi_process) (void); + ++ /* Determine current architecture of thread PTID. */ ++ struct gdbarch *(*to_thread_architecture) (struct target_ops *, ptid_t); ++ + int to_magic; + /* Need sub-structure for target machine related rather than comm related? + */ +@@ -1048,6 +1052,11 @@ extern char *normal_pid_to_str (ptid_t p + #define target_pid_to_exec_file(pid) \ + (current_target.to_pid_to_exec_file) (pid) + ++/* Determine current architecture of thread PTID. */ ++ ++#define target_thread_architecture(ptid) \ ++ (current_target.to_thread_architecture (¤t_target, ptid)) ++ + /* + * Iterator function for target memory regions. + * Calls a callback function once for each memory region 'mapped' +--- gdb-6.8.50.20081103-cvs/gdb/testsuite/gdb.base/dump.exp ++++ gdb-6.8.50.20081103-cvs/gdb/testsuite/gdb.base/dump.exp +@@ -42,6 +42,12 @@ if {[istarget "ia64*-*-*"] || [istarget + set is64bitonly "yes" + } + ++if {[istarget "spu*-*-*"]} then { ++ # The internal address format used for the combined Cell/B.E. ++ # debugger required 64-bit. ++ set is64bitonly "yes" ++} ++ + if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable ${options}] != "" } { + untested dump.exp + return -1 +--- gdb-6.8.50.20081103-cvs/gdb/testsuite/gdb.xml/tdesc-regs.exp ++++ gdb-6.8.50.20081103-cvs/gdb/testsuite/gdb.xml/tdesc-regs.exp @@ -39,6 +39,16 @@ switch -glob -- [istarget] { set regdir "rs6000/" set core-regs {power-core.xml} @@ -6011,3 +5742,125 @@ Index: gdb-head/gdb/testsuite/gdb.xml/tdesc-regs.exp } # If no core registers were specified, assume this target does not +--- gdb-6.8.50.20081103-cvs/gdb/thread.c ++++ gdb-6.8.50.20081103-cvs/gdb/thread.c +@@ -759,6 +759,7 @@ switch_to_thread (ptid_t ptid) + inferior_ptid = ptid; + reinit_frame_cache (); + registers_changed (); ++ current_gdbarch = get_regcache_arch (get_current_regcache ()); + + /* We don't check for is_stopped, because we're called at times + while in the TARGET_RUNNING state, e.g., while handling an +--- gdb-6.8.50.20081103-cvs/gdb/utils.c ++++ gdb-6.8.50.20081103-cvs/gdb/utils.c +@@ -2959,7 +2959,6 @@ core_addr_to_string_nz (const CORE_ADDR + CORE_ADDR + string_to_core_addr (const char *my_string) + { +- int addr_bit = gdbarch_addr_bit (current_gdbarch); + CORE_ADDR addr = 0; + + if (my_string[0] == '0' && tolower (my_string[1]) == 'x') +@@ -2975,17 +2974,6 @@ string_to_core_addr (const char *my_stri + else + error (_("invalid hex \"%s\""), my_string); + } +- +- /* Not very modular, but if the executable format expects +- addresses to be sign-extended, then do so if the address was +- specified with only 32 significant bits. Really this should +- be determined by the target architecture, not by the object +- file. */ +- if (i - 2 == addr_bit / 4 +- && exec_bfd +- && bfd_get_sign_extend_vma (exec_bfd)) +- addr = (addr ^ ((CORE_ADDR) 1 << (addr_bit - 1))) +- - ((CORE_ADDR) 1 << (addr_bit - 1)); + } + else + { +--- gdb-6.8.50.20081103-cvs/gdb/varobj.c ++++ gdb-6.8.50.20081103-cvs/gdb/varobj.c +@@ -427,6 +427,8 @@ static struct frame_info * + find_frame_addr_in_frame_chain (CORE_ADDR frame_addr) + { + struct frame_info *frame = NULL; ++ CORE_ADDR frame_base; ++ int addr_bit; + + if (frame_addr == (CORE_ADDR) 0) + return NULL; +@@ -436,7 +438,17 @@ find_frame_addr_in_frame_chain (CORE_ADD + frame = get_prev_frame (frame); + if (frame == NULL) + return NULL; +- if (get_frame_base_address (frame) == frame_addr) ++ ++ /* The CORE_ADDR we get as argument was parsed from a string GDB ++ output as $fp. This output got truncated to gdbarch_addr_bit. ++ Truncate the frame base address in the same manner before ++ comparing it against our argument. */ ++ frame_base = get_frame_base_address (frame); ++ addr_bit = gdbarch_addr_bit (get_frame_arch (frame)); ++ if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT)) ++ frame_base &= ((CORE_ADDR) 1 << addr_bit) - 1; ++ ++ if (frame_base == frame_addr) + return frame; + } + } +--- gdb-6.8.50.20081103-cvs/gdb/xml-tdesc.c ++++ gdb-6.8.50.20081103-cvs/gdb/xml-tdesc.c +@@ -106,6 +106,20 @@ tdesc_end_arch (struct gdb_xml_parser *p + set_tdesc_architecture (data->tdesc, arch); + } + ++/* Handle the end of a element and its value. */ ++ ++static void ++tdesc_end_compatible (struct gdb_xml_parser *parser, ++ const struct gdb_xml_element *element, ++ void *user_data, const char *body_text) ++{ ++ struct tdesc_parsing_data *data = user_data; ++ const struct bfd_arch_info *arch; ++ ++ arch = bfd_scan_arch (body_text); ++ tdesc_add_compatible (data->tdesc, arch); ++} ++ + /* Handle the start of a element. */ + + static void +@@ -345,6 +359,8 @@ static const struct gdb_xml_attribute ta + static const struct gdb_xml_element target_children[] = { + { "architecture", NULL, NULL, GDB_XML_EF_OPTIONAL, + NULL, tdesc_end_arch }, ++ { "compatible", NULL, NULL, GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE, ++ NULL, tdesc_end_compatible }, + { "feature", feature_attributes, feature_children, + GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE, + tdesc_start_feature, NULL }, +--- gdb-6.8.50.20081103-cvs/gdb/xstormy16-tdep.c ++++ gdb-6.8.50.20081103-cvs/gdb/xstormy16-tdep.c +@@ -592,7 +592,8 @@ xstormy16_skip_trampoline_code (struct f + and vice versa. */ + + static CORE_ADDR +-xstormy16_pointer_to_address (struct type *type, const gdb_byte *buf) ++xstormy16_pointer_to_address (struct gdbarch *gdbarch, ++ struct type *type, const gdb_byte *buf) + { + enum type_code target = TYPE_CODE (TYPE_TARGET_TYPE (type)); + CORE_ADDR addr = extract_unsigned_integer (buf, TYPE_LENGTH (type)); +@@ -608,7 +609,8 @@ xstormy16_pointer_to_address (struct typ + } + + static void +-xstormy16_address_to_pointer (struct type *type, gdb_byte *buf, CORE_ADDR addr) ++xstormy16_address_to_pointer (struct gdbarch *gdbarch, ++ struct type *type, gdb_byte *buf, CORE_ADDR addr) + { + enum type_code target = TYPE_CODE (TYPE_TARGET_TYPE (type)); + diff --git a/fix-segmentation-fault-in-dwarf_decode_lines.patch b/fix-segmentation-fault-in-dwarf_decode_lines.patch deleted file mode 100644 index 08e0d2b..0000000 --- a/fix-segmentation-fault-in-dwarf_decode_lines.patch +++ /dev/null @@ -1,29 +0,0 @@ -From: Jan Blunck -Subject: Fix segmentation fault in dwarf_decode_lines -References: 439457 - -This patch fixes a segmentation fault: - -Program received signal SIGSEGV, Segmentation fault. -dwarf_decode_lines (lh=0xb61690, comp_dir=0x0, abfd=0xb04dd0, - cu=0x7ffff0cf79f0, pst=0xd02c60) at dwarf2read.c:7012 -7012 if (fe->dir_index) - --- ---- - gdb/dwarf2read.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -Index: b/gdb/dwarf2read.c -=================================================================== ---- a/gdb/dwarf2read.c -+++ b/gdb/dwarf2read.c -@@ -7075,7 +7075,7 @@ dwarf_decode_lines (struct line_header * - } - - /* Decode the table. */ -- while (!end_sequence) -+ while (!end_sequence && (line_ptr < line_end)) - { - op_code = read_1_byte (abfd, line_ptr); - line_ptr += 1; diff --git a/gdb-6.8.50.20081007-cvs.tar.bz2 b/gdb-6.8.50.20081007-cvs.tar.bz2 deleted file mode 100644 index 16f9346..0000000 --- a/gdb-6.8.50.20081007-cvs.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:4cb219b70b870aa5ee71cb34268b8776665d30a8f9978403422ea1d927ffba08 -size 15583213 diff --git a/gdb-6.8.50.20081103-cvs.tar.bz2 b/gdb-6.8.50.20081103-cvs.tar.bz2 new file mode 100644 index 0000000..94e60a1 --- /dev/null +++ b/gdb-6.8.50.20081103-cvs.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c2407a8e7d8f77b8837d0cc281d2c23268ce8001485ddecce1dc06073a386eec +size 15661359 diff --git a/gdb.changes b/gdb.changes index 1998261..56097d2 100644 --- a/gdb.changes +++ b/gdb.changes @@ -1,3 +1,14 @@ +------------------------------------------------------------------- +Mon Nov 3 19:21:09 CET 2008 - schwab@suse.de + +- Update to head of trunk. +- Fix auxv decoding. + +------------------------------------------------------------------- +Mon Nov 3 12:51:52 CET 2008 - schwab@suse.de + +- Revert broken change from jblunck. + ------------------------------------------------------------------- Thu Oct 30 12:34:56 CET 2008 - olh@suse.de diff --git a/gdb.spec b/gdb.spec index 5ec17eb..0df9a30 100644 --- a/gdb.spec +++ b/gdb.spec @@ -1,5 +1,5 @@ # -# spec file for package gdb (Version 6.8.50.20081007) +# spec file for package gdb (Version 6.8.50.20081103) # # Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany. # @@ -19,8 +19,8 @@ Name: gdb Summary: The GNU Debugger -Version: 6.8.50.20081007 -Release: 2 +Version: 6.8.50.20081103 +Release: 1 BuildRequires: bison dejagnu flex gcc-c++ gcc-fortran gcc-java gcc-objc python-devel readline-devel zlib-devel %if 0%{?suse_version} > 1020 BuildRequires: libexpat-devel @@ -37,20 +37,17 @@ Url: http://www.gnu.org/software/gdb/ License: GNU Free Documentation License, Version 1.2 (GFDL 1.2); GPL v2 or later; GPL v3 or later Group: Development/Tools/Debuggers AutoReqProv: on -# bug437293 %ifarch ppc64 Obsoletes: gdb-64bit %endif %ifarch %ix86 ppc Obsoletes: gdb-32bit %endif -# PreReq: %{install_info_prereq} %define sss -cvs Source: gdb-%{version}%{sss}.tar.bz2 Patch: cell-combined.diff Patch1: find-pc-sect-line.diff -Patch2: args-newline.diff Patch3: readline-5.1-random.patch Patch4: readnever.patch Patch5: gstack.patch @@ -62,7 +59,7 @@ Patch10: expand-line-sal-maybe.diff Patch11: power7.diff Patch12: power7-gdbserver.diff Patch13: dwarf-decode-lines.diff -Patch14: fix-segmentation-fault-in-dwarf_decode_lines.patch +Patch14: auxv.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -124,7 +121,6 @@ Authors: %setup -q -n %{name}-%{version}%{sss} %patch -p1 %patch1 -%patch2 %patch3 %patch4 %patch5 @@ -136,7 +132,7 @@ Authors: %patch11 -p1 %patch12 -p1 %patch13 -%patch14 -p1 +%patch14 %build %ifarch %ix86 ia64 ppc ppc64 s390 s390x x86_64 @@ -213,6 +209,11 @@ rm -rf $RPM_BUILD_ROOT %endif %changelog +* Mon Nov 03 2008 schwab@suse.de +- Update to head of trunk. +- Fix auxv decoding. +* Mon Nov 03 2008 schwab@suse.de +- Revert broken change from jblunck. * Thu Oct 30 2008 olh@suse.de - obsolete old -XXbit packages (bnc#437293) * Tue Oct 28 2008 jblunck@suse.de @@ -611,7 +612,7 @@ rm -rf $RPM_BUILD_ROOT used it, and only gdbserver implemented it. * Sat Dec 02 2006 schwab@suse.de - Update to gdb 6.5.90. -* Sat Oct 28 2006 schwab@suse.de +* Fri Oct 27 2006 schwab@suse.de - Rename detach-fork to detach fork. * Tue Oct 24 2006 schwab@suse.de - Better fix for function descriptor handling on ppc64. @@ -621,7 +622,7 @@ rm -rf $RPM_BUILD_ROOT - Fix off-by-one in add_symbol_file_command [#200831]. * Fri Aug 11 2006 schwab@suse.de - Correctly extend addresses read from link map. -* Mon Jul 17 2006 schwab@suse.de +* Sun Jul 16 2006 schwab@suse.de - Fix function decriptor handing on ppc64. * Wed Jun 21 2006 schwab@suse.de - Update to final gdb 6.5. @@ -636,7 +637,7 @@ rm -rf $RPM_BUILD_ROOT - Fix a parallel build problem. * Tue Apr 04 2006 schwab@suse.de - Relocate PIEs. -* Mon Mar 27 2006 schwab@suse.de +* Sun Mar 26 2006 schwab@suse.de - Handle .eh_frame register encoding that is different from .dwarf_frame. - Remove obsolete patch. * Wed Jan 25 2006 mls@suse.de @@ -657,7 +658,7 @@ rm -rf $RPM_BUILD_ROOT - Fix warnings. * Sun Aug 21 2005 schwab@suse.de - Add DWARF CFI unwinder on ppc. -* Tue Jun 21 2005 schwab@suse.de +* Mon Jun 20 2005 schwab@suse.de - Require libunwind-devel on ia64. * Thu Jun 09 2005 schwab@suse.de - Add patch for ia64 vDSO support and unwinding through signals and @@ -723,7 +724,7 @@ rm -rf $RPM_BUILD_ROOT - Update to gdb 6.1.91. * Thu Jun 24 2004 schwab@suse.de - Better handling of dying threads. -* Sat Jun 19 2004 schwab@suse.de +* Fri Jun 18 2004 schwab@suse.de - Update to gdb 6.1.1. * Tue May 25 2004 schwab@suse.de - Fix handling of short lived threads [#40841]. @@ -739,7 +740,7 @@ rm -rf $RPM_BUILD_ROOT - Update to gdb 6.0.92 (6.1 release candidate). * Tue Mar 30 2004 schwab@suse.de - Fix invalid use of va_list. -* Tue Mar 30 2004 schwab@suse.de +* Mon Mar 29 2004 schwab@suse.de - Update to gdb 6.0.91. * Mon Mar 29 2004 schwab@suse.de - Update to current CVS. @@ -911,7 +912,7 @@ rm -rf $RPM_BUILD_ROOT - add gdb-4.17.0.12 as /usr/bin/gdb-4.17 * Wed Jul 07 1999 kukuk@suse.de - update to 4.18 using diff from jurix -* Tue Feb 23 1999 ro@suse.de +* Mon Feb 22 1999 ro@suse.de - update to 4.17.0.11 using diff from jurix * Thu Jan 21 1999 ro@suse.de - update to 4.17.0.8