summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJonathan Earl Brassow <jbrassow@redhat.com>2011-09-28 16:32:22 +0000
committerJonathan Earl Brassow <jbrassow@redhat.com>2011-09-28 16:32:22 +0000
commit9aedb1431fc27dd4044fb7048823fb154202c200 (patch)
treec0f09838db42da8310d8e180e0694fb923d13475 /scripts
parent10d0d9c7c468abf1144586bf50a118eb94d0c7b6 (diff)
downloadlvm2-9aedb1431fc27dd4044fb7048823fb154202c200.tar.gz
lvm2-9aedb1431fc27dd4044fb7048823fb154202c200.tar.xz
lvm2-9aedb1431fc27dd4044fb7048823fb154202c200.zip
New handy gdb debugging function, "dm_list_size"
Example: (gdb) dm_list_size &split_images 1 list items
Diffstat (limited to 'scripts')
-rw-r--r--scripts/gdbinit23
1 files changed, 21 insertions, 2 deletions
diff --git a/scripts/gdbinit b/scripts/gdbinit
index 0088017b..e7c26cb8 100644
--- a/scripts/gdbinit
+++ b/scripts/gdbinit
@@ -16,6 +16,7 @@
printf "\n\n"
printf "Loading commands:\n"
+printf " - dm_list_size <list ptr>\n"
printf " - first_seg <LV ptr>\n"
printf " - lv_status <LV ptr>\n"
printf " - lv_status_r <LV ptr>\n"
@@ -27,8 +28,8 @@ printf " - \n"
printf "Use 'help <command>' 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 @@ set follow-fork-mode child
# 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 <list ptr>
+end
#
# __first_seg <return> <LV>