From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7811 invoked by alias); 5 Jul 2005 19:52:24 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 7071 invoked by uid 22791); 5 Jul 2005 19:51:09 -0000 Received: from 209-128-86-226.bayarea.net (HELO ns1.xcllnt.net) (209.128.86.226) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Tue, 05 Jul 2005 19:51:08 +0000 Received: from ns1.xcllnt.net (localhost.xcllnt.net [127.0.0.1]) by ns1.xcllnt.net (8.13.3/8.13.3) with ESMTP id j65Jp5EO001701 for ; Tue, 5 Jul 2005 12:51:05 -0700 (PDT) (envelope-from marcel@ns1.xcllnt.net) Received: (from marcel@localhost) by ns1.xcllnt.net (8.13.3/8.13.3/Submit) id j65Jp4it001700 for gdb-patches@sources.redhat.com; Tue, 5 Jul 2005 12:51:04 -0700 (PDT) (envelope-from marcel) Date: Tue, 05 Jul 2005 19:52:00 -0000 From: Marcel Moolenaar To: gdb-patches@sources.redhat.com Subject: [PATCH] New port: ia64-*-freebsd Message-ID: <20050705195104.GA1584@ns1.xcllnt.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Q68bSM7Ycu6FN28Q" Content-Disposition: inline User-Agent: Mutt/1.4.2.1i X-Virus-Checked: Checked by ClamAV on sourceware.org X-SW-Source: 2005-07/txt/msg00064.txt.bz2 --Q68bSM7Ycu6FN28Q Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 1218 Gang, It took a while, but the legal preconditions have recently been met and I'm delighted to present you with the long awaited port of GDB to FreeBSD/ia64. Attached the ChangeLog and actual diffs against the Juli 4th snapshot. One can also grab them for the time being from: http://www.xcllnt.net/~marcel/gdb/ The URL also houses various testsuite results: Results with an unmodified source tree (Juli 4th snapshot) are in files that start with test-. Test results that include the changes are in files prefixed with new-. Test results of a configuration that uses libunwind are in files of which the basename ends in -with. Test results of a configuration that doesn't use libunwind are in files of which the basename ends in -without. There's a small regression on ia64-*-linux that I'm currently analyzing and which may relate to process problems. Please let me know if you see it too if you're able to test the patches. There are some fixes that aren't exactly related to this port, but which I ran into and kept. It's probably better to commit those seperately, but I leave that up to the group. Please review and preferably: commit :-) Thanks, -- Marcel Moolenaar USPA: A-39004 marcel@xcllnt.net --Q68bSM7Ycu6FN28Q Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="ChangeLog.txt" Content-length: 2328 bfd/ChangeLog: 2005-07-05 Marcel Moolenaar * elfxx-ia64.c (elfNN_ia64_grok_prstatus): New function. (elf_backend_grok_prstatus): define for ia64. gdb/ChangeLog: 2005-07-05 Marcel Moolenaar * configure.host: Match ia64-*-freebsd*. * corelow.c (core_xfer_partial): Fix TARGET_OBJECT_MEMORY case. (core_xfer_partial): Add TARGET_OBJECT_DIRTY case. * ia64-fbsd-nat.c: New file. * ia64-fbsd-tdep.c: New file. * ia64-fbsd-tdep.h: New file. * ia64-linux-nat.c (ia64_linux_xfer_dirty): New function. * ia64-tdep.c (ia64_read_reg): New function. (ia64_write_reg): New function. (ia64_pseudo_register_read): Replace use of read_memory with ia64_read_reg. (examine_prologue): Likewise. (ia64_frame_prev_register): Likewise. (ia64_sigtramp_frame_prev_register): Likewise. (ia64_pseudo_register_write): Replace use of write_memory and read_memory with ia64_write_reg and ia64_read_reg (resp). (ia64_frame_prev_register): Properly construct CFM from PFS. (ia64_sigtramp_frame_init_saved_regs): Cache BSPSTORE and RSC. (ia64_find_global_pointer): Use .got section first. Relocate the value from PT_PLTGOT. (ia64_push_dummy_call): Avoid masking or setting reserved bits. (ia64_gdbarch_init): Save the osabi and use NULL for pointers. * ia64-tdep.h (gdbarch_tdep): Add osabi. * inf-ptrace.c (inf_ptrace_xfer_partial): Add TARGET_OBJECT_DIRTY case. * inftarg.c (child_xfer_partial): Likewise. * remote.c (remote_protocol_qPart_dirty): New config. (set_remote_protocol_qPart_dirty_packet_cmd): New function. (show_remote_protocol_qPart_dirty_packet_cmd): Likewise. (init_all_packet_configs): Update remote_protocol_qPart_dirty. (remote_xfer_partial): Add TARGET_OBJECT_DIRTY case. (show_remote_cmd): Call show_remote_protocol_qPart_dirty_packet_cmd. (_initialize_remote): Add new add_packet_config_cmd. * target.h (enum target_object): Add TARGET_OBJECT_DIRTY. * config/djgpp/fnchange.lst: Add ia64-fbsd-nat.c, ia64-fbsd-tdep.c and ia64-fbsd-tdep.h. * config/ia64/fbsd.mh: New file. * config/ia64/fbsd.mt: New file. * config/ia64/nm-fbsd.h: New file. * config/ia64/tm-fbsd.h: New file. * testsuite/gdb.asm/ia64.inc: Add necessary breaks. * testsuite/gdb.asm/ia64.inc: Define gdbasm_declare and gdbasm_end. --Q68bSM7Ycu6FN28Q Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="gdb6.diff" Content-length: 47183 Index: bfd/elfxx-ia64.c =================================================================== RCS file: /home/marcel/CVS/gdb6/bfd/elfxx-ia64.c,v retrieving revision 1.1.1.7 retrieving revision 1.8 diff -u -r1.1.1.7 -r1.8 --- bfd/elfxx-ia64.c 5 Jul 2005 02:41:41 -0000 1.1.1.7 +++ bfd/elfxx-ia64.c 5 Jul 2005 02:46:39 -0000 1.8 @@ -616,6 +616,36 @@ = lookup_howto ((unsigned int) ELFNN_R_TYPE (elf_reloc->r_info)); } +/* Support for core dump NOTE sections. */ + +static bfd_boolean +elfNN_ia64_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) +{ + + if (note->namesz == 8 && strcmp (note->namedata, "FreeBSD") == 0) + { + int pr_version, pr_gregsetsz; + + pr_version = bfd_get_32 (abfd, note->descdata); + if (pr_version != 1) + return FALSE; + + /* pr_cursig */ + elf_tdata (abfd)->core_signal = bfd_get_32 (abfd, note->descdata + 36); + + /* pr_pid */ + elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 40); + + /* pr_reg */ + pr_gregsetsz = bfd_get_32 (abfd, note->descdata + 16); + return _bfd_elfcore_make_pseudosection (abfd, ".reg", pr_gregsetsz, + note->descpos + 48); + } + + return FALSE; +} + + #define PLT_HEADER_SIZE (3 * 16) #define PLT_MIN_ENTRY_SIZE (1 * 16) #define PLT_FULL_ENTRY_SIZE (2 * 16) @@ -5312,6 +5342,7 @@ #define elf_backend_reloc_type_class elfNN_ia64_reloc_type_class #define elf_backend_rela_normal 1 #define elf_backend_special_sections elfNN_ia64_special_sections +#define elf_backend_grok_prstatus elfNN_ia64_grok_prstatus /* FIXME: PR 290: The Intel C compiler generates SHT_IA_64_UNWIND with SHF_LINK_ORDER. But it doesn't set theh sh_link or sh_info fields. Index: gdb/configure.host =================================================================== RCS file: /home/marcel/CVS/gdb6/gdb/configure.host,v retrieving revision 1.1.1.6 retrieving revision 1.7 diff -u -r1.1.1.6 -r1.7 --- gdb/configure.host 24 Jun 2005 20:31:34 -0000 1.1.1.6 +++ gdb/configure.host 24 Jun 2005 21:07:35 -0000 1.7 @@ -86,6 +86,7 @@ i[34567]86-*-isc*) gdb_host=i386v ;; i[34567]86-*-cygwin*) gdb_host=cygwin ;; +ia64-*-freebsd*) gdb_host=fbsd ;; ia64-*-linux*) gdb_host=linux ;; m68*-*-linux*) gdb_host=linux ;; Index: gdb/corelow.c =================================================================== RCS file: /home/marcel/CVS/gdb6/gdb/corelow.c,v retrieving revision 1.1.1.6 retrieving revision 1.7 diff -u -r1.1.1.6 -r1.7 --- gdb/corelow.c 24 Jun 2005 20:31:34 -0000 1.1.1.6 +++ gdb/corelow.c 24 Jun 2005 21:11:39 -0000 1.7 @@ -542,9 +542,9 @@ case TARGET_OBJECT_MEMORY: if (readbuf) return (*ops->deprecated_xfer_memory) (offset, readbuf, len, - 0/*write*/, NULL, ops); + 0/*read*/, NULL, ops); if (writebuf) - return (*ops->deprecated_xfer_memory) (offset, readbuf, len, + return (*ops->deprecated_xfer_memory) (offset, writebuf, len, 1/*write*/, NULL, ops); return -1; @@ -612,6 +612,19 @@ } return -1; + case TARGET_OBJECT_DIRTY: + { + ULONGEST addr; + addr = *(ULONGEST*)annex + offset; + if (readbuf) + return (*ops->deprecated_xfer_memory) (addr, readbuf, len, + 0/*read*/, NULL, ops); + if (writebuf) + return (*ops->deprecated_xfer_memory) (addr, writebuf, len, + 1/*write*/, NULL, ops); + return -1; + } + default: if (ops->beneath != NULL) return ops->beneath->to_xfer_partial (ops->beneath, object, annex, Index: gdb/ia64-fbsd-nat.c =================================================================== RCS file: gdb/ia64-fbsd-nat.c diff -N gdb/ia64-fbsd-nat.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gdb/ia64-fbsd-nat.c 4 Jul 2005 19:47:55 -0000 1.8 @@ -0,0 +1,135 @@ +/* Functions specific to running gdb native on FreeBSD/ia64. + + Copyright 2005 Free Software Foundation, Inc. + + Contributed by Marcel Moolenaar (marcel@xcllnt.net). + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +#include "defs.h" +#include "inferior.h" +#include "inf-ptrace.h" +#include "regcache.h" +#include "fbsd-nat.h" +#include "ia64-tdep.h" +#include "ia64-fbsd-tdep.h" + +#include +#include +#include + +#ifdef HAVE_SYS_PROCFS_H +#include +#endif + +#ifndef HAVE_GREGSET_T +typedef struct reg gregset_t; +#endif + +#ifndef HAVE_FPREGSET_T +typedef struct fpreg fpregset_t; +#endif + +#include "gregset.h" + +fpregset_t ia64_fbsd_fpregset; +gregset_t ia64_fbsd_gregset; + +void ia64_fbsd_fetch_inferior_registers (int regno) +{ + int supplied = 0; + + if (regno == -1 || GREG_SUPPLIES(regno)) + { + if (ptrace (PT_GETREGS, PIDGET(inferior_ptid), + (PTRACE_TYPE_ARG3)&ia64_fbsd_gregset, 0) == -1) + perror_with_name ("Couldn't get registers"); + ia64_fbsd_supply_gregset (current_regcache, -1, &ia64_fbsd_gregset); + supplied = 1; + } + + if (regno == -1 || FPREG_SUPPLIES(regno)) + { + if (ptrace (PT_GETFPREGS, PIDGET(inferior_ptid), + (PTRACE_TYPE_ARG3)&ia64_fbsd_fpregset, 0) == -1) + perror_with_name ("Couldn't get FP registers"); + ia64_fbsd_supply_fpregset (current_regcache, -1, &ia64_fbsd_fpregset); + supplied = 1; + } + + if (!supplied) + set_register_cached(regno, -1); +} + +void ia64_fbsd_store_inferior_registers (int regno) +{ + + if (regno == -1 || GREG_SUPPLIES(regno)) + { + ia64_fbsd_collect_gregset (current_regcache, -1, &ia64_fbsd_gregset); + if (ptrace (PT_SETREGS, PIDGET(inferior_ptid), + (PTRACE_TYPE_ARG3)&ia64_fbsd_gregset, 0) == -1) + perror_with_name ("Couldn't get registers"); + if (ia64_fbsd_gregset.r_special.ndirty != 0) + set_register_cached(IA64_BSPSTORE_REGNUM, 0); + } + + if (regno == -1 || FPREG_SUPPLIES(regno)) + { + ia64_fbsd_collect_fpregset (current_regcache, -1, &ia64_fbsd_fpregset); + if (ptrace (PT_SETFPREGS, PIDGET(inferior_ptid), + (PTRACE_TYPE_ARG3)&ia64_fbsd_fpregset, 0) == -1) + perror_with_name ("Couldn't get FP registers"); + } +} + +LONGEST ia64_fbsd_xfer_dirty (struct target_ops *ops, enum target_object obj, + const char *annex, void *rbuf, const void *wbuf, + ULONGEST ofs, LONGEST len) +{ + if (len != 8) + return (-1); + if (rbuf != NULL) { + if (ptrace (PT_GETKSTACK, PIDGET(inferior_ptid), (PTRACE_ARG3_TYPE)rbuf, + ofs >> 3) == -1) { + perror_with_name ("Couldn't read dirty register"); + return (-1); + } + } else { + if (ptrace (PT_SETKSTACK, PIDGET(inferior_ptid), (PTRACE_ARG3_TYPE)wbuf, + ofs >> 3) == -1) { + perror_with_name ("Couldn't write dirty register"); + return (-1); + } + } + return (len); +} + +void +_initialize_ia64_fbsd_nat (void) +{ + struct target_ops *t; + + t = inf_ptrace_target(); + t->to_pid_to_exec_file = fbsd_pid_to_exec_file; + t->to_find_memory_regions = fbsd_find_memory_regions; + t->to_make_corefile_notes = fbsd_make_corefile_notes; + t->to_fetch_registers = ia64_fbsd_fetch_inferior_registers; + t->to_store_registers = ia64_fbsd_store_inferior_registers; + add_target (t); +} Index: gdb/ia64-fbsd-tdep.c =================================================================== RCS file: gdb/ia64-fbsd-tdep.c diff -N gdb/ia64-fbsd-tdep.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gdb/ia64-fbsd-tdep.c 4 Jul 2005 19:47:55 -0000 1.14 @@ -0,0 +1,378 @@ +/* Target-dependent code for FreeBSD/ia64. + + Copyright 2005 Free Software Foundation, Inc. + + Contributed by Marcel Moolenaar (marcel@xcllnt.net). + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +#include "defs.h" +#include "gdb_string.h" +#include "regcache.h" +#include "regset.h" +#include "solib-svr4.h" +#include "value.h" + +#include "ia64-tdep.h" +#include "ia64-fbsd-tdep.h" + +static int reg_offset[462] = { + -1, 96, 248, 256, 152, 160, 168, 176, /* Regs 0-7. */ + 264, 272, 280, 288, 0, 64, 296, 304, /* Regs 8-15. */ + 312, 320, 328, 336, 344, 352, 360, 368, /* Regs 16-23. */ + 376, 384, 392, 400, 408, 416, 424, 432, /* Regs 24-31. */ + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 32-39. */ + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 40-47. */ + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 48-55. */ + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 56-63. */ + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 64-71. */ + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 72-79. */ + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 80-87. */ + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 88-95. */ + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 96-103. */ + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 104-111. */ + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 112-119. */ + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 120-127. */ + -1, -1, 0, 16, 32, 48, 320, 336, /* Regs 128-135. */ + 352, 368, 384, 400, 416, 432, 448, 464, /* Regs 136-143. */ + 64, 80, 96, 112, 128, 144, 160, 176, /* Regs 144-151. */ + 192, 208, 224, 240, 256, 272, 288, 304, /* Regs 152-159. */ + 480, 496, 512, 528, 544, 560, 576, 592, /* Regs 160-167. */ + 608, 624, 640, 656, 672, 688, 704, 720, /* Regs 168-175. */ + 736, 752, 768, 784, 800, 816, 832, 848, /* Regs 176-183. */ + 864, 880, 896, 912, 928, 944, 960, 976, /* Regs 184-191. */ + 992, 1008, 1024, 1040, 1056, 1072, 1088, 1104, /* Regs 192-199. */ + 1120, 1136, 1152, 1168, 1184, 1200, 1216, 1232, /* Regs 200-207. */ + 1248, 1264, 1280, 1296, 1312, 1328, 1344, 1360, /* Regs 208-215. */ + 1376, 1392, 1408, 1424, 1440, 1456, 1472, 1488, /* Regs 216-223. */ + 1504, 1520, 1536, 1552, 1568, 1584, 1600, 1616, /* Regs 224-231. */ + 1632, 1648, 1664, 1680, 1696, 1712, 1728, 1744, /* Regs 232-239. */ + 1760, 1776, 1792, 1808, 1824, 1840, 1856, 1872, /* Regs 240-247. */ + 1888, 1904, 1920, 1936, 1952, 1968, 1984, 2000, /* Regs 248-255. */ + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 256-263. */ + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 264-271. */ + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 272-279. */ + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 280-287. */ + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 288-295. */ + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 296-303. */ + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 304-311. */ + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 312-319. */ + 16, 184, 192, 200, 208, 216, 440, 448, /* Regs 320-327. */ + -1, -1, 24, 120, 88, 112, -1, -1, /* Regs 328-335. */ + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 336-343. */ + -1, -1, -1, -1, -1, -1, 72, 104, /* Regs 344-351. */ + 40, 48, -1, -1, -1, -1, -1, 464, /* Regs 352-359. */ + 472, -1, -1, -1, -1, -1, 456, -1, /* Regs 360-367. */ + -1, -1, 8, -1, -1, -1, 80, -1, /* Regs 368-375. */ + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 376-383. */ + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 384-391. */ + -1, -1, -1, -1, -1, -1, 32, 224, /* Regs 392-399. */ + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 400-407. */ + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 408-415. */ + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 416-423. */ + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 424-431. */ + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 432-439. */ + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 440-447. */ + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 448-455. */ + -1, -1, -1, -1, -1, -1 +}; + +static void +ia64_fbsd_regcache_collect (const struct regcache *regcache, int regno, + void *regs) +{ + int ofs; + + if (regno < 0 || regno >= NUM_REGS) + return; + + ofs = reg_offset[regno]; + if (regno == IA64_BSP_REGNUM) + { + uint64_t bsp, bspstore; + regcache_raw_collect (regcache, regno, &bsp); + regcache_raw_collect (regcache, IA64_BSPSTORE_REGNUM, &bspstore); + *(uint64_t *)((char *)regs + ofs) = bsp - bspstore; + } + else + { + if (ofs >= 0) + regcache_raw_collect (regcache, regno, (char*)regs + ofs); + } +} + +static void +ia64_fbsd_regcache_supply (struct regcache *regcache, int regno, + const void *regs) +{ + int ofs; + + if (regno < 0 || regno >= NUM_REGS) + return; + + ofs = reg_offset[regno]; + if (regno == IA64_BSP_REGNUM) + { + /* BSP is synthesized. It's not actually present in struct reg, + but can be derived from bspstore and ndirty. The offset of + IA64_BSP_REGNUM in the reg_offset array above is that of the + ndirty field in struct reg. */ + uint64_t bsp; + bsp = *((uint64_t*)((char *)regs + ofs)); /* ndirty */ + bsp += *((uint64_t*)((char *)regs + reg_offset[IA64_BSPSTORE_REGNUM])); + regcache_raw_supply (regcache, regno, &bsp); + } + else + { + if (ofs >= 0) + regcache_raw_supply (regcache, regno, (char *)regs + ofs); + } +} + +void +ia64_fbsd_collect_fpregset (const struct regcache *regcache, int regno, + void *regs) +{ + if (regno == -1) + { + int num_regs = NUM_REGS; /* NUM_REGS expands to a function call. */ + for (regno = 0; regno < num_regs; regno++) + { + if (FPREG_SUPPLIES(regno)) + ia64_fbsd_regcache_collect (regcache, regno, regs); + } + } + else + { + if (FPREG_SUPPLIES(regno)) + ia64_fbsd_regcache_collect (regcache, regno, regs); + } +} + +void +ia64_fbsd_collect_gregset (const struct regcache *regcache, int regno, + void *regs) +{ + if (regno == -1) + { + int num_regs = NUM_REGS; /* NUM_REGS expands to a function call. */ + for (regno = 0; regno < num_regs; regno++) + { + if (GREG_SUPPLIES(regno)) + ia64_fbsd_regcache_collect (regcache, regno, regs); + } + } + else + { + if (GREG_SUPPLIES(regno)) + ia64_fbsd_regcache_collect (regcache, regno, regs); + } +} + +void +ia64_fbsd_supply_fpregset (struct regcache *regcache, int regno, + const void *regs) +{ + if (regno == -1) + { + int num_regs = NUM_REGS; /* NUM_REGS expands to a function call. */ + for (regno = 0; regno < num_regs; regno++) + { + if (FPREG_SUPPLIES(regno)) + ia64_fbsd_regcache_supply (regcache, regno, regs); + } + } + else + { + if (FPREG_SUPPLIES(regno)) + ia64_fbsd_regcache_supply (regcache, regno, regs); + } +} + +void +ia64_fbsd_supply_gregset (struct regcache *regcache, int regno, + const void *regs) +{ + if (regno == -1) + { + int num_regs = NUM_REGS; /* NUM_REGS expands to a function call. */ + for (regno = 0; regno < num_regs; regno++) + { + if (GREG_SUPPLIES(regno)) + ia64_fbsd_regcache_supply (regcache, regno, regs); + } + } + else + { + if (GREG_SUPPLIES(regno)) + ia64_fbsd_regcache_supply (regcache, regno, regs); + } +} + +int +ia64_fbsd_in_sigtramp (CORE_ADDR pc, char *fnm) +{ + uint64_t gwpage = 5ULL << 61; + return (pc >= gwpage && pc < (gwpage + 8192)) ? 1 : 0; +} + +static void +ia64_fbsd_collect_fpregset_from_core (const struct regset *regset, + const struct regcache *regcache, + int regno, void *regs, size_t len) +{ + ia64_fbsd_collect_fpregset (regcache, regno, regs); +} + +static void +ia64_fbsd_collect_gregset_from_core (const struct regset *regset, + const struct regcache *regcache, + int regno, void *regs, size_t len) +{ + ia64_fbsd_collect_gregset (regcache, regno, regs); +} + +static void +ia64_fbsd_supply_fpregset_from_core (const struct regset *regset, + struct regcache *regcache, int regno, + const void *regs, size_t len) +{ + ia64_fbsd_supply_fpregset (regcache, regno, regs); +} + +static void +ia64_fbsd_supply_gregset_from_core (const struct regset *regset, + struct regcache *regcache, int regno, + const void *regs, size_t len) +{ + ia64_fbsd_supply_gregset (regcache, regno, regs); +} + +static struct regset fpregset = + { + NULL, + ia64_fbsd_supply_fpregset_from_core, + ia64_fbsd_collect_fpregset_from_core + }; + +static struct regset gregset = + { + NULL, + ia64_fbsd_supply_gregset_from_core, + ia64_fbsd_collect_gregset_from_core + }; + +static const struct regset * +ia64_fbsd_regset_from_core_section (struct gdbarch *gdbarch, + const char *sect_name, size_t sect_size) +{ + if (strcmp (sect_name, ".reg") == 0) + return (&gregset); + if (strcmp (sect_name, ".reg2") == 0) + return (&fpregset); + return (NULL); +} + +static CORE_ADDR +ia64_fbsd_sigcontext_register_address (CORE_ADDR fp, int regno) +{ + char buf[8]; + uint64_t flags; + int ofs; + + if (regno < 0 || regno >= NUM_REGS) + return 0; + + /* Normally BSP is synthesized from BSPSTORE+ndirty, but since ndirty + is always 0, we can cheat and have BSP fetched from where BSPSTORE + is located. */ + if (regno == IA64_BSP_REGNUM) + regno = IA64_BSPSTORE_REGNUM; + + ofs = reg_offset[regno]; + if (ofs == -1) + return 0; + + /* fp holds the address of struct sigframe on the memory stack, + which typically is equal to sp+16 so we don't have to adjust + for the 16-byte scratch space. The first field in the signal + frame is the ucontext. The second field after the sigset is + the mcontext with the register values. The sigset is 16 bytes + large. */ + fp += 16; /* struct __mcontext address. */ + + /* The first field in the mcontext is the flags field, which tells + is something about the saved context. */ + if (target_read_memory (fp, buf, sizeof(buf)) == sizeof(buf)) + flags = extract_unsigned_integer (buf, sizeof(buf)); + else + flags = 0; + + /* Translate offsets into struct reg and struct freg to offsets into + struct __mcontext. The mcontext almost looks like the concatenation + of struct reg and struct freg, except that the scratch registers and + the FP preserved registers are swapped. */ + fp += 16; /* Skip flags field and reserved space. */ + if (GREG_SUPPLIES (regno)) + { + /* The preserved FP registers lie inbetween the preserved and scratch + registers. */ + if (ofs >= SIZEOF_SPECIAL+SIZEOF_PRESERVED) + fp += SIZEOF_PRESERVED_FP; + } + else + { + /* make fp point to the first floating-point group, because the + register offset is relative to styruct freg. */ + fp += SIZEOF_SPECIAL+SIZEOF_PRESERVED; + /* The scratch registers lie inbetween the preserved FP and scratch + FP registers. */ + if (ofs >= SIZEOF_PRESERVED_FP) + fp += SIZEOF_SCRATCH; + /* Check if the mcontext contains the high FP register. */ + if (ofs >= SIZEOF_PRESERVED_FP+SIZEOF_SCRATCH_FP && + (flags & 2) == 0) + ofs = -1; + } + + return (ofs == -1) ? 0 : fp + ofs; +} + +static void +ia64_fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + + tdep->sigcontext_register_address = ia64_fbsd_sigcontext_register_address; + + set_solib_svr4_fetch_link_map_offsets (gdbarch, + svr4_lp64_fetch_link_map_offsets); + + set_gdbarch_fetch_tls_load_module_address (gdbarch, + svr4_fetch_objfile_link_map); + + set_gdbarch_regset_from_core_section (gdbarch, + ia64_fbsd_regset_from_core_section); +} + +void +_initialize_ia64_fbsd_tdep (void) +{ + gdbarch_register_osabi (bfd_arch_ia64, 0ul, GDB_OSABI_FREEBSD_ELF, + ia64_fbsd_init_abi); +} Index: gdb/ia64-fbsd-tdep.h =================================================================== RCS file: gdb/ia64-fbsd-tdep.h diff -N gdb/ia64-fbsd-tdep.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gdb/ia64-fbsd-tdep.h 4 Jul 2005 19:47:56 -0000 1.3 @@ -0,0 +1,53 @@ +/* Target-dependent definitions and declarations for FreeBSD/ia64. + + Copyright 2005 Free Software Foundation, Inc. + + Contributed by Marcel Moolenaar (marcel@xcllnt.net). + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +#ifndef IA64_FBSD_TDEP_H +#define IA64_FBSD_TDEP_H + +#define FPREG_SUPPLIES(r) \ + ((r) >= IA64_FR0_REGNUM && (r) <= IA64_FR127_REGNUM) +#define GREG_SUPPLIES(r) \ + (((r) >= IA64_GR1_REGNUM && (r) <= IA64_GR31_REGNUM) || \ + ((r) >= IA64_BR0_REGNUM && (r) <= IA64_BR7_REGNUM) || \ + (r) == IA64_PR_REGNUM || (r) == IA64_IP_REGNUM || \ + (r) == IA64_PSR_REGNUM || (r) == IA64_CFM_REGNUM || \ + (r) == IA64_RSC_REGNUM || (r) == IA64_BSP_REGNUM || \ + (r) == IA64_BSPSTORE_REGNUM || (r) == IA64_RNAT_REGNUM || \ + (r) == IA64_CSD_REGNUM || (r) == IA64_SSD_REGNUM || \ + (r) == IA64_CCV_REGNUM || (r) == IA64_UNAT_REGNUM || \ + (r) == IA64_FPSR_REGNUM || (r) == IA64_PFS_REGNUM || \ + (r) == IA64_LC_REGNUM || (r) == IA64_EC_REGNUM) + +#define SIZEOF_SPECIAL (18*8) +#define SIZEOF_PRESERVED (12*8) +#define SIZEOF_SCRATCH (30*8) +#define SIZEOF_PRESERVED_FP ((32-2)*16) +#define SIZEOF_SCRATCH_FP (10*16) +#define SIZEOF_HIGH_FP ((128-32)*16) + +void ia64_fbsd_collect_fpregset (const struct regcache *, int, void *); +void ia64_fbsd_collect_gregset (const struct regcache *, int, void *); +void ia64_fbsd_supply_fpregset (struct regcache *, int, const void *); +void ia64_fbsd_supply_gregset (struct regcache *, int, const void *); + +#endif /* IA64_FBSD_TDEP_H */ Index: gdb/ia64-linux-nat.c =================================================================== RCS file: /home/marcel/CVS/gdb6/gdb/ia64-linux-nat.c,v retrieving revision 1.1.1.3 retrieving revision 1.5 diff -u -r1.1.1.3 -r1.5 --- gdb/ia64-linux-nat.c 24 Jun 2005 20:31:36 -0000 1.1.1.3 +++ gdb/ia64-linux-nat.c 24 Jun 2005 21:12:35 -0000 1.5 @@ -675,3 +675,13 @@ { return syscall (__NR_getunwind, readbuf, len); } + +LONGEST ia64_linux_xfer_dirty (struct target_ops *ops, enum target_object obj, + const char *annex, void *rbuf, const void *wbuf, + ULONGEST ofs, LONGEST len) +{ + ULONGEST addr; + addr = *(ULONGEST*)annex + ofs; + return ops->to_xfer_partial (ops, TARGET_OBJECT_MEMORY, NULL, rbuf, wbuf, + addr, len); +} Index: gdb/ia64-tdep.c =================================================================== RCS file: /home/marcel/CVS/gdb6/gdb/ia64-tdep.c,v retrieving revision 1.1.1.5 retrieving revision 1.15 diff -u -r1.1.1.5 -r1.15 --- gdb/ia64-tdep.c 24 Jun 2005 20:31:36 -0000 1.1.1.5 +++ gdb/ia64-tdep.c 5 Jul 2005 18:15:16 -0000 1.15 @@ -672,6 +672,44 @@ } static void +ia64_read_reg (struct regcache *regcache, CORE_ADDR addr, void *buf, int len) +{ + ULONGEST bspstore; + regcache_cooked_read_unsigned (regcache, IA64_BSPSTORE_REGNUM, &bspstore); + if (addr >= bspstore) + { + ULONGEST bsp; + regcache_cooked_read_unsigned (regcache, IA64_BSP_REGNUM, &bsp); + if (addr < bsp) + { + target_read_partial (¤t_target, TARGET_OBJECT_DIRTY, + (void*)&bspstore, buf, addr - bspstore, len); + return; + } + } + target_read_memory (addr, buf, len); +} + +static void +ia64_write_reg (struct regcache *regcache, CORE_ADDR addr, void *buf, int len) +{ + ULONGEST bspstore; + regcache_cooked_read_unsigned (regcache, IA64_BSPSTORE_REGNUM, &bspstore); + if (addr >= bspstore) + { + ULONGEST bsp; + regcache_cooked_read_unsigned (regcache, IA64_BSP_REGNUM, &bsp); + if (addr < bsp) + { + target_write_partial (¤t_target, TARGET_OBJECT_DIRTY, + (void*)&bspstore, buf, addr - bspstore, len); + return; + } + } + target_write_memory (addr, buf, len); +} + +static void ia64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, int regnum, gdb_byte *buf) { @@ -689,7 +727,6 @@ this is the best we can do. */ ULONGEST cfm; ULONGEST bsp; - CORE_ADDR reg; regcache_cooked_read_unsigned (regcache, IA64_BSP_REGNUM, &bsp); regcache_cooked_read_unsigned (regcache, IA64_CFM_REGNUM, &cfm); @@ -700,8 +737,8 @@ if ((cfm & 0x7f) > regnum - V32_REGNUM) { 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); + ia64_read_reg (regcache, reg_addr, buf, + register_size (current_gdbarch, regnum)); } else store_unsigned_integer (buf, register_size (current_gdbarch, regnum), 0); @@ -743,7 +780,11 @@ if (nat_addr >= bsp) regcache_cooked_read_unsigned (regcache, IA64_RNAT_REGNUM, &nat_collection); else - nat_collection = read_memory_integer (nat_addr, 8); + { + char nat_buf[8]; + ia64_read_reg (regcache, nat_addr, nat_buf, sizeof(nat_buf)); + nat_collection = extract_unsigned_integer (nat_buf, 8); + } nat_bit = (gr_addr >> 3) & 0x3f; natN_val = (nat_collection >> nat_bit) & 1; } @@ -808,7 +849,7 @@ if ((cfm & 0x7f) > regnum - V32_REGNUM) { ULONGEST reg_addr = rse_address_add (bsp, (regnum - V32_REGNUM)); - write_memory (reg_addr, (void *)buf, 8); + ia64_write_reg (regcache, reg_addr, (void *)buf, 8); } } else if (IA64_NAT0_REGNUM <= regnum && regnum <= IA64_NAT31_REGNUM) @@ -863,13 +904,14 @@ else { char nat_buf[8]; - nat_collection = read_memory_integer (nat_addr, 8); + ia64_read_reg (regcache, nat_addr, nat_buf, sizeof(nat_buf)); + nat_collection = extract_unsigned_integer (nat_buf, 8); 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, sizeof(nat_buf), nat_collection); + ia64_write_reg (regcache, nat_addr, nat_buf, sizeof(nat_buf)); } } } @@ -1443,7 +1485,10 @@ cfm = 0; if (cache->saved_regs[IA64_CFM_REGNUM] != 0) { - cfm = read_memory_integer (cache->saved_regs[IA64_CFM_REGNUM], 8); + char cfm_buf[8]; + ia64_read_reg (current_regcache, cache->saved_regs[IA64_CFM_REGNUM], + cfm_buf, sizeof(cfm_buf)); + cfm = extract_unsigned_integer (cfm_buf, sizeof(cfm_buf)); } else if (cfm_reg != 0) { @@ -1641,14 +1686,18 @@ { *lvalp = lval_memory; *addrp = addr; - read_memory (addr, valuep, register_size (current_gdbarch, regnum)); + ia64_read_reg (current_regcache, addr, valuep, + register_size (current_gdbarch, regnum)); } else if (cache->prev_cfm) store_unsigned_integer (valuep, register_size (current_gdbarch, regnum), cache->prev_cfm); else if (cache->frameless) { - CORE_ADDR cfm = 0; + uint64_t cfm; frame_unwind_register (next_frame, IA64_PFS_REGNUM, valuep); + cfm = extract_unsigned_integer (valuep, sizeof(cfm)); + cfm = 0x8000000000000000ULL | (cfm & 0x3fffffffffULL); + store_unsigned_integer (valuep, sizeof(cfm), cfm); } } else if (regnum == IA64_VFP_REGNUM) @@ -1726,7 +1775,13 @@ nat_collection = extract_unsigned_integer (buf, 8); } else - nat_collection = read_memory_integer (nat_addr, 8); + { + char nat_buf[8]; + ia64_read_reg (current_regcache, nat_addr, nat_buf, + sizeof(nat_buf)); + nat_collection = extract_unsigned_integer (nat_buf, + sizeof(nat_buf)); + } nat_bit = (gr_addr >> 3) & 0x3f; natval = (nat_collection >> nat_bit) & 1; } @@ -1742,7 +1797,8 @@ { *lvalp = lval_memory; *addrp = addr; - read_memory (addr, buf, register_size (current_gdbarch, IA64_IP_REGNUM)); + ia64_read_reg (current_regcache, addr, buf, + register_size (current_gdbarch, IA64_IP_REGNUM)); pc = extract_unsigned_integer (buf, 8); } else if (cache->frameless) @@ -1771,7 +1827,8 @@ { *lvalp = lval_memory; *addrp = addr; - read_memory (addr, buf, register_size (current_gdbarch, IA64_IP_REGNUM)); + ia64_read_reg (current_regcache, addr, buf, + register_size (current_gdbarch, IA64_IP_REGNUM)); pc = extract_unsigned_integer (buf, 8); } else if (cache->frameless) @@ -1793,7 +1850,8 @@ { *lvalp = lval_memory; *addrp = addr; - read_memory (addr, buf, register_size (current_gdbarch, IA64_BR0_REGNUM)); + ia64_read_reg (current_regcache, addr, buf, + register_size (current_gdbarch, IA64_BR0_REGNUM)); br0 = extract_unsigned_integer (buf, 8); } store_unsigned_integer (valuep, 8, br0); @@ -1809,7 +1867,8 @@ { *lvalp = lval_memory; *addrp = addr; - read_memory (addr, valuep, register_size (current_gdbarch, regnum)); + ia64_read_reg (current_regcache, addr, valuep, + register_size (current_gdbarch, regnum)); } else if (cache->frameless) { @@ -1820,6 +1879,7 @@ CORE_ADDR r_addr; CORE_ADDR prev_cfm, prev_bsp, prev_bof; CORE_ADDR addr = 0; + if (regnum >= V32_REGNUM) regnum = IA64_GR32_REGNUM + (regnum - V32_REGNUM); ia64_frame_prev_register (next_frame, this_cache, IA64_CFM_REGNUM, @@ -1833,7 +1893,8 @@ addr = rse_address_add (prev_bof, (regnum - IA64_GR32_REGNUM)); *lvalp = lval_memory; *addrp = addr; - read_memory (addr, valuep, register_size (current_gdbarch, regnum)); + ia64_read_reg (current_regcache, addr, valuep, + register_size (current_gdbarch, regnum)); } } else @@ -1857,7 +1918,8 @@ { *lvalp = lval_memory; *addrp = addr; - read_memory (addr, valuep, register_size (current_gdbarch, regnum)); + ia64_read_reg (current_regcache, addr, valuep, + register_size (current_gdbarch, regnum)); } /* Otherwise, punt and get the current value of the register. */ else @@ -1902,6 +1964,10 @@ SIGCONTEXT_REGISTER_ADDRESS (cache->base, IA64_PSR_REGNUM); cache->saved_regs[IA64_BSP_REGNUM] = SIGCONTEXT_REGISTER_ADDRESS (cache->base, IA64_BSP_REGNUM); + cache->saved_regs[IA64_BSPSTORE_REGNUM] = + SIGCONTEXT_REGISTER_ADDRESS (cache->base, IA64_BSPSTORE_REGNUM); + cache->saved_regs[IA64_RSC_REGNUM] = + SIGCONTEXT_REGISTER_ADDRESS (cache->base, IA64_RSC_REGNUM); cache->saved_regs[IA64_RNAT_REGNUM] = SIGCONTEXT_REGISTER_ADDRESS (cache->base, IA64_RNAT_REGNUM); cache->saved_regs[IA64_CCV_REGNUM] = @@ -2012,7 +2078,8 @@ { *lvalp = lval_memory; *addrp = addr; - read_memory (addr, buf, register_size (current_gdbarch, IA64_IP_REGNUM)); + ia64_read_reg (current_regcache, addr, buf, + register_size (current_gdbarch, IA64_IP_REGNUM)); pc = extract_unsigned_integer (buf, 8); } pc &= ~0xf; @@ -2029,7 +2096,8 @@ { *lvalp = lval_memory; *addrp = addr; - read_memory (addr, valuep, register_size (current_gdbarch, regnum)); + ia64_read_reg (current_regcache, addr, valuep, + register_size (current_gdbarch, regnum)); } } else @@ -2040,7 +2108,8 @@ { *lvalp = lval_memory; *addrp = addr; - read_memory (addr, valuep, register_size (current_gdbarch, regnum)); + ia64_read_reg (current_regcache, addr, valuep, + register_size (current_gdbarch, regnum)); } } @@ -3152,20 +3221,26 @@ faddr_sect = find_pc_section (faddr); if (faddr_sect != NULL) { - struct obj_section *osect; + struct obj_section *osect, *dot_dynamic; + dot_dynamic = NULL; ALL_OBJFILE_OSECTIONS (faddr_sect->objfile, osect) { + /* We fancy .got sections. Just the thing we need. */ + if (strcmp (osect->the_bfd_section->name, ".got") == 0) + return osect->addr; + + /* As an alternative, we could use DT_PLTGOT. */ if (strcmp (osect->the_bfd_section->name, ".dynamic") == 0) - break; + dot_dynamic = osect; } - if (osect < faddr_sect->objfile->sections_end) + if (dot_dynamic != NULL) { CORE_ADDR addr; - addr = osect->addr; - while (addr < osect->endaddr) + addr = dot_dynamic->addr; + while (addr < dot_dynamic->endaddr) { int status; LONGEST tag; @@ -3185,6 +3260,9 @@ break; global_pointer = extract_unsigned_integer (buf, sizeof (buf)); + /* We need to relocate. */ + global_pointer += dot_dynamic->offset; + /* The payoff... */ return global_pointer; } @@ -3350,10 +3428,10 @@ pfs = read_register (IA64_PFS_REGNUM); pfs &= 0xc000000000000000LL; - pfs |= (cfm & 0xffffffffffffLL); + pfs |= (cfm & 0x3fffffffffLL); write_register (IA64_PFS_REGNUM, pfs); - cfm &= 0xc000000000000000LL; + cfm &= 0x8000000000000000LL; cfm |= rseslots; write_register (IA64_CFM_REGNUM, cfm); @@ -3544,7 +3622,8 @@ tdep = xmalloc (sizeof (struct gdbarch_tdep)); gdbarch = gdbarch_alloc (&info, tdep); - tdep->sigcontext_register_address = 0; + tdep->osabi = info.osabi; + tdep->sigcontext_register_address = NULL; /* Define the ia64 floating-point format to gdb. */ builtin_type_ia64_ext = Index: gdb/ia64-tdep.h =================================================================== RCS file: /home/marcel/CVS/gdb6/gdb/ia64-tdep.h,v retrieving revision 1.1.1.2 retrieving revision 1.3 diff -u -r1.1.1.2 -r1.3 --- gdb/ia64-tdep.h 24 Jun 2005 20:31:36 -0000 1.1.1.2 +++ gdb/ia64-tdep.h 25 Jun 2005 01:59:15 -0000 1.3 @@ -22,6 +22,8 @@ #ifndef IA64_TDEP_H #define IA64_TDEP_H +#include "osabi.h" + /* Register numbers of various important registers. */ /* General registers; there are 128 of these 64 bit wide registers. @@ -198,6 +200,8 @@ struct gdbarch_tdep { + enum gdb_osabi osabi; /* OS/ABI of inferior. */ + CORE_ADDR (*sigcontext_register_address) (CORE_ADDR, int); }; Index: gdb/inf-ptrace.c =================================================================== RCS file: /home/marcel/CVS/gdb6/gdb/inf-ptrace.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- gdb/inf-ptrace.c 24 Jun 2005 20:31:36 -0000 1.1.1.2 +++ gdb/inf-ptrace.c 30 Jun 2005 04:56:38 -0000 1.2 @@ -511,6 +511,13 @@ case TARGET_OBJECT_WCOOKIE: return -1; + case TARGET_OBJECT_DIRTY: +#ifndef NATIVE_XFER_DIRTY +#define NATIVE_XFER_DIRTY(OPS,OBJ,ANNEX,RDBUF,WRBUF,OFS,LEN) (-1) +#endif + return NATIVE_XFER_DIRTY (ops, object, annex, readbuf, writebuf, + offset, len); + default: return -1; } Index: gdb/inftarg.c =================================================================== RCS file: /home/marcel/CVS/gdb6/gdb/inftarg.c,v retrieving revision 1.1.1.4 retrieving revision 1.6 diff -u -r1.1.1.4 -r1.6 --- gdb/inftarg.c 24 Jun 2005 20:31:36 -0000 1.1.1.4 +++ gdb/inftarg.c 24 Jun 2005 22:20:50 -0000 1.6 @@ -559,6 +559,13 @@ return NATIVE_XFER_AUXV (ops, object, annex, readbuf, writebuf, offset, len); + case TARGET_OBJECT_DIRTY: +#ifndef NATIVE_XFER_DIRTY +#define NATIVE_XFER_DIRTY(OPS,OBJECT,ANNEX,WRITEBUF,READBUF,OFFSET,LEN) (-1) +#endif + return NATIVE_XFER_DIRTY (ops, object, annex, readbuf, writebuf, + offset, len); + default: return -1; } Index: gdb/remote.c =================================================================== RCS file: /home/marcel/CVS/gdb6/gdb/remote.c,v retrieving revision 1.1.1.6 retrieving revision 1.9 diff -u -r1.1.1.6 -r1.9 --- gdb/remote.c 24 Jun 2005 20:31:37 -0000 1.1.1.6 +++ gdb/remote.c 25 Jun 2005 05:20:28 -0000 1.9 @@ -995,6 +995,23 @@ show_packet_config_cmd (&remote_protocol_p); } +/* 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 (struct ui_file *file, int from_tty, + struct cmd_list_element *c, + const char *value) +{ + show_packet_config_cmd (&remote_protocol_qPart_dirty); +} /* Tokens for use by the asynchronous signal handlers for SIGINT. */ @@ -2108,6 +2125,7 @@ downloading. */ update_packet_config (&remote_protocol_binary_download); update_packet_config (&remote_protocol_qPart_auxv); + update_packet_config (&remote_protocol_qPart_dirty); update_packet_config (&remote_protocol_qGetTLSAddr); } @@ -5035,6 +5053,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; } @@ -5584,6 +5619,7 @@ show_remote_protocol_vcont_packet_cmd (gdb_stdout, from_tty, NULL, NULL); show_remote_protocol_binary_download_cmd (gdb_stdout, from_tty, NULL, NULL); show_remote_protocol_qPart_auxv_packet_cmd (gdb_stdout, from_tty, NULL, NULL); + show_remote_protocol_qPart_dirty_packet_cmd (gdb_stdout, from_tty, NULL, NULL); show_remote_protocol_qGetTLSAddr_packet_cmd (gdb_stdout, from_tty, NULL, NULL); } @@ -5814,6 +5850,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); + add_packet_config_cmd (&remote_protocol_qGetTLSAddr, "qGetTLSAddr", "get-thread-local-storage-address", set_remote_protocol_qGetTLSAddr_packet_cmd, Index: gdb/target.h =================================================================== RCS file: /home/marcel/CVS/gdb6/gdb/target.h,v retrieving revision 1.1.1.4 retrieving revision 1.5 diff -u -r1.1.1.4 -r1.5 --- gdb/target.h 24 Jun 2005 20:31:38 -0000 1.1.1.4 +++ gdb/target.h 24 Jun 2005 21:14:20 -0000 1.5 @@ -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, ... */ }; Index: gdb/config/djgpp/fnchange.lst =================================================================== RCS file: /home/marcel/CVS/gdb6/gdb/config/djgpp/fnchange.lst,v retrieving revision 1.1.1.4 retrieving revision 1.6 diff -u -r1.1.1.4 -r1.6 --- gdb/config/djgpp/fnchange.lst 24 Jun 2005 20:31:41 -0000 1.1.1.4 +++ gdb/config/djgpp/fnchange.lst 4 Jul 2005 19:53:50 -0000 1.6 @@ -145,6 +145,9 @@ @V@/gdb/i386-sol2-tdep.c @V@/gdb/i3sol2-tdep.c @V@/gdb/ia64-aix-nat.c @V@/gdb/ia64ax-nat.c @V@/gdb/ia64-aix-tdep.c @V@/gdb/ia64ax-tdep.c +@V@/gdb/ia64-fbsd-nat.c @V@/gdb/ia64fb-nat.c +@V@/gdb/ia64-fbsd-tdep.c @V@/gdb/ia64fb-tdep.c +@V@/gdb/ia64-fbsd-tdep.h @V@/gdb/ia64fb-tdep.h @V@/gdb/ia64-linux-nat.c @V@/gdb/ia64lx-nat.c @V@/gdb/ia64-linux-nat.c @V@/gdb/ia64lx-tdep.c @V@/gdb/jv-exp.tab.c @V@/gdb/jv-exp_tab.c Index: gdb/config/ia64/fbsd.mh =================================================================== RCS file: gdb/config/ia64/fbsd.mh diff -N gdb/config/ia64/fbsd.mh --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gdb/config/ia64/fbsd.mh 30 Jun 2005 04:55:28 -0000 1.3 @@ -0,0 +1,2 @@ +NATDEPFILES= fork-child.o inf-ptrace.o fbsd-nat.o ia64-fbsd-nat.o gcore.o +NAT_FILE= nm-fbsd.h Index: gdb/config/ia64/fbsd.mt =================================================================== RCS file: gdb/config/ia64/fbsd.mt diff -N gdb/config/ia64/fbsd.mt --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gdb/config/ia64/fbsd.mt 24 May 2005 04:49:21 -0000 1.2 @@ -0,0 +1,2 @@ +TDEPFILES= corelow.o ia64-fbsd-tdep.o ia64-tdep.o solib.o solib-svr4.o +DEPRECATED_TM_FILE= tm-fbsd.h Index: gdb/config/ia64/nm-fbsd.h =================================================================== RCS file: gdb/config/ia64/nm-fbsd.h diff -N gdb/config/ia64/nm-fbsd.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gdb/config/ia64/nm-fbsd.h 5 Jul 2005 02:27:00 -0000 1.6 @@ -0,0 +1,33 @@ +/* Definitions to natively run GDB on FreeBSD/ia64. + + Copyright 2005 Free Software Foundation, Inc. + + Contributed by Marcel Moolenaar (marcel@xcllnt.net). + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef NM_FBSD_H +#define NM_FBSD_H + +#include "target.h" + +#define NATIVE_XFER_DIRTY ia64_fbsd_xfer_dirty +extern LONGEST ia64_fbsd_xfer_dirty(struct target_ops *, enum target_object, + const char *, void *, const void *, ULONGEST, LONGEST); + +#endif /* NM_FBSD_H */ Index: gdb/config/ia64/nm-linux.h =================================================================== RCS file: /home/marcel/CVS/gdb6/gdb/config/ia64/nm-linux.h,v retrieving revision 1.1.1.2 retrieving revision 1.4 diff -u -r1.1.1.2 -r1.4 --- gdb/config/ia64/nm-linux.h 28 Apr 2005 21:53:05 -0000 1.1.1.2 +++ gdb/config/ia64/nm-linux.h 24 May 2005 04:41:21 -0000 1.4 @@ -86,4 +86,9 @@ ULONGEST offset, LONGEST len); +#define NATIVE_XFER_DIRTY ia64_linux_xfer_dirty +extern LONGEST ia64_linux_xfer_dirty (struct target_ops *, enum target_object, + const char *, void *, const void *, + ULONGEST, LONGEST); + #endif /* #ifndef NM_LINUX_H */ Index: gdb/config/ia64/tm-fbsd.h =================================================================== RCS file: gdb/config/ia64/tm-fbsd.h diff -N gdb/config/ia64/tm-fbsd.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gdb/config/ia64/tm-fbsd.h 4 Jul 2005 19:50:02 -0000 1.5 @@ -0,0 +1,32 @@ +/* Definitions to target GDB to FreeBSD/ia64. + + Copyright 2005 Free Software Foundation, Inc. + + Contributed by Marcel Moolenaar (marcel@xcllnt.net). + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef TM_FBSD_H +#define TM_FBSD_H + +#include "solib.h" + +extern int ia64_fbsd_in_sigtramp (CORE_ADDR pc, char *fnm); +#define DEPRECATED_IN_SIGTRAMP(pc,fnm) ia64_fbsd_in_sigtramp (pc, fnm) + +#endif /* TM_FBSD_H */ Index: gdb/testsuite/gdb.asm/ia64.inc =================================================================== RCS file: /home/marcel/CVS/gdb6/gdb/testsuite/gdb.asm/ia64.inc,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- gdb/testsuite/gdb.asm/ia64.inc 24 Jun 2005 20:31:44 -0000 1.1.1.2 +++ gdb/testsuite/gdb.asm/ia64.inc 2 Jul 2005 20:26:22 -0000 1.2 @@ -3,6 +3,7 @@ alloc r33=ar.pfs,0,2,0,0 mov r32=b0 nop.i 0 + ;; .endm comment "subroutine epilogue" @@ -10,6 +11,7 @@ nop.m 0 mov ar.pfs=r33 mov b0=r32 + ;; nop.m 0 nop.f 0 br.ret.sptk.many b0 @@ -49,3 +51,16 @@ \name: .long \value .endm + + comment "Declare a subroutine" + .purgem gdbasm_declare + .macro gdbasm_declare name + .proc \name +\name: + .endm + + comment "End a subroutine" + .purgem gdbasm_end + .macro gdbasm_end name + .endp \name + .endm --Q68bSM7Ycu6FN28Q--