PERFORCE change 105001 for review
Marcel Moolenaar
marcel at FreeBSD.org
Thu Aug 24 23:36:20 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=105001
Change 105001 by marcel at marcel_nfs on 2006/08/24 23:35:25
Resolve merge conflict.
Affected files ...
.. //depot/projects/gdb/gnu/usr.bin/gdb/kgdb/trgt_powerpc.c#3 edit
Differences ...
==== //depot/projects/gdb/gnu/usr.bin/gdb/kgdb/trgt_powerpc.c#3 (text+ko) ====
@@ -1,5 +1,5 @@
-/*
- * Copyright (c) 2006 Peter Grehan
+/*-
+ * Copyright (c) 2006 Marcel Moolenaar
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -12,10 +12,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: src/gnu/usr.bin/gdb/kgdb/trgt_powerpc.c,v 1.1 2006/08/24 21:53:49 marcel Exp $");
#include <sys/types.h>
#include <machine/pcb.h>
@@ -40,7 +40,7 @@
#include <inferior.h>
#include <regcache.h>
#include <frame-unwind.h>
-#include <i386-tdep.h>
+#include <ppc-tdep.h>
#include "kgdb.h"
@@ -84,43 +84,21 @@
}
struct kgdb_frame_cache {
- int intrframe;
CORE_ADDR pc;
CORE_ADDR sp;
};
-static int kgdb_trgt_frame_offset[15] = {
- offsetof(struct trapframe, tf_eax),
- offsetof(struct trapframe, tf_ecx),
- offsetof(struct trapframe, tf_edx),
- offsetof(struct trapframe, tf_ebx),
- offsetof(struct trapframe, tf_esp),
- offsetof(struct trapframe, tf_ebp),
- offsetof(struct trapframe, tf_esi),
- offsetof(struct trapframe, tf_edi),
- offsetof(struct trapframe, tf_eip),
- offsetof(struct trapframe, tf_eflags),
- offsetof(struct trapframe, tf_cs),
- offsetof(struct trapframe, tf_ss),
- offsetof(struct trapframe, tf_ds),
- offsetof(struct trapframe, tf_es),
- offsetof(struct trapframe, tf_fs)
-};
-
static struct kgdb_frame_cache *
kgdb_trgt_frame_cache(struct frame_info *next_frame, void **this_cache)
{
char buf[MAX_REGISTER_SIZE];
struct kgdb_frame_cache *cache;
- char *pname;
cache = *this_cache;
if (cache == NULL) {
cache = FRAME_OBSTACK_ZALLOC(struct kgdb_frame_cache);
*this_cache = cache;
cache->pc = frame_func_unwind(next_frame);
- find_pc_partial_function(cache->pc, &pname, NULL, NULL);
- cache->intrframe = (pname[0] == 'X') ? 1 : 0;
frame_unwind_register(next_frame, SP_REGNUM, buf);
cache->sp = extract_unsigned_integer(buf,
register_size(current_gdbarch, SP_REGNUM));
@@ -144,9 +122,11 @@
CORE_ADDR *addrp, int *realnump, void *valuep)
{
char dummy_valuep[MAX_REGISTER_SIZE];
+ struct gdbarch_tdep *tdep;
struct kgdb_frame_cache *cache;
int ofs, regsz;
+ tdep = gdbarch_tdep(current_gdbarch);
regsz = register_size(current_gdbarch, regnum);
if (valuep == NULL)
@@ -157,13 +137,25 @@
*lvalp = not_lval;
*realnump = -1;
- ofs = (regnum >= I386_EAX_REGNUM && regnum <= I386_FS_REGNUM)
- ? kgdb_trgt_frame_offset[regnum] : -1;
- if (ofs == -1)
+ if (regnum >= tdep->ppc_gp0_regnum &&
+ regnum <= tdep->ppc_gplast_regnum)
+ ofs = offsetof(struct trapframe,
+ fixreg[regnum - tdep->ppc_gp0_regnum]);
+ else if (regnum == tdep->ppc_lr_regnum)
+ ofs = offsetof(struct trapframe, lr);
+ else if (regnum == tdep->ppc_cr_regnum)
+ ofs = offsetof(struct trapframe, cr);
+ else if (regnum == tdep->ppc_xer_regnum)
+ ofs = offsetof(struct trapframe, xer);
+ else if (regnum == tdep->ppc_ctr_regnum)
+ ofs = offsetof(struct trapframe, ctr);
+ else if (regnum == PC_REGNUM)
+ ofs = offsetof(struct trapframe, srr0);
+ else
return;
cache = kgdb_trgt_frame_cache(next_frame, this_cache);
- *addrp = cache->sp + ofs + (cache->intrframe ? 4 : 0);
+ *addrp = cache->sp + 8 + ofs;
*lvalp = lval_memory;
target_read_memory(*addrp, valuep, regsz);
}
@@ -185,8 +177,8 @@
find_pc_partial_function(pc, &pname, NULL, NULL);
if (pname == NULL)
return (NULL);
- if (strcmp(pname, "calltrap") == 0 ||
- (pname[0] == 'X' && pname[1] != '_'))
+ if (strcmp(pname, "asttrapexit") == 0 ||
+ strcmp(pname, "trapexit") == 0)
return (&kgdb_trgt_trapframe_unwind);
/* printf("%s: %llx =%s\n", __func__, pc, pname); */
return (NULL);
More information about the p4-projects
mailing list