Date: Tue, 13 Jun 2006 16:27:22 GMT From: Olivier Houchard <cognet@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 99143 for review Message-ID: <200606131627.k5DGRMbh050645@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=99143 Change 99143 by cognet@cognet on 2006/06/13 16:26:29 Dirty hack to handle the special case of trapframe unwinding when the trap was an undefined instruction (has it happens on a breakpoint). Affected files ... .. //depot/projects/arm/gnu-arm.diff#11 edit Differences ... ==== //depot/projects/arm/gnu-arm.diff#11 (text+ko) ==== @@ -1,11 +1,11 @@ Index: gnu/lib/libgcc/Makefile =================================================================== RCS file: /cognet/ncvs/src/gnu/lib/libgcc/Makefile,v -retrieving revision 1.54 -diff -u -p -r1.54 Makefile ---- gnu/lib/libgcc/Makefile 21 Dec 2004 09:33:45 -0000 1.54 -+++ gnu/lib/libgcc/Makefile 29 Aug 2005 12:39:27 -0000 -@@ -97,8 +97,11 @@ LIB2FUNCS_EXTRA = qrnnd.asm +retrieving revision 1.55 +diff -u -p -r1.55 Makefile +--- gnu/lib/libgcc/Makefile 18 Mar 2006 21:37:03 -0000 1.55 ++++ gnu/lib/libgcc/Makefile 19 Mar 2006 21:13:20 -0000 +@@ -98,8 +98,11 @@ LIB2FUNCS_EXTRA = qrnnd.asm # from config/arm/t-strongarm-elf CFLAGS+= -Dinhibit_libc -fno-inline LIB1ASMSRC = lib1funcs.asm @@ -19,7 +19,7 @@ # We want fine grained libraries, so use the new code to build the # floating point emulation libraries. XXX fix this: NEED_FP_EMULATION set to "yes" with different rules per platform -@@ -168,7 +171,7 @@ ASM_S= ${LIB1ASMFUNCS:S/$/.So/} +@@ -169,7 +172,7 @@ ASM_S= ${LIB1ASMFUNCS:S/$/.So/} SYMS= ${LIB2FUNCS} \ ${LIB2_DIVMOD_FUNCS} @@ -96,7 +96,7 @@ RCS file: gnu/usr.bin/binutils/libbfd/Makefile.arm diff -N gnu/usr.bin/binutils/libbfd/Makefile.arm --- /dev/null 1 Jan 1970 00:00:00 -0000 -+++ gnu/usr.bin/binutils/libbfd/Makefile.arm 29 Aug 2005 12:39:27 -0000 ++++ gnu/usr.bin/binutils/libbfd/Makefile.arm 20 May 2006 22:58:30 -0000 @@ -0,0 +1,24 @@ +# $FreeBSD$ + @@ -136,11 +136,11 @@ Index: gnu/usr.bin/cc/cc_tools/Makefile =================================================================== RCS file: /cognet/ncvs/src/gnu/usr.bin/cc/cc_tools/Makefile,v -retrieving revision 1.81 -diff -u -p -r1.81 Makefile ---- gnu/usr.bin/cc/cc_tools/Makefile 3 Jun 2005 04:21:04 -0000 1.81 -+++ gnu/usr.bin/cc/cc_tools/Makefile 29 Aug 2005 12:39:27 -0000 -@@ -214,7 +214,9 @@ CLEANFILES+= fini +retrieving revision 1.82 +diff -u -p -r1.82 Makefile +--- gnu/usr.bin/cc/cc_tools/Makefile 17 Mar 2006 18:54:23 -0000 1.82 ++++ gnu/usr.bin/cc/cc_tools/Makefile 19 Mar 2006 21:13:24 -0000 +@@ -216,7 +216,9 @@ CLEANFILES+= fini .if ${TARGET_ARCH} == "amd64" TARGET_INC= i386/biarch64.h .endif @@ -150,7 +150,7 @@ .if ${TARGET_ARCH} == "i386" || ${TARGET_ARCH} == "amd64" TARGET_INC+= ${GCC_CPU}/unix.h TARGET_INC+= ${GCC_CPU}/att.h -@@ -234,6 +236,11 @@ TARGET_INC+= ${GCC_CPU}/elf.h +@@ -236,6 +238,11 @@ TARGET_INC+= ${GCC_CPU}/elf.h TARGET_INC+= ${GCC_CPU}/sysv4.h .endif .endif @@ -999,8 +999,8 @@ RCS file: gnu/usr.bin/gdb/kgdb/trgt_arm.c diff -N gnu/usr.bin/gdb/kgdb/trgt_arm.c --- /dev/null 1 Jan 1970 00:00:00 -0000 -+++ gnu/usr.bin/gdb/kgdb/trgt_arm.c 4 Oct 2005 23:17:12 -0000 -@@ -0,0 +1,196 @@ ++++ gnu/usr.bin/gdb/kgdb/trgt_arm.c 13 Jun 2006 16:26:07 -0000 +@@ -0,0 +1,224 @@ +/* + * Copyright (c) 2004 Marcel Moolenaar + * All rights reserved. @@ -1033,6 +1033,7 @@ +#include <sys/types.h> +#include <machine/pcb.h> +#include <machine/frame.h> ++#include <machine/armreg.h> +#include <err.h> +#include <kvm.h> +#include <string.h> @@ -1133,6 +1134,8 @@ + return (cache); +} + ++static int is_undef; ++ +static void +kgdb_trgt_trapframe_this_id(struct frame_info *next_frame, void **this_cache, + struct frame_id *this_id) @@ -1151,6 +1154,7 @@ + char dummy_valuep[MAX_REGISTER_SIZE]; + struct kgdb_frame_cache *cache; + int ofs, regsz; ++ int is_undefined = 0; + + regsz = register_size(current_gdbarch, regnum); + @@ -1168,9 +1172,24 @@ + return; + + cache = kgdb_trgt_frame_cache(next_frame, this_cache); ++ ++ if (is_undef && (regnum == ARM_SP_REGNUM || regnum == ARM_PC_REGNUM)) { ++ *addrp = cache->sp + offsetof(struct trapframe, tf_spsr); ++ target_read_memory(*addrp, valuep, regsz); ++ is_undefined = 1; ++ ofs = kgdb_trgt_frame_offset[ARM_SP_REGNUM]; ++ ++ } + *addrp = cache->sp + ofs; + *lvalp = lval_memory; + target_read_memory(*addrp, valuep, regsz); ++ ++ if (is_undefined) { ++ *addrp = *(unsigned int *)valuep + (regnum == ARM_SP_REGNUM ? ++ 0 : 8); ++ target_read_memory(*addrp, valuep, regsz); ++ ++ } +} + +static const struct frame_unwind kgdb_trgt_trapframe_unwind = { @@ -1188,12 +1207,21 @@ + pc = frame_pc_unwind(next_frame); + pname = NULL; + find_pc_partial_function(pc, &pname, NULL, NULL); -+ if (pname == NULL) ++ if (pname == NULL) { ++ is_undef = 0; + return (NULL); ++ } ++ if (!strcmp(pname, "undefinedinstruction")) ++ is_undef = 1; + if (strcmp(pname, "Laddress_exception_entry") == 0 || + strcmp(pname, "undefined_entry") == 0 || + strcmp(pname, "exception_exit") == 0 || ++ strcmp(pname, "Laddress_exception_msg") == 0 || + strcmp(pname, "irq_entry") == 0) + return (&kgdb_trgt_trapframe_unwind); ++ if (!strcmp(pname, "undefinedinstruction")) ++ is_undef = 1; ++ else ++ is_undef = 0; + return (NULL); +}
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606131627.k5DGRMbh050645>