From: Kris Warkentin <kewarken@qnx.com>
To: Mark Kettenis <kettenis@gnu.org>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [COMMIT] Remove deprecated core support from QNX
Date: Thu, 06 Jan 2005 18:18:00 -0000 [thread overview]
Message-ID: <41DD8028.6080104@qnx.com> (raw)
In-Reply-To: <200412241446.iBOEk4X1012019@juw15.nfra.nl>
Sorry about the late reply Mark, I was away for a bit over the
holidays. Thanks for committing that all in. Works great. Question
though. I noticed that you left off this part:
> /* Register core file support. */
> set_gdbarch_regset_from_core_section
> (gdbarch, i386_regset_from_core_section);
I'm assuming the corefile support now just uses the normal target regset
supply functions?
cheers,
Kris
Mark Kettenis wrote:
>Kris,
>
>I tweaked i386nto_supply_gregset a bit more, but I'm fairly confident
>this will work just as well. Guess you didn't supply the collect
>function since there was no prototype. Would be good if you tested
>this again soon though.
>
>Mark
>
>2004-12-24 Kris Warkentin <kewarken@qnx.com>
> Mark Kettenis <kettenis@gnu.org>
>
> * i386-tdep.h (i386_collect_gregset): New prototype.
> * i386-nto-tdep.c (i386_nto_target): Move variable. Add comment.
> (i386nto_gregset_reg_offset): Rename frame regmap.
> (nto_reg_offset): Tweak comment. Use ARRAY_SIZE.
> (i386nto_supply_gregset): Implement using register set support.
> (i386nto_supply_regset): Remove redundant comment.
> (i386nto_init_abi): Initialize TDEP->gregset_reg_offset,
> TDEP->gregset_num_regs and TDEP->sizeof_gregset.
> * nto-tdep.c (fetch_core_registers): Remove function.
> (regset_core_fns): Remove structure.
> (_initialize_nto_tdep): Don't call deprecated_add_core_fns.
>
>Index: i386-tdep.h
>===================================================================
>RCS file: /cvs/src/src/gdb/i386-tdep.h,v
>retrieving revision 1.41
>diff -u -p -r1.41 i386-tdep.h
>--- i386-tdep.h 8 Sep 2004 14:46:08 -0000 1.41
>+++ i386-tdep.h 24 Dec 2004 14:42:01 -0000
>@@ -166,6 +166,14 @@ extern void i386_supply_gregset (const s
> struct regcache *regcache, int regnum,
> const void *gregs, size_t len);
>
>+/* Collect register REGNUM from the register cache REGCACHE and store
>+ it in the buffer specified by GREGS and LEN as described by the
>+ general-purpose register set REGSET. If REGNUM is -1, do this for
>+ all registers in REGSET. */
>+extern void i386_collect_gregset (const struct regset *regset,
>+ const struct regcache *regcache,
>+ int regnum, void *gregs, size_t len);
>+
> /* Return the appropriate register set for the core section identified
> by SECT_NAME and SECT_SIZE. */
> extern const struct regset *
>Index: i386-nto-tdep.c
>===================================================================
>RCS file: /cvs/src/src/gdb/i386-nto-tdep.c,v
>retrieving revision 1.17
>diff -u -p -r1.17 i386-nto-tdep.c
>--- i386-nto-tdep.c 23 Dec 2004 22:34:23 -0000 1.17
>+++ i386-nto-tdep.c 24 Dec 2004 14:42:01 -0000
>@@ -35,6 +35,9 @@
> #include "nto-tdep.h"
> #include "solib-svr4.h"
>
>+/* Target vector for QNX NTO x86. */
>+static struct nto_target_ops i386_nto_target;
>+
> #ifndef X86_CPU_FXSR
> #define X86_CPU_FXSR (1L << 12)
> #endif
>@@ -44,47 +47,51 @@
> that is just filler. Don't ask me, ask the kernel guys. */
> #define NUM_GPREGS 13
>
>-/* Map a GDB register number to an offset in the reg structure. */
>-static int regmap[] = {
>- (7 * 4), /* eax */
>- (6 * 4), /* ecx */
>- (5 * 4), /* edx */
>- (4 * 4), /* ebx */
>- (11 * 4), /* esp */
>- (2 * 4), /* epb */
>- (1 * 4), /* esi */
>- (0 * 4), /* edi */
>- (8 * 4), /* eip */
>- (10 * 4), /* eflags */
>- (9 * 4), /* cs */
>- (12 * 4), /* ss */
>- (-1 * 4) /* filler */
>+/* Mapping between the general-purpose registers in `struct xxx'
>+ format and GDB's register cache layout. */
>+
>+/* From <x86/context.h>. */
>+static int i386nto_gregset_reg_offset[] =
>+{
>+ 7 * 4, /* %eax */
>+ 6 * 4, /* %ecx */
>+ 5 * 4, /* %edx */
>+ 4 * 4, /* %ebx */
>+ 11 * 4, /* %esp */
>+ 2 * 4, /* %epb */
>+ 1 * 4, /* %esi */
>+ 0 * 4, /* %edi */
>+ 8 * 4, /* %eip */
>+ 10 * 4, /* %eflags */
>+ 9 * 4, /* %cs */
>+ 12 * 4, /* %ss */
>+ -1 /* filler */
> };
>
>-static struct nto_target_ops i386_nto_target;
>+/* Given a GDB register number REGNUM, return the offset into
>+ Neutrino's register structure or -1 if the register is unknown. */
>
>-/* Given a gdb regno, return the offset into Neutrino's register structure
>- or -1 if register is unknown. */
> static int
>-nto_reg_offset (int regno)
>+nto_reg_offset (int regnum)
> {
>- return (regno >= 0 && regno < NUM_GPREGS) ? regmap[regno] : -1;
>+ if (regnum >= 0 && regnum < ARRAY_SIZE (i386nto_gregset_reg_offset))
>+ return i386nto_gregset_reg_offset[regnum];
>+
>+ return -1;
> }
>
> static void
> i386nto_supply_gregset (char *gpregs)
> {
>- unsigned regno;
>- int empty = 0;
>+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
>
>- 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);
>- }
>+ if(tdep->gregset == NULL)
>+ tdep->gregset = regset_alloc (current_gdbarch, i386_supply_gregset,
>+ i386_collect_gregset);
>+
>+ gdb_assert (tdep->gregset_reg_offset == i386nto_gregset_reg_offset);
>+ tdep->gregset->supply_regset (tdep->gregset, current_regcache, -1,
>+ gpregs, NUM_GPREGS * 4);
> }
>
> static void
>@@ -101,7 +108,7 @@ i386nto_supply_regset (int regset, char
> {
> switch (regset)
> {
>- case NTO_REG_GENERAL: /* QNX has different ordering of GP regs than GDB. */
>+ case NTO_REG_GENERAL:
> i386nto_supply_gregset (data);
> break;
> case NTO_REG_FLOAT:
>@@ -258,6 +265,10 @@ i386nto_init_abi (struct gdbarch_info in
> /* NTO has shared libraries. */
> set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
>
>+ tdep->gregset_reg_offset = i386nto_gregset_reg_offset;
>+ tdep->gregset_num_regs = ARRAY_SIZE (i386nto_gregset_reg_offset);
>+ tdep->sizeof_gregset = NUM_GPREGS * 4;
>+
> tdep->sigtramp_p = i386nto_sigtramp_p;
> tdep->sigcontext_addr = i386nto_sigcontext_addr;
> tdep->sc_pc_offset = 56;
>Index: nto-tdep.c
>===================================================================
>RCS file: /cvs/src/src/gdb/nto-tdep.c,v
>retrieving revision 1.10
>diff -u -p -r1.10 nto-tdep.c
>--- nto-tdep.c 10 Dec 2004 13:38:23 -0000 1.10
>+++ nto-tdep.c 24 Dec 2004 14:42:01 -0000
>@@ -66,7 +66,7 @@ nto_target (void)
> }
>
> void
>-nto_set_target(struct nto_target_ops *targ)
>+nto_set_target (struct nto_target_ops *targ)
> {
> nto_regset_id = targ->regset_id;
> nto_supply_gregset = targ->supply_gregset;
>@@ -345,41 +345,10 @@ enum gdb_osabi
> nto_elf_osabi_sniffer (bfd *abfd)
> {
> if (nto_is_nto_target)
>- return nto_is_nto_target (abfd);
>+ 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)
> {
>@@ -414,6 +383,4 @@ When non-zero, nto specific debug info i
> 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);
> }
>
>
next prev parent reply other threads:[~2005-01-06 18:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-24 22:58 Mark Kettenis
2005-01-06 18:18 ` Kris Warkentin [this message]
2005-01-06 21:59 ` Mark Kettenis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=41DD8028.6080104@qnx.com \
--to=kewarken@qnx.com \
--cc=gdb-patches@sources.redhat.com \
--cc=kettenis@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox