]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
DEV: dev/gdb: improve ebtree pointer handling
authorWilly Tarreau <w@1wt.eu>
Wed, 27 May 2026 16:49:27 +0000 (18:49 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 1 Jun 2026 17:08:42 +0000 (19:08 +0200)
The ebtree descent functions currently use $arg0 as is and it's up to
the user to manually type the required casts that are never obvious
(particularly when coming from a pointer). Let's put the eb_root* cast
in the function to be more user-friendly.

dev/gdb/ebtree.gdb

index a6b03e949e0b81ed5649014e0e7db8f544f87d89..56b4ea85297f6da28e5975253d8bb1dc04f9b40e 100644 (file)
@@ -26,7 +26,7 @@ end
 # returns $node filled with the first node of ebroot $arg0
 define ebtree_first
   # browse ebtree left until encountering leaf
-  set $node = (struct eb_node *)$arg0->b[0]
+  set $node = (struct eb_node *)((struct eb_root*)$arg0)->b[0]
   while 1
     _ebtree_set_tag_node $node
     if $tag == 0
@@ -41,7 +41,7 @@ end
 # finds next ebtree node after $arg0, and returns it in $node
 define ebtree_next
   # get parent
-  set $node = (struct eb_root *)$arg0->leaf_p
+  set $node = (struct eb_root *)((struct eb_node *)$arg0)->leaf_p
   # Walking up from right branch, so we cannot be below root
   # while (eb_gettag(t) != EB_LEFT) // #define EB_LEFT 0
   while 1