Im using the debugger on apacheAGE to understand better the source code. Ive come across multiple times the List
struct and the ListeCell
struct, since they are very common in holding and fetching information.
Im having trouble what the ListCell
struct holds as information. Everytime I access the values of a ListCell
struct through gdb, I get some random values/numbers as a result.
I understand that since ListCell
is a union, it may be possible that some of the fields dont make any sense since the memory is overwritten by another field, but still none of the 3 fields make any sense.
What is a way to decode those numbers to understand what information is being used each time?
2
Answers
It appears that you are already familiar with the
List
struct andListCell
union of postgreSQL.While you can view the
ListCell
content using GDB, please note that for Apache AGE, some of it may not appear meaningful as it is transformed and decoded.I am sharing my GDB session below, which I hope could be of use to you.
Query:
GDB:
List:
ListCell:
The List struct can hold three types of data: pointers, integers or Oid’s.
In the context of Apache AGE, I’ve seen that the ListCell is used to loop through a List. For example:
As you can see from the example, there are pointers of
ListContentExample
inside the List, and the ListCell will iterate through the List, receiving the value of each item from the List in each loop iteration.You can find more of it here:
https://doxygen.postgresql.org/unionListCell.html
and in this file from the source code.