From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29897 invoked by alias); 28 Sep 2011 16:32:25 -0000 Received: (qmail 29880 invoked by uid 9478); 28 Sep 2011 16:32:23 -0000 Date: Wed, 28 Sep 2011 16:32:00 -0000 Message-ID: <20110928163223.29878.qmail@sourceware.org> From: jbrassow@sourceware.org To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org Subject: LVM2/scripts gdbinit Mailing-List: contact lvm2-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: lvm2-cvs-owner@sourceware.org X-SW-Source: 2011-09/txt/msg00145.txt.bz2 CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: jbrassow@sourceware.org 2011-09-28 16:32:22 Modified files: scripts : gdbinit Log message: New handy gdb debugging function, "dm_list_size" Example: (gdb) dm_list_size &split_images 1 list items Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/scripts/gdbinit.diff?cvsroot=lvm2&r1=1.10&r2=1.11 --- LVM2/scripts/gdbinit 2011/09/13 13:57:02 1.10 +++ LVM2/scripts/gdbinit 2011/09/28 16:32:22 1.11 @@ -16,6 +16,7 @@ printf "\n\n" printf "Loading commands:\n" +printf " - dm_list_size \n" printf " - first_seg \n" printf " - lv_status \n" printf " - lv_status_r \n" @@ -27,8 +28,8 @@ printf "Use 'help ' for more info\n" printf "\n\n" printf "Popular breakpoints:\n" -printf "break _raid_add_images\n" -printf "run --type raid1 -m 1 vg/lv\n" +printf "break _get_udev_flags\n" +printf "run --splitmirrors 1 -n split vg/lv\n" printf "\n\n" set follow-fork-mode child @@ -40,6 +41,24 @@ # External functions should have a corresponding 'document' # section. Internal functions should have leading comments +define dm_list_size + set $_DLS_list_head = (struct dm_list *)$arg0 + set $_DLS_list = $_DLS_list_head->n + set $_DLS_size = 0 + + while (($_DLS_list != $_DLS_list_head) && ($_DLS_size < 100)) + set $_DLS_list = $_DLS_list->n + set $_DLS_size++ + end + + printf "%d list items\n", $_DLS_size +end + +document dm_list_size +Returns the number of elements in the dm_list + + Usage: dm_list_size +end # # __first_seg