1 Index: gdb/ia64-fbsd-nat.c
2 ===================================================================
3 RCS file: gdb/ia64-fbsd-nat.c
4 diff -N gdb/ia64-fbsd-nat.c
5 --- /dev/null 1 Jan 1970 00:00:00 -0000
6 +++ gdb/ia64-fbsd-nat.c 17 Apr 2004 19:39:20 -0000 1.3
9 + * Copyright (c) 2004 Marcel Moolenaar
10 + * All rights reserved.
12 + * Redistribution and use in source and binary forms, with or without
13 + * modification, are permitted provided that the following conditions
16 + * 1. Redistributions of source code must retain the above copyright
17 + * notice, this list of conditions and the following disclaimer.
18 + * 2. Redistributions in binary form must reproduce the above copyright
19 + * notice, this list of conditions and the following disclaimer in the
20 + * documentation and/or other materials provided with the distribution.
22 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 +#include "inferior.h"
36 +#include "regcache.h"
38 +#include <sys/types.h>
39 +#include <sys/ptrace.h>
40 +#include <machine/reg.h>
42 +#ifdef HAVE_SYS_PROCFS_H
43 +#include <sys/procfs.h>
46 +#ifndef HAVE_GREGSET_T
47 +typedef struct reg gregset_t;
50 +#ifndef HAVE_FPREGSET_T
51 +typedef struct fpreg fpregset_t;
56 +#define FPREG_SUPPLIES(r) ((r) >= IA64_FR0_REGNUM && (r) <= IA64_FR127_REGNUM)
57 +#define GREG_SUPPLIES(r) (!FPREG_SUPPLIES(r))
59 +/* XXX need to go away. */
60 +void ia64_fbsd_supply_fpregs (void *, int);
61 +void ia64_fbsd_supply_gregs (void *, int);
64 +fetch_inferior_registers (int regno)
71 + if (regno == -1 || GREG_SUPPLIES(regno))
73 + if (ptrace (PT_GETREGS, PIDGET(inferior_ptid),
74 + (PTRACE_ARG3_TYPE)®s.r, 0) == -1)
75 + perror_with_name ("Couldn't get registers");
76 + ia64_fbsd_supply_gregs (®s.r, regno);
81 + if (regno == -1 || FPREG_SUPPLIES(regno))
83 + if (ptrace (PT_GETFPREGS, PIDGET(inferior_ptid),
84 + (PTRACE_ARG3_TYPE)®s.fpr, 0) == -1)
85 + perror_with_name ("Couldn't get FP registers");
86 + ia64_fbsd_supply_fpregs (®s.fpr, regno);
93 +store_inferior_registers (int regno)
100 + if (regno == -1 || GREG_SUPPLIES(regno))
102 + if (ptrace (PT_GETREGS, PIDGET(inferior_ptid),
103 + (PTRACE_ARG3_TYPE)®s.r, 0) == -1)
104 + perror_with_name ("Couldn't get registers");
105 + fill_gregset (®s.r, regno);
106 + if (ptrace (PT_SETREGS, PIDGET(inferior_ptid),
107 + (PTRACE_ARG3_TYPE)®s.r, 0) == -1)
108 + perror_with_name ("Couldn't get registers");
113 + if (regno == -1 || FPREG_SUPPLIES(regno))
115 + if (ptrace (PT_GETFPREGS, PIDGET(inferior_ptid),
116 + (PTRACE_ARG3_TYPE)®s.fpr, 0) == -1)
117 + perror_with_name ("Couldn't get FP registers");
118 + fill_fpregset (®s.fpr, regno);
119 + if (ptrace (PT_SETFPREGS, PIDGET(inferior_ptid),
120 + (PTRACE_ARG3_TYPE)®s.fpr, 0) == -1)
121 + perror_with_name ("Couldn't get FP registers");
127 +LONGEST ia64_fbsd_xfer_dirty (struct target_ops *ops, enum target_object obj,
128 + const char *annex, void *rbuf, const void *wbuf,
129 + ULONGEST ofs, LONGEST len)
133 + if (rbuf != NULL) {
134 + if (ptrace (PT_GETKSTACK, PIDGET(inferior_ptid), (PTRACE_ARG3_TYPE)rbuf,
136 + perror_with_name ("Couldn't read dirty register");
140 + if (ptrace (PT_SETKSTACK, PIDGET(inferior_ptid), (PTRACE_ARG3_TYPE)wbuf,
142 + perror_with_name ("Couldn't write dirty register");
150 +_initialize_ia64_fbsd_nat (void)
153 Index: gdb/ia64-fbsd-tdep.c
154 ===================================================================
155 RCS file: gdb/ia64-fbsd-tdep.c
156 diff -N gdb/ia64-fbsd-tdep.c
157 --- /dev/null 1 Jan 1970 00:00:00 -0000
158 +++ gdb/ia64-fbsd-tdep.c 17 Apr 2004 19:39:20 -0000 1.6
161 + * Copyright (c) 2004 Marcel Moolenaar
162 + * All rights reserved.
164 + * Redistribution and use in source and binary forms, with or without
165 + * modification, are permitted provided that the following conditions
168 + * 1. Redistributions of source code must retain the above copyright
169 + * notice, this list of conditions and the following disclaimer.
170 + * 2. Redistributions in binary form must reproduce the above copyright
171 + * notice, this list of conditions and the following disclaimer in the
172 + * documentation and/or other materials provided with the distribution.
174 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
175 + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
176 + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
177 + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
178 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
179 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
180 + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
181 + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
182 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
183 + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
187 +#include "gdb_string.h"
188 +#include "regcache.h"
190 +#include "solib-svr4.h"
193 +#include "ia64-tdep.h"
195 +#define FPREG_SUPPLIES(r) ((r) >= IA64_FR0_REGNUM && (r) <= IA64_FR127_REGNUM)
196 +#define GREG_SUPPLIES(r) (!FPREG_SUPPLIES(r))
198 +static int reg_offset[462] = {
199 + -1, 96, 248, 256, 152, 160, 168, 176, /* Regs 0-7. */
200 + 264, 272, 280, 288, 0, 64, 296, 304, /* Regs 8-15. */
201 + 312, 320, 328, 336, 344, 352, 360, 368, /* Regs 16-23. */
202 + 376, 384, 392, 400, 408, 416, 424, 432, /* Regs 24-31. */
203 + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 32-39. */
204 + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 40-47. */
205 + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 48-55. */
206 + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 56-63. */
207 + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 64-71. */
208 + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 72-79. */
209 + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 80-87. */
210 + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 88-95. */
211 + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 96-103. */
212 + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 104-111. */
213 + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 112-119. */
214 + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 120-127. */
215 + -1, -1, 0, 16, 32, 48, 320, 336, /* Regs 128-135. */
216 + 352, 368, 384, 400, 416, 432, 448, 464, /* Regs 136-143. */
217 + 64, 80, 96, 112, 128, 144, 160, 176, /* Regs 144-151. */
218 + 192, 208, 224, 240, 256, 272, 288, 304, /* Regs 152-159. */
219 + 480, 496, 512, 528, 544, 560, 576, 592, /* Regs 160-167. */
220 + 608, 624, 640, 656, 672, 688, 704, 720, /* Regs 168-175. */
221 + 736, 752, 768, 784, 800, 816, 832, 848, /* Regs 176-183. */
222 + 864, 880, 896, 912, 928, 944, 960, 976, /* Regs 184-191. */
223 + 992, 1008, 1024, 1040, 1056, 1072, 1088, 1104, /* Regs 192-199. */
224 + 1120, 1136, 1152, 1168, 1184, 1200, 1216, 1232, /* Regs 200-207. */
225 + 1248, 1264, 1280, 1296, 1312, 1328, 1344, 1360, /* Regs 208-215. */
226 + 1376, 1392, 1408, 1424, 1440, 1456, 1472, 1488, /* Regs 216-223. */
227 + 1504, 1520, 1536, 1552, 1568, 1584, 1600, 1616, /* Regs 224-231. */
228 + 1632, 1648, 1664, 1680, 1696, 1712, 1728, 1744, /* Regs 232-239. */
229 + 1760, 1776, 1792, 1808, 1824, 1840, 1856, 1872, /* Regs 240-247. */
230 + 1888, 1904, 1920, 1936, 1952, 1968, 1984, 2000, /* Regs 248-255. */
231 + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 256-263. */
232 + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 264-271. */
233 + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 272-279. */
234 + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 280-287. */
235 + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 288-295. */
236 + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 296-303. */
237 + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 304-311. */
238 + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 312-319. */
239 + 16, 184, 192, 200, 208, 216, 440, 448, /* Regs 320-327. */
240 + -1, -1, 24, 120, 88, 112, -1, -1, /* Regs 328-335. */
241 + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 336-343. */
242 + -1, -1, -1, -1, -1, -1, 72, 104, /* Regs 344-351. */
243 + 40, 48, -1, -1, -1, -1, -1, 464, /* Regs 352-359. */
244 + 472, -1, -1, -1, -1, -1, 456, -1, /* Regs 360-367. */
245 + -1, -1, 8, -1, -1, -1, 80, -1, /* Regs 368-375. */
246 + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 376-383. */
247 + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 384-391. */
248 + -1, -1, -1, -1, -1, -1, 32, 224, /* Regs 392-399. */
249 + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 400-407. */
250 + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 408-415. */
251 + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 416-423. */
252 + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 424-431. */
253 + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 432-439. */
254 + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 440-447. */
255 + -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 448-455. */
256 + -1, -1, -1, -1, -1, -1
260 +ia64_fbsd_regcache_collect (struct regcache *regcache, int regno,
265 + if (regno < 0 || regno >= NUM_REGS)
268 + ofs = reg_offset[regno];
270 + regcache_raw_collect (regcache, regno, (char*)regs + ofs);
274 +ia64_fbsd_regcache_supply (struct regcache *regcache, int regno,
279 + if (regno < 0 || regno >= NUM_REGS)
282 + ofs = reg_offset[regno];
283 + if (regno == IA64_BSP_REGNUM)
285 + /* BSP is synthesized. It's not actually present in struct reg,
286 + but can be derived from bspstore and ndirty. The offset of
287 + IA64_BSP_REGNUM in the reg_offset array above is that of the
288 + ndirty field in struct reg. */
290 + bsp = *((uint64_t*)((char *)regs + ofs)); /* ndirty */
291 + bsp += *((uint64_t*)((char *)regs + reg_offset[IA64_BSPSTORE_REGNUM]));
292 + regcache_raw_supply (regcache, regno, &bsp);
297 + regcache_raw_supply (regcache, regno, NULL);
299 + regcache_raw_supply (regcache, regno, (char *)regs + ofs);
304 +fill_fpregset (void *fpregs, int regno)
308 + for (regno = 0; regno < NUM_REGS; regno++)
310 + if (FPREG_SUPPLIES(regno))
311 + ia64_fbsd_regcache_collect (current_regcache, regno, fpregs);
316 + if (FPREG_SUPPLIES(regno))
317 + ia64_fbsd_regcache_collect (current_regcache, regno, fpregs);
322 +fill_gregset (void *gregs, int regno)
326 + for (regno = 0; regno < NUM_REGS; regno++)
328 + if (GREG_SUPPLIES(regno))
329 + ia64_fbsd_regcache_collect (current_regcache, regno, gregs);
334 + if (GREG_SUPPLIES(regno))
335 + ia64_fbsd_regcache_collect (current_regcache, regno, gregs);
340 +ia64_fbsd_supply_fpregs (const void *fpregs, int regno)
344 + for (regno = 0; regno < NUM_REGS; regno++)
346 + if (FPREG_SUPPLIES(regno))
347 + ia64_fbsd_regcache_supply (current_regcache, regno, fpregs);
352 + if (FPREG_SUPPLIES(regno))
353 + ia64_fbsd_regcache_supply (current_regcache, regno, fpregs);
358 +ia64_fbsd_supply_gregs (const void *gregs, int regno)
362 + for (regno = 0; regno < NUM_REGS; regno++)
364 + if (GREG_SUPPLIES(regno))
365 + ia64_fbsd_regcache_supply (current_regcache, regno, gregs);
370 + if (GREG_SUPPLIES(regno))
371 + ia64_fbsd_regcache_supply (current_regcache, regno, gregs);
376 +ia64_fbsd_supply_gregset (const struct regset *regset,
377 + struct regcache *regcache, int regno,
378 + const void *gregs, size_t len)
382 + for (regno = 0; regno < NUM_REGS; regno++)
384 + if (GREG_SUPPLIES(regno))
385 + ia64_fbsd_regcache_supply (regcache, regno, gregs);
389 + if (GREG_SUPPLIES(regno))
390 + ia64_fbsd_regcache_supply (regcache, regno, gregs);
394 +ia64_fbsd_supply_fpregset (const struct regset *regset,
395 + struct regcache *regcache, int regno,
396 + const void *fpregs, size_t len)
400 + for (regno = 0; regno < NUM_REGS; regno++)
402 + if (FPREG_SUPPLIES(regno))
403 + ia64_fbsd_regcache_supply (regcache, regno, fpregs);
407 + if (FPREG_SUPPLIES(regno))
408 + ia64_fbsd_regcache_supply (regcache, regno, fpregs);
411 +static struct regset gregset = { NULL, ia64_fbsd_supply_gregset };
412 +static struct regset fpregset = { NULL, ia64_fbsd_supply_fpregset };
414 +static const struct regset *
415 +ia64_fbsd_regset_from_core_section (struct gdbarch *gdbarch,
416 + const char *sect_name, size_t sect_size)
418 + if (strcmp (sect_name, ".reg") == 0)
420 + if (strcmp (sect_name, ".reg2") == 0)
421 + return (&fpregset);
426 +ia64_fbsd_pc_in_sigtramp (CORE_ADDR pc, char *func_name)
428 + uint64_t gwpage = 5ULL << 61;
429 + return (pc >= gwpage && pc < (gwpage + 8192)) ? 1 : 0;
433 +ia64_fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
435 + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
437 + set_gdbarch_pc_in_sigtramp (gdbarch, ia64_fbsd_pc_in_sigtramp);
438 + set_gdbarch_regset_from_core_section (gdbarch,
439 + ia64_fbsd_regset_from_core_section);
440 + set_solib_svr4_fetch_link_map_offsets (gdbarch,
441 + svr4_lp64_fetch_link_map_offsets);
442 + tdep->find_global_pointer = ia64_generic_find_global_pointer;
446 +_initialize_ia64_fbsd_tdep (void)
448 + gdbarch_register_osabi (bfd_arch_ia64, 0ul, GDB_OSABI_FREEBSD_ELF,
449 + ia64_fbsd_init_abi);
451 Index: gdb/ia64-tdep.c
452 ===================================================================
453 RCS file: /home/marcel/CVS/gdb6/gdb/ia64-tdep.c,v
454 retrieving revision 1.1.1.3
455 retrieving revision 1.5
456 diff -u -r1.1.1.3 -r1.5
457 --- gdb/ia64-tdep.c 16 Apr 2004 00:51:25 -0000 1.1.1.3
458 +++ gdb/ia64-tdep.c 16 Apr 2004 01:28:33 -0000 1.5
460 #include "libunwind-ia64.h"
463 -/* Hook for determining the global pointer when calling functions in
464 - the inferior under AIX. The initialization code in ia64-aix-nat.c
465 - sets this hook to the address of a function which will find the
466 - global pointer for a given address.
468 - The generic code which uses the dynamic section in the inferior for
469 - finding the global pointer is not of much use on AIX since the
470 - values obtained from the inferior have not been relocated. */
472 -CORE_ADDR (*native_find_global_pointer) (CORE_ADDR) = 0;
474 /* An enumeration of the different IA-64 instruction types. */
476 typedef enum instruction_type
483 - CORE_ADDR (*sigcontext_register_address) (CORE_ADDR, int);
484 - /* OS specific function which, given a frame address
485 - and register number, returns the offset to the
486 - given register from the start of the frame. */
487 - CORE_ADDR (*find_global_pointer) (CORE_ADDR);
490 -#define SIGCONTEXT_REGISTER_ADDRESS \
491 - (gdbarch_tdep (current_gdbarch)->sigcontext_register_address)
492 -#define FIND_GLOBAL_POINTER \
493 - (gdbarch_tdep (current_gdbarch)->find_global_pointer)
496 ia64_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
497 struct reggroup *group)
500 if ((cfm & 0x7f) > regnum - V32_REGNUM)
503 ULONGEST reg_addr = rse_address_add (bsp, (regnum - V32_REGNUM));
504 - reg = read_memory_integer ((CORE_ADDR)reg_addr, 8);
505 - store_unsigned_integer (buf, register_size (current_gdbarch, regnum), reg);
506 + regcache_cooked_read_unsigned (regcache, IA64_BSPSTORE_REGNUM,
508 + if (reg_addr < bspstore) {
509 + reg = read_memory_integer ((CORE_ADDR)reg_addr, 8);
510 + store_unsigned_integer (buf, register_size (current_gdbarch,
513 + target_read_partial (¤t_target, TARGET_OBJECT_DIRTY,
514 + (void*)bspstore, buf, reg_addr - bspstore,
515 + register_size (current_gdbarch, regnum));
518 store_unsigned_integer (buf, register_size (current_gdbarch, regnum), 0);
521 regcache_cooked_read_unsigned (regcache, IA64_RNAT_REGNUM, &nat_collection);
523 - nat_collection = read_memory_integer (nat_addr, 8);
526 + regcache_cooked_read_unsigned (regcache, IA64_BSPSTORE_REGNUM,
528 + if (nat_addr < bspstore)
529 + nat_collection = read_memory_integer (nat_addr, 8);
532 + target_read_partial (¤t_target, TARGET_OBJECT_DIRTY,
533 + (void*)bspstore, natbuf,
534 + nat_addr - bspstore,
535 + register_size (current_gdbarch, regnum));
536 + nat_collection = *((uint64_t*)natbuf);
539 nat_bit = (gr_addr >> 3) & 0x3f;
540 natN_val = (nat_collection >> nat_bit) & 1;
544 if ((cfm & 0x7f) > regnum - V32_REGNUM)
547 ULONGEST reg_addr = rse_address_add (bsp, (regnum - V32_REGNUM));
548 - write_memory (reg_addr, (void *)buf, 8);
549 + regcache_cooked_read_unsigned (regcache, IA64_BSPSTORE_REGNUM,
551 + if (reg_addr < bspstore)
552 + write_memory (reg_addr, (void *)buf, 8);
554 + target_write_partial (¤t_target, TARGET_OBJECT_DIRTY,
555 + (void*)bspstore, buf, reg_addr - bspstore,
556 + register_size (current_gdbarch, regnum));
559 else if (IA64_NAT0_REGNUM <= regnum && regnum <= IA64_NAT31_REGNUM)
560 @@ -845,13 +851,33 @@
564 - nat_collection = read_memory_integer (nat_addr, 8);
566 + regcache_cooked_read_unsigned (regcache, IA64_BSPSTORE_REGNUM,
568 + if (nat_addr < bspstore)
569 + nat_collection = read_memory_integer (nat_addr, 8);
572 + target_read_partial (¤t_target, TARGET_OBJECT_DIRTY,
573 + (void*)bspstore, natbuf,
574 + nat_addr - bspstore,
575 + register_size (current_gdbarch, regnum));
576 + nat_collection = *((uint64_t*)natbuf);
579 nat_collection |= natN_mask;
581 nat_collection &= ~natN_mask;
582 - store_unsigned_integer (nat_buf, register_size (current_gdbarch, regnum), nat_collection);
583 - write_memory (nat_addr, nat_buf, 8);
584 + store_unsigned_integer (nat_buf, register_size (current_gdbarch,
587 + if (nat_addr < bspstore)
588 + write_memory (nat_addr, nat_buf, 8);
590 + target_write_partial (¤t_target, TARGET_OBJECT_DIRTY,
591 + (void*)bspstore, nat_buf,
592 + nat_addr - bspstore,
593 + register_size (current_gdbarch, regnum));
597 @@ -1813,6 +1839,7 @@
598 prev_bof = rse_address_add (prev_bsp, -(prev_cfm & 0x7f));
600 addr = rse_address_add (prev_bof, (regnum - IA64_GR32_REGNUM));
602 *lvalp = lval_memory;
604 read_memory (addr, valuep, register_size (current_gdbarch, regnum));
605 @@ -2858,8 +2885,8 @@
606 DT_PLTGOT tag. If it finds one of these, the corresponding
607 d_un.d_ptr value is the global pointer. */
610 -generic_elf_find_global_pointer (CORE_ADDR faddr)
612 +ia64_generic_find_global_pointer (CORE_ADDR faddr)
614 struct obj_section *faddr_sect;
616 @@ -3255,32 +3282,9 @@
618 tdep = xmalloc (sizeof (struct gdbarch_tdep));
619 gdbarch = gdbarch_alloc (&info, tdep);
621 - /* Set the method of obtaining the sigcontext addresses at which
622 - registers are saved. The method of checking to see if
623 - native_find_global_pointer is nonzero to indicate that we're
624 - on AIX is kind of hokey, but I can't think of a better way
626 - if (info.osabi == GDB_OSABI_LINUX)
627 - tdep->sigcontext_register_address = ia64_linux_sigcontext_register_address;
628 - else if (native_find_global_pointer != 0)
629 - tdep->sigcontext_register_address = ia64_aix_sigcontext_register_address;
631 - tdep->sigcontext_register_address = 0;
633 - /* We know that GNU/Linux won't have to resort to the
634 - native_find_global_pointer hackery. But that's the only one we
635 - know about so far, so if native_find_global_pointer is set to
636 - something non-zero, then use it. Otherwise fall back to using
637 - generic_elf_find_global_pointer. This arrangement should (in
638 - theory) allow us to cross debug GNU/Linux binaries from an AIX
640 - if (info.osabi == GDB_OSABI_LINUX)
641 - tdep->find_global_pointer = generic_elf_find_global_pointer;
642 - else if (native_find_global_pointer != 0)
643 - tdep->find_global_pointer = native_find_global_pointer;
645 - tdep->find_global_pointer = generic_elf_find_global_pointer;
646 + tdep->osabi = info.osabi;
647 + tdep->sigcontext_register_address = NULL;
648 + tdep->find_global_pointer = ia64_generic_find_global_pointer;
650 /* Define the ia64 floating-point format to gdb. */
651 builtin_type_ia64_ext =
652 @@ -3338,10 +3342,7 @@
653 set_gdbarch_memory_remove_breakpoint (gdbarch, ia64_memory_remove_breakpoint);
654 set_gdbarch_breakpoint_from_pc (gdbarch, ia64_breakpoint_from_pc);
655 set_gdbarch_read_pc (gdbarch, ia64_read_pc);
656 - if (info.osabi == GDB_OSABI_LINUX)
657 - set_gdbarch_write_pc (gdbarch, ia64_linux_write_pc);
659 - set_gdbarch_write_pc (gdbarch, ia64_write_pc);
660 + set_gdbarch_write_pc (gdbarch, ia64_write_pc);
662 /* Settings for calling functions in the inferior. */
663 set_gdbarch_push_dummy_call (gdbarch, ia64_push_dummy_call);
664 @@ -3365,6 +3366,8 @@
666 set_gdbarch_print_insn (gdbarch, ia64_print_insn);
667 set_gdbarch_convert_from_func_ptr_addr (gdbarch, ia64_convert_from_func_ptr_addr);
669 + gdbarch_init_osabi (info, gdbarch);
673 Index: gdb/ia64-tdep.h
674 ===================================================================
675 RCS file: /home/marcel/CVS/gdb6/gdb/ia64-tdep.h,v
676 retrieving revision 1.1.1.1
677 retrieving revision 1.2
678 diff -u -r1.1.1.1 -r1.2
679 --- gdb/ia64-tdep.h 26 Mar 2004 02:54:41 -0000 1.1.1.1
680 +++ gdb/ia64-tdep.h 28 Mar 2004 03:47:34 -0000 1.2
685 -extern CORE_ADDR ia64_linux_sigcontext_register_address (CORE_ADDR, int);
686 -extern CORE_ADDR ia64_aix_sigcontext_register_address (CORE_ADDR, int);
687 -extern unsigned long ia64_linux_getunwind_table (void *, size_t);
688 -extern void ia64_write_pc (CORE_ADDR, ptid_t);
689 -extern void ia64_linux_write_pc (CORE_ADDR, ptid_t);
692 +/* Target-dependent structure in gdbarch. */
695 + enum gdb_osabi osabi; /* OS/ABI of inferior. */
697 + CORE_ADDR (*sigcontext_register_address) (CORE_ADDR, int);
698 + /* OS specific function which, given a frame address
699 + and register number, returns the offset to the
700 + given register from the start of the frame. */
701 + CORE_ADDR (*find_global_pointer) (CORE_ADDR);
704 +#define SIGCONTEXT_REGISTER_ADDRESS \
705 + (gdbarch_tdep (current_gdbarch)->sigcontext_register_address)
706 +#define FIND_GLOBAL_POINTER \
707 + (gdbarch_tdep (current_gdbarch)->find_global_pointer)
709 +extern CORE_ADDR ia64_generic_find_global_pointer (CORE_ADDR);
711 #endif /* IA64_TDEP_H */
713 ===================================================================
714 RCS file: /home/marcel/CVS/gdb6/gdb/inftarg.c,v
715 retrieving revision 1.1.1.1
716 retrieving revision 1.2
717 diff -u -r1.1.1.1 -r1.2
718 --- gdb/inftarg.c 26 Mar 2004 02:54:41 -0000 1.1.1.1
719 +++ gdb/inftarg.c 28 Mar 2004 03:47:34 -0000 1.2
721 return NATIVE_XFER_WCOOKIE (ops, object, annex, readbuf, writebuf,
724 + case TARGET_OBJECT_DIRTY:
725 +#ifndef TARGET_XFER_DIRTY
726 +#define TARGET_XFER_DIRTY(OPS,OBJECT,ANNEX,WRITEBUF,READBUF,OFFSET,LEN) (-1)
728 + return TARGET_XFER_DIRTY (ops, object, annex, readbuf, writebuf,
735 ===================================================================
736 RCS file: /home/marcel/CVS/gdb6/gdb/remote.c,v
737 retrieving revision 1.1.1.3
738 retrieving revision 1.5
739 diff -u -r1.1.1.3 -r1.5
740 --- gdb/remote.c 16 Apr 2004 00:51:28 -0000 1.1.1.3
741 +++ gdb/remote.c 16 Apr 2004 01:28:33 -0000 1.5
743 show_packet_config_cmd (&remote_protocol_qPart_auxv);
746 +/* Should we try the 'qPart:dirty' (target dirty register read) request? */
747 +static struct packet_config remote_protocol_qPart_dirty;
750 +set_remote_protocol_qPart_dirty_packet_cmd (char *args, int from_tty,
751 + struct cmd_list_element *c)
753 + update_packet_config (&remote_protocol_qPart_dirty);
757 +show_remote_protocol_qPart_dirty_packet_cmd (char *args, int from_tty,
758 + struct cmd_list_element *c)
760 + show_packet_config_cmd (&remote_protocol_qPart_dirty);
764 /* Tokens for use by the asynchronous signal handlers for SIGINT */
765 static void *sigint_remote_twice_token;
766 @@ -2088,6 +2105,7 @@
768 update_packet_config (&remote_protocol_binary_download);
769 update_packet_config (&remote_protocol_qPart_auxv);
770 + update_packet_config (&remote_protocol_qPart_dirty);
773 /* Symbol look-up. */
774 @@ -4925,6 +4943,23 @@
778 + case TARGET_OBJECT_DIRTY:
779 + if (remote_protocol_qPart_dirty.support != PACKET_DISABLE)
781 + snprintf (buf2, rs->remote_packet_size, "qPart:dirty:read::%lx",
782 + (long)(offset >> 3));
787 + getpkt (buf2, rs->remote_packet_size, 0);
788 + if (packet_ok (buf2, &remote_protocol_qPart_dirty) != PACKET_OK)
790 + i = hex2bin (buf2, readbuf, len);
798 @@ -5423,6 +5458,7 @@
799 show_remote_protocol_vcont_packet_cmd (args, from_tty, NULL);
800 show_remote_protocol_binary_download_cmd (args, from_tty, NULL);
801 show_remote_protocol_qPart_auxv_packet_cmd (args, from_tty, NULL);
802 + show_remote_protocol_qPart_dirty_packet_cmd (args, from_tty, NULL);
806 @@ -5670,6 +5706,13 @@
807 "qPart_auxv", "read-aux-vector",
808 set_remote_protocol_qPart_auxv_packet_cmd,
809 show_remote_protocol_qPart_auxv_packet_cmd,
810 + &remote_set_cmdlist, &remote_show_cmdlist,
813 + add_packet_config_cmd (&remote_protocol_qPart_dirty,
814 + "qPart_dirty", "read-dirty-registers",
815 + set_remote_protocol_qPart_dirty_packet_cmd,
816 + show_remote_protocol_qPart_dirty_packet_cmd,
817 &remote_set_cmdlist, &remote_show_cmdlist,
821 ===================================================================
822 RCS file: /home/marcel/CVS/gdb6/gdb/target.h,v
823 retrieving revision 1.1.1.1
824 retrieving revision 1.2
825 diff -u -r1.1.1.1 -r1.2
826 --- gdb/target.h 26 Mar 2004 02:54:42 -0000 1.1.1.1
827 +++ gdb/target.h 28 Mar 2004 03:47:34 -0000 1.2
829 /* Transfer auxilliary vector. */
831 /* StackGhost cookie. See "sparc-tdep.c". */
832 - TARGET_OBJECT_WCOOKIE
833 + TARGET_OBJECT_WCOOKIE,
834 + /* Dirty registers. See "ia64-tdep.c". */
835 + TARGET_OBJECT_DIRTY
837 /* Possible future objects: TARGET_OBJECT_FILE, TARGET_OBJECT_PROC, ... */
839 Index: gdb/config/ia64/fbsd.mh
840 ===================================================================
841 RCS file: gdb/config/ia64/fbsd.mh
842 diff -N gdb/config/ia64/fbsd.mh
843 --- /dev/null 1 Jan 1970 00:00:00 -0000
844 +++ gdb/config/ia64/fbsd.mh 25 Jun 2004 03:55:31 -0000
846 +NATDEPFILES= fbsd-proc.o fbsd-thread.o fork-child.o gcore.o \
847 + ia64-fbsd-nat.o infptrace.o inftarg.o
849 Index: gdb/config/ia64/fbsd.mt
850 ===================================================================
851 RCS file: gdb/config/ia64/fbsd.mt
852 diff -N gdb/config/ia64/fbsd.mt
853 --- /dev/null 1 Jan 1970 00:00:00 -0000
854 +++ gdb/config/ia64/fbsd.mt 28 Mar 2004 03:47:38 -0000 1.1
856 +TDEPFILES= corelow.o ia64-fbsd-tdep.o ia64-tdep.o solib.o solib-svr4.o
858 Index: gdb/config/ia64/nm-fbsd.h
859 ===================================================================
860 RCS file: gdb/config/ia64/nm-fbsd.h
861 diff -N gdb/config/ia64/nm-fbsd.h
862 --- /dev/null 1 Jan 1970 00:00:00 -0000
863 +++ gdb/config/ia64/nm-fbsd.h 16 Apr 2004 02:49:16 -0000 1.2
870 +/* Type of the third argument to the `ptrace' system call. */
871 +#define PTRACE_ARG3_TYPE caddr_t
873 +/* Override copies of {fetch,store}_inferior_registers in `infptrace.c'. */
874 +#define FETCH_INFERIOR_REGISTERS
876 +/* We can attach and detach. */
877 +#define ATTACH_DETACH
879 +/* Override child_pid_to_exec_file in 'inftarg.c'. */
880 +#define CHILD_PID_TO_EXEC_FILE
884 +#define TARGET_XFER_DIRTY ia64_fbsd_xfer_dirty
885 +extern LONGEST ia64_fbsd_xfer_dirty(struct target_ops *, enum target_object,
886 + const char *, void *, const void *, ULONGEST, LONGEST);
888 +#endif /* NM_FBSD_H */
889 Index: gdb/config/ia64/tm-fbsd.h
890 ===================================================================
891 RCS file: gdb/config/ia64/tm-fbsd.h
892 diff -N gdb/config/ia64/tm-fbsd.h
893 --- /dev/null 1 Jan 1970 00:00:00 -0000
894 +++ gdb/config/ia64/tm-fbsd.h 17 Apr 2004 01:43:21 -0000 1.2
897 + * Copyright (c) 2004 Marcel Moolenaar
898 + * All rights reserved.
900 + * Redistribution and use in source and binary forms, with or without
901 + * modification, are permitted provided that the following conditions
904 + * 1. Redistributions of source code must retain the above copyright
905 + * notice, this list of conditions and the following disclaimer.
906 + * 2. Redistributions in binary form must reproduce the above copyright
907 + * notice, this list of conditions and the following disclaimer in the
908 + * documentation and/or other materials provided with the distribution.
910 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
911 + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
912 + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
913 + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
914 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
915 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
916 + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
917 + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
918 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
919 + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
927 +#include "ia64/tm-ia64.h"
929 +#endif /* TM_FBSD_H */