Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id EF8AC200B7D for ; Fri, 26 Aug 2016 20:57:37 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id EE29D160AB6; Fri, 26 Aug 2016 18:57:37 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 1F263160A94 for ; Fri, 26 Aug 2016 20:57:36 +0200 (CEST) Received: (qmail 70024 invoked by uid 500); 26 Aug 2016 18:57:36 -0000 Mailing-List: contact commits-help@mynewt.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@mynewt.incubator.apache.org Delivered-To: mailing list commits@mynewt.incubator.apache.org Received: (qmail 70015 invoked by uid 99); 26 Aug 2016 18:57:36 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Aug 2016 18:57:36 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id E99411A0B0D for ; Fri, 26 Aug 2016 18:57:35 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -4.646 X-Spam-Level: X-Spam-Status: No, score=-4.646 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-1.426] autolearn=disabled Received: from mx2-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id KbZzLcYuiL-2 for ; Fri, 26 Aug 2016 18:57:34 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx2-lw-eu.apache.org (ASF Mail Server at mx2-lw-eu.apache.org) with SMTP id 1837E5F47A for ; Fri, 26 Aug 2016 18:57:32 +0000 (UTC) Received: (qmail 69975 invoked by uid 99); 26 Aug 2016 18:57:32 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Aug 2016 18:57:32 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 43EE7E0209; Fri, 26 Aug 2016 18:57:32 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ccollins@apache.org To: commits@mynewt.incubator.apache.org Date: Fri, 26 Aug 2016 18:57:32 -0000 Message-Id: <5f82d2131aaa4faaa18ce061e73e5dce@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/2] incubator-mynewt-core git commit: Add gdb macros for nffs archived-at: Fri, 26 Aug 2016 18:57:38 -0000 Repository: incubator-mynewt-core Updated Branches: refs/heads/develop f2d1ba1e0 -> e85de361e Add gdb macros for nffs Add new directory for gdb macros under compiler ("compiler/gdbmacros"). Add gdb macros to display hash table, print stats. Add gdb arduino_zero platform specific macros to dump and clear nffs flash areas Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/5d27c947 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/5d27c947 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/5d27c947 Branch: refs/heads/develop Commit: 5d27c947e10b27a0fa0b9bc18fd36ea7dc22557b Parents: f2d1ba1 Author: Peter Snyder Authored: Fri Aug 26 10:09:30 2016 -0700 Committer: Peter Snyder Committed: Fri Aug 26 10:09:30 2016 -0700 ---------------------------------------------------------------------- compiler/gdbmacros/nffs.gdb | 116 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d27c947/compiler/gdbmacros/nffs.gdb ---------------------------------------------------------------------- diff --git a/compiler/gdbmacros/nffs.gdb b/compiler/gdbmacros/nffs.gdb new file mode 100644 index 0000000..0e76d35 --- /dev/null +++ b/compiler/gdbmacros/nffs.gdb @@ -0,0 +1,116 @@ +# Print the linked list of nffs hash entries starting with the input argument +# (gdb) hash-list +# +define nffs-hash-list + set $next = $arg0 + while $next + p $next + if nffs_hash_id_is_inode($next.nhe_id) + p *(struct nffs_inode_entry*)$next + else + p *$next + end + set $next = $next.nhe_next.sle_next + if $next + echo ---v\n + end + end +end + +# Dump the nffs hash table starting with the first element +# The linked list of hash entries is printed out for each +# element in the hash array +# +define nffs-hash-table + printf "nffs hash table:\n" + set $hashp = nffs_hash->slh_first + set $i = 0 + while $i < 256 + if $hashp + echo Hash table offset\ \ + output/d $i + echo \n + nffs-hash-list $hashp + echo ====\n + end + set $i = $i + 1 + set $hashp = (nffs_hash + $i)->slh_first + end +end + +# print out the nffs pool information +# +define nffs-print-config + printf "nffs_config:\n" + printf "inodes: alloc %d free %d\n", nffs_config.nc_num_inodes, nffs_inode_entry_pool.mp_num_free + printf "blocks: alloc %d free %d\n", nffs_config.nc_num_blocks, nffs_block_entry_pool.mp_num_free + printf "files: alloc %d free %d\n", nffs_config.nc_num_files, nffs_file_pool.mp_num_free + printf "dirs: alloc %d free %d\n", nffs_config.nc_num_dirs, nffs_dir_pool.mp_num_free + printf "cache_inodes: alloc %d free %d\n", nffs_config.nc_num_cache_inodes, nffs_cache_inode_pool.mp_num_free + printf "cache_blocks: alloc %d free %d\n", nffs_config.nc_num_cache_blocks, nffs_cache_block_pool.mp_num_free +end + +# print out the nffs counters +# +define nffs-print-stats + printf "nffs stats:\n" + printf "Objects inserted in hash table %d\n", nffs_stats.snffs_hashcnt_ins + printf "Objects deleted in hash table %d\n", nffs_stats.snffs_hashcnt_rm + printf "Object restored on initialization %d\n", nffs_stats.snffs_object_count + printf "Total count of flash reads %d\n", nffs_stats.snffs_iocnt_read + printf "Total count of flash writes %d\n", nffs_stats.snffs_iocnt_write + printf "Data block reads %d\n", nffs_stats.snffs_readcnt_data + printf "Block struct reads %d\n", nffs_stats.snffs_readcnt_block + printf "Per-object crc reads %d\n", nffs_stats.snffs_readcnt_crc + printf "Copy to/from flash ops %d\n", nffs_stats.snffs_readcnt_copy + printf "Format scratch area ops %d\n", nffs_stats.snffs_readcnt_format + printf "Coalesce block data ops %d\n", nffs_stats.snffs_readcnt_gccollate + printf "Inodes read %d\n", nffs_stats.snffs_readcnt_inode + printf "Inode reads from hash entry %d\n", nffs_stats.snffs_readcnt_inodeent + printf "File renames %d\n", nffs_stats.snffs_readcnt_rename + printf "Inode updates %d\n", nffs_stats.snffs_readcnt_update + printf "Filename reads %d\n", nffs_stats.snffs_readcnt_filename + printf "Flash objects read %d\n", nffs_stats.snffs_readcnt_object + printf "Flash areas read %d\n", nffs_stats.snffs_readcnt_detect +end + +# +# Platform dependent macros below + +# Copy the nffs partition out to a file. +# Addresses are specific to arduino-zero +# +define scratch-dump-arduino0 + dump binary memory $arg0 0x3c000 0x3dc00 +end + +# Copy the nffs partition out to a file. +# Addresses are specific to arduino-zero +# +define nffs-dump-arduino0 + dump binary memory $arg0 0x3e000 0x40000 +end + +# Erase the nffs partition - arduino-zero specific addresses +# +define nffs-clear-arduino0 + monitor flash erase_address 0xc000 0x34000 +end + +# dump the nffs stats and data structures +# Logs the output in the file "gdb.txt" +# Creates the file nffs-dump_tmp.bin in the current directory which can be +# used with ffs2native to print out the contents of the nffs flash areas. +# Use command syntax: "ffs2native -s -f nffs-dump.bin" +# +define nffs-snapshot + set logging on + set pagination off + nffs-print-config + printf "\n" + nffs-print-stats + printf "\n" + nffs-hash-table + set logging off + nffs-dump-arduino0 nffs-dump.bin +end