From owner-p4-projects@FreeBSD.ORG Fri Jun 25 04:45:25 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4EF6416A4D5; Fri, 25 Jun 2004 04:45:25 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0FAFF43D41; Fri, 25 Jun 2004 04:45:25 +0000 (GMT) (envelope-from marcel@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id i5P4iUGL003468; Fri, 25 Jun 2004 04:44:30 GMT (envelope-from marcel@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id i5P4iUEW003465; Fri, 25 Jun 2004 04:44:30 GMT (envelope-from marcel@freebsd.org) Date: Fri, 25 Jun 2004 04:44:30 GMT Message-Id: <200406250444.i5P4iUEW003465@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to marcel@freebsd.org using -f From: marcel@FreeBSD.org (Marcel Moolenaar) To: Perforce Change Reviews Subject: PERFORCE change 55765 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: marcel@freebsd.org List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Jun 2004 04:45:25 -0000 Change 55765 by marcel@marcel_nfs on 2004/06/25 04:43:36 o Re-add ia64 support to gdb 6.1.1 o Re-add ia64 bmake foo. Affected files ... .. //depot/projects/gdb/contrib/gdb/gdb/config/ia64/fbsd.mh#3 add .. //depot/projects/gdb/contrib/gdb/gdb/config/ia64/fbsd.mt#3 add .. //depot/projects/gdb/contrib/gdb/gdb/config/ia64/nm-fbsd.h#3 add .. //depot/projects/gdb/contrib/gdb/gdb/config/ia64/tm-fbsd.h#3 add .. //depot/projects/gdb/contrib/gdb/gdb/ia64-fbsd-nat.c#3 add .. //depot/projects/gdb/contrib/gdb/gdb/ia64-fbsd-tdep.c#3 add .. //depot/projects/gdb/contrib/gdb/gdb/ia64-tdep.c#7 edit .. //depot/projects/gdb/contrib/gdb/gdb/ia64-tdep.h#4 edit .. //depot/projects/gdb/contrib/gdb/gdb/inftarg.c#7 edit .. //depot/projects/gdb/contrib/gdb/gdb/remote.c#7 edit .. //depot/projects/gdb/contrib/gdb/gdb/target.h#8 edit .. //depot/projects/gdb/gnu/usr.bin/gdb/arch/ia64/Makefile#1 add .. //depot/projects/gdb/gnu/usr.bin/gdb/arch/ia64/config.h#1 add .. //depot/projects/gdb/gnu/usr.bin/gdb/arch/ia64/init.c#1 add Differences ... ==== //depot/projects/gdb/contrib/gdb/gdb/ia64-tdep.c#7 (text+ko) ==== @@ -45,17 +45,6 @@ #include "libunwind-ia64.h" #endif -/* Hook for determining the global pointer when calling functions in - the inferior under AIX. The initialization code in ia64-aix-nat.c - sets this hook to the address of a function which will find the - global pointer for a given address. - - The generic code which uses the dynamic section in the inferior for - finding the global pointer is not of much use on AIX since the - values obtained from the inferior have not been relocated. */ - -CORE_ADDR (*native_find_global_pointer) (CORE_ADDR) = 0; - /* An enumeration of the different IA-64 instruction types. */ typedef enum instruction_type @@ -256,20 +245,6 @@ }; -struct gdbarch_tdep - { - CORE_ADDR (*sigcontext_register_address) (CORE_ADDR, int); - /* OS specific function which, given a frame address - and register number, returns the offset to the - given register from the start of the frame. */ - CORE_ADDR (*find_global_pointer) (CORE_ADDR); - }; - -#define SIGCONTEXT_REGISTER_ADDRESS \ - (gdbarch_tdep (current_gdbarch)->sigcontext_register_address) -#define FIND_GLOBAL_POINTER \ - (gdbarch_tdep (current_gdbarch)->find_global_pointer) - int ia64_register_reggroup_p (struct gdbarch *gdbarch, int regnum, struct reggroup *group) @@ -682,9 +657,18 @@ if ((cfm & 0x7f) > regnum - V32_REGNUM) { + ULONGEST bspstore; ULONGEST reg_addr = rse_address_add (bsp, (regnum - V32_REGNUM)); - reg = read_memory_integer ((CORE_ADDR)reg_addr, 8); - store_unsigned_integer (buf, register_size (current_gdbarch, regnum), reg); + regcache_cooked_read_unsigned (regcache, IA64_BSPSTORE_REGNUM, + &bspstore); + if (reg_addr < bspstore) { + reg = read_memory_integer ((CORE_ADDR)reg_addr, 8); + store_unsigned_integer (buf, register_size (current_gdbarch, + regnum), reg); + } else + target_read_partial (¤t_target, TARGET_OBJECT_DIRTY, + (void*)bspstore, buf, reg_addr - bspstore, + register_size (current_gdbarch, regnum)); } else store_unsigned_integer (buf, register_size (current_gdbarch, regnum), 0); @@ -725,7 +709,21 @@ if (nat_addr >= bsp) regcache_cooked_read_unsigned (regcache, IA64_RNAT_REGNUM, &nat_collection); else - nat_collection = read_memory_integer (nat_addr, 8); + { + ULONGEST bspstore; + regcache_cooked_read_unsigned (regcache, IA64_BSPSTORE_REGNUM, + &bspstore); + if (nat_addr < bspstore) + nat_collection = read_memory_integer (nat_addr, 8); + else { + char natbuf[8]; + target_read_partial (¤t_target, TARGET_OBJECT_DIRTY, + (void*)bspstore, natbuf, + nat_addr - bspstore, + register_size (current_gdbarch, regnum)); + nat_collection = *((uint64_t*)natbuf); + } + } nat_bit = (gr_addr >> 3) & 0x3f; natN_val = (nat_collection >> nat_bit) & 1; } @@ -789,8 +787,16 @@ if ((cfm & 0x7f) > regnum - V32_REGNUM) { + ULONGEST bspstore; ULONGEST reg_addr = rse_address_add (bsp, (regnum - V32_REGNUM)); - write_memory (reg_addr, (void *)buf, 8); + regcache_cooked_read_unsigned (regcache, IA64_BSPSTORE_REGNUM, + &bspstore); + if (reg_addr < bspstore) + write_memory (reg_addr, (void *)buf, 8); + else + target_write_partial (¤t_target, TARGET_OBJECT_DIRTY, + (void*)bspstore, buf, reg_addr - bspstore, + register_size (current_gdbarch, regnum)); } } else if (IA64_NAT0_REGNUM <= regnum && regnum <= IA64_NAT31_REGNUM) @@ -845,13 +851,33 @@ else { char nat_buf[8]; - nat_collection = read_memory_integer (nat_addr, 8); + ULONGEST bspstore; + regcache_cooked_read_unsigned (regcache, IA64_BSPSTORE_REGNUM, + &bspstore); + if (nat_addr < bspstore) + nat_collection = read_memory_integer (nat_addr, 8); + else { + char natbuf[8]; + target_read_partial (¤t_target, TARGET_OBJECT_DIRTY, + (void*)bspstore, natbuf, + nat_addr - bspstore, + register_size (current_gdbarch, regnum)); + nat_collection = *((uint64_t*)natbuf); + } if (natN_val) nat_collection |= natN_mask; else nat_collection &= ~natN_mask; - store_unsigned_integer (nat_buf, register_size (current_gdbarch, regnum), nat_collection); - write_memory (nat_addr, nat_buf, 8); + store_unsigned_integer (nat_buf, register_size (current_gdbarch, + regnum), + nat_collection); + if (nat_addr < bspstore) + write_memory (nat_addr, nat_buf, 8); + else + target_write_partial (¤t_target, TARGET_OBJECT_DIRTY, + (void*)bspstore, nat_buf, + nat_addr - bspstore, + register_size (current_gdbarch, regnum)); } } } @@ -1813,6 +1839,7 @@ prev_bof = rse_address_add (prev_bsp, -(prev_cfm & 0x7f)); addr = rse_address_add (prev_bof, (regnum - IA64_GR32_REGNUM)); + /* XXX marcel */ *lvalp = lval_memory; *addrp = addr; read_memory (addr, valuep, register_size (current_gdbarch, regnum)); @@ -2858,8 +2885,8 @@ DT_PLTGOT tag. If it finds one of these, the corresponding d_un.d_ptr value is the global pointer. */ -static CORE_ADDR -generic_elf_find_global_pointer (CORE_ADDR faddr) +CORE_ADDR +ia64_generic_find_global_pointer (CORE_ADDR faddr) { struct obj_section *faddr_sect; @@ -3255,33 +3282,10 @@ tdep = xmalloc (sizeof (struct gdbarch_tdep)); gdbarch = gdbarch_alloc (&info, tdep); + tdep->osabi = info.osabi; + tdep->sigcontext_register_address = NULL; + tdep->find_global_pointer = ia64_generic_find_global_pointer; - /* Set the method of obtaining the sigcontext addresses at which - registers are saved. The method of checking to see if - native_find_global_pointer is nonzero to indicate that we're - on AIX is kind of hokey, but I can't think of a better way - to do it. */ - if (info.osabi == GDB_OSABI_LINUX) - tdep->sigcontext_register_address = ia64_linux_sigcontext_register_address; - else if (native_find_global_pointer != 0) - tdep->sigcontext_register_address = ia64_aix_sigcontext_register_address; - else - tdep->sigcontext_register_address = 0; - - /* We know that GNU/Linux won't have to resort to the - native_find_global_pointer hackery. But that's the only one we - know about so far, so if native_find_global_pointer is set to - something non-zero, then use it. Otherwise fall back to using - generic_elf_find_global_pointer. This arrangement should (in - theory) allow us to cross debug GNU/Linux binaries from an AIX - machine. */ - if (info.osabi == GDB_OSABI_LINUX) - tdep->find_global_pointer = generic_elf_find_global_pointer; - else if (native_find_global_pointer != 0) - tdep->find_global_pointer = native_find_global_pointer; - else - tdep->find_global_pointer = generic_elf_find_global_pointer; - /* Define the ia64 floating-point format to gdb. */ builtin_type_ia64_ext = init_type (TYPE_CODE_FLT, 128 / 8, @@ -3338,10 +3342,7 @@ set_gdbarch_memory_remove_breakpoint (gdbarch, ia64_memory_remove_breakpoint); set_gdbarch_breakpoint_from_pc (gdbarch, ia64_breakpoint_from_pc); set_gdbarch_read_pc (gdbarch, ia64_read_pc); - if (info.osabi == GDB_OSABI_LINUX) - set_gdbarch_write_pc (gdbarch, ia64_linux_write_pc); - else - set_gdbarch_write_pc (gdbarch, ia64_write_pc); + set_gdbarch_write_pc (gdbarch, ia64_write_pc); /* Settings for calling functions in the inferior. */ set_gdbarch_push_dummy_call (gdbarch, ia64_push_dummy_call); @@ -3366,6 +3367,8 @@ set_gdbarch_print_insn (gdbarch, ia64_print_insn); set_gdbarch_convert_from_func_ptr_addr (gdbarch, ia64_convert_from_func_ptr_addr); + gdbarch_init_osabi (info, gdbarch); + return gdbarch; } ==== //depot/projects/gdb/contrib/gdb/gdb/ia64-tdep.h#4 (text+ko) ==== @@ -22,10 +22,25 @@ #ifndef IA64_TDEP_H #define IA64_TDEP_H -extern CORE_ADDR ia64_linux_sigcontext_register_address (CORE_ADDR, int); -extern CORE_ADDR ia64_aix_sigcontext_register_address (CORE_ADDR, int); -extern unsigned long ia64_linux_getunwind_table (void *, size_t); -extern void ia64_write_pc (CORE_ADDR, ptid_t); -extern void ia64_linux_write_pc (CORE_ADDR, ptid_t); +#include "osabi.h" + +/* Target-dependent structure in gdbarch. */ +struct gdbarch_tdep +{ + enum gdb_osabi osabi; /* OS/ABI of inferior. */ + + CORE_ADDR (*sigcontext_register_address) (CORE_ADDR, int); + /* OS specific function which, given a frame address + and register number, returns the offset to the + given register from the start of the frame. */ + CORE_ADDR (*find_global_pointer) (CORE_ADDR); +}; + +#define SIGCONTEXT_REGISTER_ADDRESS \ + (gdbarch_tdep (current_gdbarch)->sigcontext_register_address) +#define FIND_GLOBAL_POINTER \ + (gdbarch_tdep (current_gdbarch)->find_global_pointer) + +extern CORE_ADDR ia64_generic_find_global_pointer (CORE_ADDR); #endif /* IA64_TDEP_H */ ==== //depot/projects/gdb/contrib/gdb/gdb/inftarg.c#7 (text+ko) ==== @@ -592,6 +592,13 @@ return NATIVE_XFER_WCOOKIE (ops, object, annex, readbuf, writebuf, offset, len); + case TARGET_OBJECT_DIRTY: +#ifndef TARGET_XFER_DIRTY +#define TARGET_XFER_DIRTY(OPS,OBJECT,ANNEX,WRITEBUF,READBUF,OFFSET,LEN) (-1) +#endif + return TARGET_XFER_DIRTY (ops, object, annex, readbuf, writebuf, + offset, len); + default: return -1; } ==== //depot/projects/gdb/contrib/gdb/gdb/remote.c#7 (text+ko) ==== @@ -998,6 +998,23 @@ show_packet_config_cmd (&remote_protocol_qPart_auxv); } +/* Should we try the 'qPart:dirty' (target dirty register read) request? */ +static struct packet_config remote_protocol_qPart_dirty; + +static void +set_remote_protocol_qPart_dirty_packet_cmd (char *args, int from_tty, + struct cmd_list_element *c) +{ + update_packet_config (&remote_protocol_qPart_dirty); +} + +static void +show_remote_protocol_qPart_dirty_packet_cmd (char *args, int from_tty, + struct cmd_list_element *c) +{ + show_packet_config_cmd (&remote_protocol_qPart_dirty); +} + /* Tokens for use by the asynchronous signal handlers for SIGINT */ static void *sigint_remote_twice_token; @@ -2088,6 +2105,7 @@ downloading. */ update_packet_config (&remote_protocol_binary_download); update_packet_config (&remote_protocol_qPart_auxv); + update_packet_config (&remote_protocol_qPart_dirty); } /* Symbol look-up. */ @@ -4925,6 +4943,23 @@ } return -1; + case TARGET_OBJECT_DIRTY: + if (remote_protocol_qPart_dirty.support != PACKET_DISABLE) + { + snprintf (buf2, rs->remote_packet_size, "qPart:dirty:read::%lx", + (long)(offset >> 3)); + i = putpkt (buf2); + if (i < 0) + return i; + buf2[0] = '\0'; + getpkt (buf2, rs->remote_packet_size, 0); + if (packet_ok (buf2, &remote_protocol_qPart_dirty) != PACKET_OK) + return -1; + i = hex2bin (buf2, readbuf, len); + return i; + } + return -1; + default: return -1; } @@ -5423,6 +5458,7 @@ show_remote_protocol_vcont_packet_cmd (args, from_tty, NULL); show_remote_protocol_binary_download_cmd (args, from_tty, NULL); show_remote_protocol_qPart_auxv_packet_cmd (args, from_tty, NULL); + show_remote_protocol_qPart_dirty_packet_cmd (args, from_tty, NULL); } static void @@ -5673,6 +5709,13 @@ &remote_set_cmdlist, &remote_show_cmdlist, 0); + add_packet_config_cmd (&remote_protocol_qPart_dirty, + "qPart_dirty", "read-dirty-registers", + set_remote_protocol_qPart_dirty_packet_cmd, + show_remote_protocol_qPart_dirty_packet_cmd, + &remote_set_cmdlist, &remote_show_cmdlist, + 0); + /* Keep the old ``set remote Z-packet ...'' working. */ add_setshow_auto_boolean_cmd ("Z-packet", class_obscure, &remote_Z_packet_detect, "\ ==== //depot/projects/gdb/contrib/gdb/gdb/target.h#8 (text+ko) ==== @@ -229,7 +229,9 @@ /* Transfer auxilliary vector. */ TARGET_OBJECT_AUXV, /* StackGhost cookie. See "sparc-tdep.c". */ - TARGET_OBJECT_WCOOKIE + TARGET_OBJECT_WCOOKIE, + /* Dirty registers. See "ia64-tdep.c". */ + TARGET_OBJECT_DIRTY /* Possible future objects: TARGET_OBJECT_FILE, TARGET_OBJECT_PROC, ... */ };