@@ -46,9 +46,11 @@ type ProcessInfo struct {
4646
4747 ProcessConnections `textlog:",expand"`
4848
49- Sections [] Section `json:"sections,omitempty" textlog:"-"`
49+ Sections Sections `json:"sections,omitempty" textlog:"-"`
5050}
5151
52+ type Sections []Section
53+
5254// Section describes a memory range in a process's virtual memory.
5355// This typically corresponds to a section in an executable file or library, such as .text, .data, etc.,
5456// or a stack, heap, or similar.
@@ -72,6 +74,22 @@ type Section struct {
7274 Permissions RwxPermissions `json:"permissions"`
7375}
7476
77+ // RelativeTextPointer implements the jsonlog.TextReferenceResolver interface for Sections.
78+ // It resolves a reference to a Section's SparseData field to a human-readable string.
79+ func (s * Sections ) RelativeTextPointer (pointee any ) (string , bool ) {
80+ for i := range * s {
81+ section := & (* s )[i ]
82+ if pointee == & section .SparseData {
83+ if section .Name != "" {
84+ return section .Name , true
85+ } else {
86+ return fmt .Sprintf ("0x%x" , section .Address ), true
87+ }
88+ }
89+ }
90+ return "" , false
91+ }
92+
7593type ProcessConnections struct {
7694 ListenPorts ProcessListenPorts `json:"listen_ports" textlog:"listen_ports,omitempty" jsonschema:"nullable"`
7795 Connections []ProcessConnection `json:"connections" textlog:"-" jsonschema:"nullable"`
0 commit comments