Dumping expo contents

Expo is U-Boot’s forms and UI subsystem. It supports text, images and menus and a large expo can contain quite a bit of information. How do you debug and understand that? Tracing through large, linked data structures is not fun.
U-Boot Concept now has an expo_dump() function, designed to be called from your code when you are trying to figure out what is happening. It writes a dump of the expo to an abuf, something like the following:
Expo: name 'my menus'
display lcd
cons lcd.vidconsole_tt
mouse (none)
scene_id 0
next_id 46
req_width 0
req_height 0
text_mode 0
popup 0
show_highlight 0
mouse_enabled 0
mouse_ptr 0000000000000000
mouse_size 0x0
mouse_pos (0,0)
damage (0,0)-(0,0)
done 0
save 0
last_key_ms 4526828813
video: 1366x768 white_on_black 0
Theme:
font_size 0
white_on_black 0
menu_inset 0
menuitem_gap_y 0
Scenes:
Scene 7: name 'main'
title_id 0 ((none))
highlight_id 0 ((none))
Object 9 (logo): type image
flags dirty
bbox: (50,20)-(210,180)
dims: 160x160
Image: data ff000000
Object 10 (text): type text
flags dirty
bbox: (400,100)-(526,140)
dims: 126x40
Text: str_id 20 font_name 'cantoraone_regular' font_size 40
str 'my string'
Object 11 (text): type text
flags dirty
bbox: (200,600)-(496,660)
dims: 296x60
Text: str_id 21 font_name 'nimbus_sans_l_regular' font_size 60
str 'another string'
Object 12 (text): type text
flags size_valid, dirty
bbox: (500,200)-(1000,350)
dims: 477x240
Text: str_id 22 font_name 'nimbus_sans_l_regular' font_size 60
str 'this is yet
another string, with word-wrap and it goes on for quite a while'
Object 13 (main): type menu
flags size_valid, dirty
bbox: (50,400)-(210,560)
dims: 160x160
Menu: pointer_id 45 title_id 14 manual 0
Item 35: name 'item1' label_id 36 desc_id 37
Item 40: name 'item2' label_id 41 desc_id 42
Object 14 (title): type text
flags dirty
bbox: (50,400)-(122,418)
dims: 72x18
Text: str_id 24 font_name '(default)' font_size 0
str 'Main Menu'
Object 45 (cur_item): type text
flags dirty
bbox: (147,436)-(156,454)
dims: 9x18
Text: str_id 25 font_name '(default)' font_size 0
str '>'
Object 36 (label1): type text
flags dirty
bbox: (50,436)-(79,454)
dims: 28x18
Text: str_id 26 font_name '(default)' font_size 0
str 'Play'
Object 37 (item1-txt): type text
flags dirty
bbox: (227,436)-(316,454)
dims: 89x18
Text: str_id 27 font_name '(default)' font_size 0
str 'Lord Melchett'
Object 38 (item1-key): type text
flags dirty
bbox: (177,436)-(186,454)
dims: 9x18
Text: str_id 28 font_name '(default)' font_size 0
str '1'
Object 41 (label2): type text
flags dirty
bbox: (50,454)-(79,472)
dims: 29x18
Text: str_id 30 font_name '(default)' font_size 0
str 'Now'
Object 42 (item2-txt): type text
flags dirty
bbox: (227,454)-(316,472)
dims: 70x18
Text: str_id 31 font_name '(default)' font_size 0
str 'Lord Percy'
Object 43 (item2-key): type text
flags dirty
bbox: (177,454)-(186,472)
dims: 9x18
Text: str_id 32 font_name '(default)' font_size 0
str '2'
Object 15 (box): type box
flags size_valid, dirty
bbox: (500,200)-(1000,350)
dims: 160x0
Box: fill 0 width 3
Object 16 (box2): type box
flags
bbox: (0,0)-(0,0)
dims: 160x0
Box: fill 0 width 1
Object 17 (editor): type textedit
flags size_valid, dirty
bbox: (100,200)-(400,650)
dims: 289x54
Textedit: str_id 23 font_name '(default)' font_size 0
Object 18 (overlap): type text
flags dirty
bbox: (405,105)-(480,123)
dims: 75x18
Text: str_id 34 font_name '(default)' font_size 0
str 'overlap text'
To print it, use puts() which has no line limits and will just dump the entire block to the console.
One nice thing about this dump is that you can compare it with a desired expo state.
What’s next? It would be nice to be able to move the mouse around and get information about the objects underneath the mouse. Another useful feature would be to write the dump to a file.
For now, it’s a start. Give it a try!