From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21142 invoked by alias); 21 Dec 2004 23:24:08 -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 20257 invoked from network); 21 Dec 2004 23:23:49 -0000 Received: from unknown (HELO nimbus.ott.qnx.com) (209.226.137.76) by sourceware.org with SMTP; 21 Dec 2004 23:23:49 -0000 Received: from [192.168.20.27] (CATDOG [192.168.20.27]) by nimbus.ott.qnx.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id ZHDMX5M7; Tue, 21 Dec 2004 18:23:49 -0500 Message-ID: <41C8B077.3040301@qnx.com> Date: Wed, 22 Dec 2004 22:03:00 -0000 From: Kris Warkentin User-Agent: Mozilla Thunderbird 0.7.3 (Windows/20040803) MIME-Version: 1.0 To: gdb-patches@sources.redhat.com Subject: [patch] remove deprecated core support from QNX NTO Content-Type: multipart/mixed; boundary="------------060601040303050603000901" X-SW-Source: 2004-12/txt/msg00422.txt.bz2 This is a multi-part message in MIME format. --------------060601040303050603000901 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-length: 812 Really long ChangeLog for relatively simple fix. Created new supply_regset functions and changed my old ones to call them instead. Then register them with gdbarch and rip out all the deprecated stuff. Look okay? cheers, Kris 2004-12-21 Kris Warkentin * i386-nto-tdep.c (i386nto_supply_gregset_core): New function. (i386nto_supply_fpregset_core): Ditto. (i386nto_supply_gregset): Call core function above. (i386nto_supply_fpregset): Ditto. (i386nto_gregset): New structure for core file support. (i386nto_fpregset): Ditto. (i386nto_regset_from_core_section): New function. (i386nto_init_abi): Register core file support. * nto-tdep.c (fetch_core_registers): Remove function. (regset_core_fns): Remove structure. (_initialize_nto_tdep): Don't call deprecated_add_core_fns. --------------060601040303050603000901 Content-Type: text/plain; name="core.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="core.diff" Content-length: 5629 Index: i386-nto-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/i386-nto-tdep.c,v retrieving revision 1.16 diff -c -r1.16 i386-nto-tdep.c *** i386-nto-tdep.c 10 Dec 2004 13:38:23 -0000 1.16 --- i386-nto-tdep.c 21 Dec 2004 23:18:38 -0000 *************** *** 70,97 **** } static void ! i386nto_supply_gregset (char *gpregs) { ! unsigned regno; int empty = 0; ! for (regno = 0; regno < I386_NUM_GREGS; regno++) { ! int offset = nto_reg_offset (regno); ! if (offset == -1) ! regcache_raw_supply (current_regcache, regno, (char *) &empty); ! else ! regcache_raw_supply (current_regcache, regno, gpregs + offset); } } static void ! i386nto_supply_fpregset (char *fpregs) { ! if (nto_cpuinfo_valid && nto_cpuinfo_flags | X86_CPU_FXSR) ! i387_supply_fxsave (current_regcache, -1, fpregs); else ! i387_supply_fsave (current_regcache, -1, fpregs); } static void --- 70,149 ---- } static void ! i386nto_supply_gregset_core (const struct regset *regset, ! struct regcache *regcache, ! int regnum, const void *gregs, size_t len) { ! const char *regs = gregs; ! unsigned i; int empty = 0; ! for (i = 0; i < I386_NUM_GREGS; i++) { ! if (i == regnum || regnum == -1) ! { ! int offset = nto_reg_offset (i); ! if (offset == -1) ! regcache_raw_supply (regcache, i, (char *) &empty); ! else ! regcache_raw_supply (regcache, i, regs + offset); ! } } } static void ! i386nto_supply_gregset (char *gpregs) { ! i386nto_supply_gregset_core (NULL, current_regcache, -1, gpregs, ! NUM_GPREGS * 4); ! } ! ! static void ! i386nto_supply_fpregset_core (const struct regset *regset, ! struct regcache *regcache, ! int regnum, const void *fpregs, size_t len) ! { ! if (len >= I387_SIZEOF_FXSAVE) ! i387_supply_fxsave (current_regcache, regnum, fpregs); else ! i387_supply_fsave (current_regcache, regnum, fpregs); ! } ! ! static void ! i386nto_supply_fpregset (char *fpregs) ! { ! int len = (nto_cpuinfo_valid && nto_cpuinfo_flags | X86_CPU_FXSR) ? ! I387_SIZEOF_FXSAVE : I387_SIZEOF_FSAVE; ! ! i386nto_supply_fpregset_core (NULL, current_regcache, -1, fpregs, len); ! } ! ! /* nto i386 register sets. */ ! ! static struct regset i386nto_gregset = { ! NULL, ! i386nto_supply_gregset_core ! }; ! ! static struct regset i386nto_fpregset = { ! NULL, ! i386nto_supply_fpregset_core ! }; ! ! /* Return the appropriate register set for the core section identified ! by SECT_NAME and SECT_SIZE. */ ! ! static const struct regset * ! i386nto_regset_from_core_section (struct gdbarch *gdbarch, ! const char *sect_name, size_t sect_size) ! { ! if (strcmp (sect_name, ".reg") == 0) ! return &i386nto_gregset; ! ! if (strcmp (sect_name, ".reg2") == 0) ! return &i386nto_fpregset; ! ! return NULL; } static void *************** *** 276,281 **** --- 328,337 ---- { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + /* Register core file support. */ + set_gdbarch_regset_from_core_section + (gdbarch, i386nto_regset_from_core_section); + /* Deal with our strange signals. */ nto_initialize_signals (); Index: nto-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/nto-tdep.c,v retrieving revision 1.10 diff -c -r1.10 nto-tdep.c *** nto-tdep.c 10 Dec 2004 13:38:23 -0000 1.10 --- nto-tdep.c 21 Dec 2004 23:18:38 -0000 *************** *** 66,72 **** } void ! nto_set_target(struct nto_target_ops *targ) { nto_regset_id = targ->regset_id; nto_supply_gregset = targ->supply_gregset; --- 66,72 ---- } void ! nto_set_target (struct nto_target_ops *targ) { nto_regset_id = targ->regset_id; nto_supply_gregset = targ->supply_gregset; *************** *** 345,385 **** nto_elf_osabi_sniffer (bfd *abfd) { if (nto_is_nto_target) ! return nto_is_nto_target (abfd); return GDB_OSABI_UNKNOWN; } - static void - fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, - int which, CORE_ADDR reg_addr) - { - nto_regset_t regset; - - /* See corelow.c:get_core_registers for values of WHICH. */ - if (which == 0) - { - memcpy ((char *) ®set, core_reg_sect, - min (core_reg_size, sizeof (regset))); - nto_supply_gregset ((char *) ®set); - } - else if (which == 2) - { - memcpy ((char *) ®set, core_reg_sect, - min (core_reg_size, sizeof (regset))); - nto_supply_fpregset ((char *) ®set); - } - } - - /* Register that we are able to handle ELF file formats using standard - procfs "regset" structures. */ - static struct core_fns regset_core_fns = { - bfd_target_elf_flavour, /* core_flavour */ - default_check_format, /* check_format */ - default_core_sniffer, /* core_sniffer */ - fetch_core_registers, /* core_read_registers */ - NULL /* next */ - }; - void nto_initialize_signals (void) { --- 345,354 ---- nto_elf_osabi_sniffer (bfd *abfd) { if (nto_is_nto_target) ! return nto_is_nto_target (abfd); return GDB_OSABI_UNKNOWN; } void nto_initialize_signals (void) { *************** *** 414,419 **** displayed. Different information is displayed\n\ for different positive values.", "\ QNX NTO internal debugging is %s.", NULL, NULL, &setdebuglist, &showdebuglist); - /* Register core file support. */ - deprecated_add_core_fns (®set_core_fns); } --- 383,386 ---- --------------060601040303050603000901--