From owner-freebsd-arm@freebsd.org Wed Dec 2 15:00:21 2015 Return-Path: Delivered-To: freebsd-arm@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A19DFA3FD3C for ; Wed, 2 Dec 2015 15:00:21 +0000 (UTC) (envelope-from zbb@semihalf.com) Received: from mail-lf0-x232.google.com (mail-lf0-x232.google.com [IPv6:2a00:1450:4010:c07::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3D4C71985 for ; Wed, 2 Dec 2015 15:00:21 +0000 (UTC) (envelope-from zbb@semihalf.com) Received: by lfdl133 with SMTP id l133so53768023lfd.2 for ; Wed, 02 Dec 2015 07:00:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=eDnc9Iqs9fL46FTKwn/Wi6bxzL9f2cjmp4OjcV46KFU=; b=ir5HUFks9f0Un8NPS3TvMGRLdeKLJI0nVWYLmUQa0JQ/b4ic9MwiJctyrTg7vurgdw b5zURQZGdWQOfhmHY8pPswV1EvO3+X7uGSQzz3Fp9Sw80YMaM4koQb54vWJ1InTzDQSM zt7lOsxnZcwnL5GWpXBC/Byzdzmas+Woo4F87uQwRKHqi89xyzS37juaDodFqk0lZhyu wAFD4+7GKnew8B5DF4UzVMHNTnPW5avcpE7nASfmeUFII77THDQr72Xksv3HrHpI4GUW 2Qyghz2CSqJTD4Jwre7jpabsE5BkT7mJ/LKaKP8LlkTqtvMlgmGegALYBPIEopWAm0+c UQug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=eDnc9Iqs9fL46FTKwn/Wi6bxzL9f2cjmp4OjcV46KFU=; b=XfeaaysZ1KpT/rV+uMXIpgbGnG/8z4pqeMqA2jnvpn52bB1Vrby+V5jx3Fm/YizxYL smDQg/fvYSyZ4GDr+0KmzRcO8kgJXG+ea/VJwfLpc81PdDarPkPtpJyEviUBOaVBabC2 nCxClAFJp+CfUexkOO+5yMdSL74BNPd2Hav6OYJk9iFCwNa8WCpRHsp0ImFDUHkmrYyk bQt7j8bwlvYTl2wVAPMIpHepMYK6JnyaBdfL8SAGrJpjsmyeDcBf8ojZgNrT/QuhJR4B 7KmPgwMgX072DZOH4bcmcAoWJ6aJqUfwcBgw6wzOlZ6z5DT9FWqAFHGq1lGpOcZMvgVH 4wWw== X-Gm-Message-State: ALoCoQlszQXl0Al0GpyWKic46m2roWZZXWLD3Kaq7WGhaqnp4mtK8Qi8/rembwwdRqCJsRYCw/4F X-Received: by 10.25.23.159 with SMTP id 31mr3155385lfx.44.1449068418965; Wed, 02 Dec 2015 07:00:18 -0800 (PST) MIME-Version: 1.0 Received: by 10.25.76.65 with HTTP; Wed, 2 Dec 2015 06:59:57 -0800 (PST) In-Reply-To: References: From: Zbigniew Bodek Date: Wed, 2 Dec 2015 15:59:57 +0100 Message-ID: Subject: Re: RFC: HW watchpoints and single stepping for ARMv6/v7 To: Russell Haley Cc: "freebsd-arm@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2015 15:00:21 -0000 BTW. You may also want to check out this patch: https://reviews.freebsd.org/D4338 with SMP support for HW watchpoints on ARMv6/v7 Best regards zbb 2015-12-02 13:18 GMT+01:00 Zbigniew Bodek : > Hello Russel, > > I think you are doing something wrong since I've just downloaded the > latest patch from Phabricator, applied it on r291486 and built for > IMX6 successfully (with and without DDB option). > Did you use the latest patch? > > Best regards > zbb > > 2015-12-02 8:19 GMT+01:00 Russell Haley : >> Okay, so I wasn't too successfull: >> >> What I did: >> - update to latest revision (291642) >> - I couldn't get installworld to complete (separate email). Instead, I >> downloaded the current image for the hummingboard and mounted the image and >> was preparing to run installkernel >> - I ran buildkernel to success >> - I applied the patch. It applied successfully >> - I ran buildkernel again and got the following error: >> >> cc -c -O -pipe -g -nostdinc -I. -I/usr/src/sys >> -I/usr/src/sys/contrib/libfdt -I/usr/src/sys/gnu/dts/include -D_KERNEL >> -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -march=armv7a >> -funwind-tables -ffreestanding -fwrapv -gdwarf-2 -Wall -Wredundant-decls >> -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith >> -Winline -Wcast-qual -Wundef -Wno-pointer-sign >> -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs >> -fdiagnostics-show-option -Wno-unknown-pragmas >> -Wno-error-tautological-compare -Wno-error-empty-body >> -Wno-error-parentheses-equality -Wno-error-unused-function >> -Wno-error-pointer-sign -Wno-error-shift-negative-value -mfpu=none >> -std=iso9899:1999 -Werror /usr/src/sys/arm/arm/db_trace.c >> /usr/src/sys/arm/arm/db_trace.c:135:2: error: implicit declaration of >> function 'dbg_show_watchpoint' is invalid in C99 >> [-Werror,-Wimplicit-function-declaration] >> dbg_show_watchpoint(); >> ^ >> /usr/src/sys/arm/arm/db_trace.c:135:2: note: did you mean >> 'db_set_watchpoints'? >> /usr/src/sys/ddb/ddb.h:216:7: note: 'db_set_watchpoints' declared here >> void db_set_watchpoints(void); >> ^ >> /usr/src/sys/arm/arm/db_trace.c:142:10: error: implicit declaration of >> function 'dbg_remove_watchpoint' is invalid in C99 >> [-Werror,-Wimplicit-function-declaration] >> return (dbg_remove_watchpoint(addr, size)); >> ^ >> /usr/src/sys/arm/arm/db_trace.c:142:10: note: did you mean >> 'dbg_show_watchpoint'? >> /usr/src/sys/arm/arm/db_trace.c:135:2: note: 'dbg_show_watchpoint' declared >> here >> dbg_show_watchpoint(); >> ^ >> /usr/src/sys/arm/arm/db_trace.c:149:10: error: implicit declaration of >> function 'dbg_setup_watchpoint' is invalid in C99 >> [-Werror,-Wimplicit-function-declaration] >> return (dbg_setup_watchpoint(addr, size, HW_WATCHPOINT_RW)); >> ^ >> /usr/src/sys/arm/arm/db_trace.c:149:43: error: use of undeclared identifier >> 'HW_WATCHPOINT_RW' >> return (dbg_setup_watchpoint(addr, size, HW_WATCHPOINT_RW)); >> ^ >> 4 errors generated. >> *** Error code 1 >> >> Stop. >> make[2]: stopped in /usr/obj/arm.armv6/usr/src/sys/IMX6 >> *** Error code 1 >> >> Stop. >> make[1]: stopped in /usr/src >> *** Error code 1 >> >> Stop. >> make: stopped in /usr/src >> ---------------------------------------------- >> >> I ran buildkernel in various configurations (with and without -DNO_CLEAN, >> with and without -j10) and received variations on the same error. The last >> one I tried was without NO_CLEAN and single threaded: >> >> >> ctfconvert -L VERSION -g cpufunc_asm.o >> cc -c -x assembler-with-cpp -DLOCORE -O -pipe -g -nostdinc -I. >> -I/usr/src/sys -I/usr/src/sys/contrib/libfdt -I/usr/src/sys/gnu/dts/include >> -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -march=armv7a >> -funwind-tables -ffreestanding -fwrapv -gdwarf-2 -Wall -Wredundant-decls >> -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith >> -Winline -Wcast-qual -Wundef -Wno-pointer-sign >> -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs >> -fdiagnostics-show-option -Wno-unknown-pragmas >> -Wno-error-tautological-compare -Wno-error-empty-body >> -Wno-error-parentheses-equality -Wno-error-unused-function >> -Wno-error-pointer-sign -Wno-error-shift-negative-value -mfpu=none >> -std=iso9899:1999 -Werror /usr/src/sys/arm/arm/cpufunc_asm_armv7.S >> ctfconvert -L VERSION -g cpufunc_asm_armv7.o >> cc -c -O -pipe -g -nostdinc -I. -I/usr/src/sys >> -I/usr/src/sys/contrib/libfdt -I/usr/src/sys/gnu/dts/include -D_KERNEL >> -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -march=armv7a >> -funwind-tables -ffreestanding -fwrapv -gdwarf-2 -Wall -Wredundant-decls >> -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith >> -Winline -Wcast-qual -Wundef -Wno-pointer-sign >> -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs >> -fdiagnostics-show-option -Wno-unknown-pragmas >> -Wno-error-tautological-compare -Wno-error-empty-body >> -Wno-error-parentheses-equality -Wno-error-unused-function >> -Wno-error-pointer-sign -Wno-error-shift-negative-value -mfpu=none >> -std=iso9899:1999 -Werror /usr/src/sys/arm/arm/cpuinfo.c >> ctfconvert -L VERSION -g cpuinfo.o >> cc -c -x assembler-with-cpp -DLOCORE -O -pipe -g -nostdinc -I. >> -I/usr/src/sys -I/usr/src/sys/contrib/libfdt -I/usr/src/sys/gnu/dts/include >> -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -march=armv7a >> -funwind-tables -ffreestanding -fwrapv -gdwarf-2 -Wall -Wredundant-decls >> -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith >> -Winline -Wcast-qual -Wundef -Wno-pointer-sign >> -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs >> -fdiagnostics-show-option -Wno-unknown-pragmas >> -Wno-error-tautological-compare -Wno-error-empty-body >> -Wno-error-parentheses-equality -Wno-error-unused-function >> -Wno-error-pointer-sign -Wno-error-shift-negative-value -mfpu=none >> -std=iso9899:1999 -Werror /usr/src/sys/arm/arm/cpu_asm-v6.S >> ctfconvert -L VERSION -g cpu_asm-v6.o >> cc -c -O -pipe -g -nostdinc -I. -I/usr/src/sys >> -I/usr/src/sys/contrib/libfdt -I/usr/src/sys/gnu/dts/include -D_KERNEL >> -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -march=armv7a >> -funwind-tables -ffreestanding -fwrapv -gdwarf-2 -Wall -Wredundant-decls >> -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith >> -Winline -Wcast-qual -Wundef -Wno-pointer-sign >> -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs >> -fdiagnostics-show-option -Wno-unknown-pragmas >> -Wno-error-tautological-compare -Wno-error-empty-body >> -Wno-error-parentheses-equality -Wno-error-unused-function >> -Wno-error-pointer-sign -Wno-error-shift-negative-value -mfpu=none >> -std=iso9899:1999 -Werror /usr/src/sys/arm/arm/db_disasm.c >> ctfconvert -L VERSION -g db_disasm.o >> cc -c -O -pipe -g -nostdinc -I. -I/usr/src/sys >> -I/usr/src/sys/contrib/libfdt -I/usr/src/sys/gnu/dts/include -D_KERNEL >> -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -march=armv7a >> -funwind-tables -ffreestanding -fwrapv -gdwarf-2 -Wall -Wredundant-decls >> -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith >> -Winline -Wcast-qual -Wundef -Wno-pointer-sign >> -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs >> -fdiagnostics-show-option -Wno-unknown-pragmas >> -Wno-error-tautological-compare -Wno-error-empty-body >> -Wno-error-parentheses-equality -Wno-error-unused-function >> -Wno-error-pointer-sign -Wno-error-shift-negative-value -mfpu=none >> -std=iso9899:1999 -Werror /usr/src/sys/arm/arm/db_interface.c >> ctfconvert -L VERSION -g db_interface.o >> cc -c -O -pipe -g -nostdinc -I. -I/usr/src/sys >> -I/usr/src/sys/contrib/libfdt -I/usr/src/sys/gnu/dts/include -D_KERNEL >> -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -march=armv7a >> -funwind-tables -ffreestanding -fwrapv -gdwarf-2 -Wall -Wredundant-decls >> -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith >> -Winline -Wcast-qual -Wundef -Wno-pointer-sign >> -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs >> -fdiagnostics-show-option -Wno-unknown-pragmas >> -Wno-error-tautological-compare -Wno-error-empty-body >> -Wno-error-parentheses-equality -Wno-error-unused-function >> -Wno-error-pointer-sign -Wno-error-shift-negative-value -mfpu=none >> -std=iso9899:1999 -Werror /usr/src/sys/arm/arm/db_trace.c >> /usr/src/sys/arm/arm/db_trace.c:135:2: error: implicit declaration of >> function 'dbg_show_watchpoint' is invalid in C99 >> [-Werror,-Wimplicit-function-declaration] >> dbg_show_watchpoint(); >> ^ >> /usr/src/sys/arm/arm/db_trace.c:135:2: note: did you mean >> 'db_set_watchpoints'? >> /usr/src/sys/ddb/ddb.h:216:7: note: 'db_set_watchpoints' declared here >> void db_set_watchpoints(void); >> ^ >> /usr/src/sys/arm/arm/db_trace.c:142:10: error: implicit declaration of >> function 'dbg_remove_watchpoint' is invalid in C99 >> [-Werror,-Wimplicit-function-declaration] >> return (dbg_remove_watchpoint(addr, size)); >> ^ >> /usr/src/sys/arm/arm/db_trace.c:142:10: note: did you mean >> 'dbg_show_watchpoint'? >> /usr/src/sys/arm/arm/db_trace.c:135:2: note: 'dbg_show_watchpoint' declared >> here >> dbg_show_watchpoint(); >> ^ >> /usr/src/sys/arm/arm/db_trace.c:149:10: error: implicit declaration of >> function 'dbg_setup_watchpoint' is invalid in C99 >> [-Werror,-Wimplicit-function-declaration] >> return (dbg_setup_watchpoint(addr, size, HW_WATCHPOINT_RW)); >> ^ >> /usr/src/sys/arm/arm/db_trace.c:149:43: error: use of undeclared identifier >> 'HW_WATCHPOINT_RW' >> return (dbg_setup_watchpoint(addr, size, HW_WATCHPOINT_RW)); >> ^ >> 4 errors generated. >> *** Error code 1 >> >> Stop. >> make[2]: stopped in /usr/obj/arm.armv6/usr/src/sys/IMX6 >> *** Error code 1 >> >> Stop. >> make[1]: stopped in /usr/src >> *** Error code 1 >> >> Stop. >> make: stopped in /usr/src >> >> >> So if it's NOT an undeclared identifier, then let me know what I've done >> wrong. >> >> Cheers, >> Russ >> >> >> On Tue, Dec 1, 2015 at 3:28 AM, Zbigniew Bodek wrote: >>> >>> Hello Russell, >>> >>> That will be a good sign if it doesn't explode (if you see undefined >>> instruction on boot then there's something wrong). >>> More extended description what you can do with HW watchpoints is in >>> this thread. For example you can check: >>> https://lists.freebsd.org/pipermail/freebsd-arm/2015-November/012724.html >>> >>> Best regards >>> zbb >>> >>> 2015-11-30 19:03 GMT+01:00 Russell Haley : >>> > Cool. I have a hummingboard (iMX6). Do I need to know what I'm looking >>> > for >>> > or am I just making sure it doesn't explode? >>> > >>> > Russ >>> > >>> > On Mon, Nov 30, 2015 at 6:41 AM, Zbigniew Bodek >>> > wrote: >>> >> >>> >> Hello again, >>> >> >>> >> It seems that this is the last chance to test this patch on other >>> >> platforms than Rpi, Arndale and Pandaboard. >>> >> Please check out this https://reviews.freebsd.org/D4037 >>> >> I will be grateful if you had a chance to test this on something else >>> >> than the above mentioned. >>> >> >>> >> Best regards >>> >> zbb >>> >> >>> >> 2015-10-31 17:21 GMT+01:00 Zbigniew Bodek : >>> >> > Hello again, >>> >> > >>> >> > I should have post some more information about testing this patch. >>> >> > Here >>> >> > it goes: >>> >> > ------------------------------------------------------------------ >>> >> > One can enter kernel debugger by one of those: >>> >> > >>> >> > press: ~, ctrl + b >>> >> > or >>> >> > type: sysctl -w debug.kdb.enter=1 >>> >> > >>> >> > You can then set a HW watchpoint on any memory location at
>>> >> > by invoking following command in KDB: >>> >> > db> hwatch
, >>> >> > >>> >> > parameter is optional, the default is 4. >>> >> > >>> >> > To display watchpoints: >>> >> > db> show watch >>> >> > >>> >> > To remove watchpoint: >>> >> > db> dhwatch
>>> >> > >>> >> > Press "c" to continue. >>> >> > >>> >> > ------------------------------------------------------------------ >>> >> > While in KDB you can step through the kernel code using "s" BUT you >>> >> > need to apply a dependent patch: https://reviews.freebsd.org/D4036 >>> >> > otherwise you will cause the kernel panic. >>> >> > >>> >> > Thanks again >>> >> > zbb >>> >> > >>> >> > 2015-10-30 17:25 GMT+01:00 Zbigniew Bodek : >>> >> >> Hello, >>> >> >> >>> >> >> We would like to add HW watchpoints and HW single step support to >>> >> >> ARMv6 >>> >> >> kernel. >>> >> >> Please check this review: https://reviews.freebsd.org/D4037 >>> >> >> >>> >> >> Since there are differences between debug architectures on ARM (v6, >>> >> >> v6.1, v7, v7.1) I would like to ask for some testing on your >>> >> >> machines. >>> >> >> I was able to test this on Pandaboard and Arndale but please check >>> >> >> whether this works on your targets as well. >>> >> >> >>> >> >> Rise a red flag if you see any issues or in worst case scenario - >>> >> >> "undefined instruction" error. >>> >> >> >>> >> >> Best regards >>> >> >> zbb >>> >> _______________________________________________ >>> >> freebsd-arm@freebsd.org mailing list >>> >> https://lists.freebsd.org/mailman/listinfo/freebsd-arm >>> >> To unsubscribe, send any mail to "freebsd-arm-unsubscribe@freebsd.org" >>> > >>> > >> >>