nakst / gf

A GDB frontend for Linux.
MIT License
1.82k stars 61 forks source link

fix: display the expanded elements of an array in the right format. #119

Closed s4my closed 1 year ago

s4my commented 1 year ago

Right now if we add a watch expression to inspect the contents of say an array in C char buffer[100];, or just inspect it's contents in the Locals window, and then change the format specifier of the buffer with for example /x, this will change it's display format to hexadecimal, but when expanded (>) all the elements in the array are not displayed in the hexadecimal format.

This pull request makes sure to synchronize the format of the different fields of the watch object with their parent.

nakst commented 1 year ago

This prevents overriding the format for specific fields. Instead, only propagate the format when the format character is set (around line 1825) and when the fields are added (around line 1152). For the former, check that w->rows[w->selectedRow]->isArray is true and then iterate through the w->rows[w->selectedRow]->fields array, and update the format and updateIndex of each. Don't set value to NULL (this leaks memory).

s4my commented 1 year ago

This prevents overriding the format for specific fields.

Sorry, i forgot to test changing the format specifier for individual fields.

For the former, check that w->rows[w->selectedRow]->isArray is true

This throw me off, that's why i avoided it initially, because when the buffer is not expanded (i.e when w->rows[w->selectedRow]->open == false), w->rows[w->selectedRow]->isArray returned false.

Anyways, the issue is fixed, i made the necessary changes, this should close this pull request.