From c94fbc0e998aebc7fd60d0f447eef0d9a2e2a09e Mon Sep 17 00:00:00 2001 From: grantseltzer Date: Thu, 19 Dec 2024 13:36:17 -0600 Subject: [PATCH] Add comments Signed-off-by: grantseltzer --- .../diconfig/config_manager.go | 2 +- .../ditypes/analysis.go | 20 +++++++++---------- .../ditypes/arch_amd64.go | 3 +++ .../ditypes/arch_arm64.go | 3 +++ 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/pkg/dynamicinstrumentation/diconfig/config_manager.go b/pkg/dynamicinstrumentation/diconfig/config_manager.go index 2ffef82f315e7..11f3bca4d2255 100644 --- a/pkg/dynamicinstrumentation/diconfig/config_manager.go +++ b/pkg/dynamicinstrumentation/diconfig/config_manager.go @@ -127,7 +127,7 @@ func (cm *RCConfigManager) installConfigProbe(procInfo *ditypes.ProcessInfo) err svcConfigProbe := *configProbe svcConfigProbe.ServiceName = procInfo.ServiceName procInfo.ProbesByID[configProbe.ID] = &svcConfigProbe - log.Infof("Installing config probe for service: %s.", svcConfigProbe.ServiceName) + log.Infof("Installing config probe for service: %s", svcConfigProbe.ServiceName) err = AnalyzeBinary(procInfo) if err != nil { return fmt.Errorf("could not analyze binary for config probe: %w", err) diff --git a/pkg/dynamicinstrumentation/ditypes/analysis.go b/pkg/dynamicinstrumentation/ditypes/analysis.go index 7d3b0dd4d2e0e..5db99ed9594c2 100644 --- a/pkg/dynamicinstrumentation/ditypes/analysis.go +++ b/pkg/dynamicinstrumentation/ditypes/analysis.go @@ -34,16 +34,16 @@ type TypeMap struct { // Parameter represents a function parameter as read from DWARF info type Parameter struct { - Name string - ID string - Type string - TotalSize int64 - Kind uint - Location *Location - LocationExpressions []LocationExpression - FieldOffset uint64 - NotCaptureReason NotCaptureReason - ParameterPieces []*Parameter + Name string // Name is populated by the local name of the parameter + ID string // ID is randomly generated for each parameter to avoid + Type string // Type is a string representation of the type name + TotalSize int64 // TotalSize is the size of the parameter type + Kind uint // Kind is a constant representation of the type, see reflect.Kind + Location *Location // Location represents where the parameter will be in memory when passed to the target function + LocationExpressions []LocationExpression // LocationExpressions are the needed instructions for extracting the parameter value from memory + FieldOffset uint64 // FieldOffset is the offset of Parameter field within a struct, if it is a struct field + NotCaptureReason NotCaptureReason // NotCaptureReason conveys to the user why the parameter was not captured + ParameterPieces []*Parameter // ParameterPieces are the sub-fields, such as struct fields or array elements } func (p Parameter) String() string { diff --git a/pkg/dynamicinstrumentation/ditypes/arch_amd64.go b/pkg/dynamicinstrumentation/ditypes/arch_amd64.go index d671a18aa3948..8c1799e8baf37 100644 --- a/pkg/dynamicinstrumentation/ditypes/arch_amd64.go +++ b/pkg/dynamicinstrumentation/ditypes/arch_amd64.go @@ -7,4 +7,7 @@ package ditypes +// StackRegister is the register containing the address of the +// program stack. On x86 DWARF maps the register number 7 to +// the stack pointer. const StackRegister = 7 diff --git a/pkg/dynamicinstrumentation/ditypes/arch_arm64.go b/pkg/dynamicinstrumentation/ditypes/arch_arm64.go index c87f544e01a90..b548bac0f9b5e 100644 --- a/pkg/dynamicinstrumentation/ditypes/arch_arm64.go +++ b/pkg/dynamicinstrumentation/ditypes/arch_arm64.go @@ -7,4 +7,7 @@ package ditypes +// StackRegister is the register containing the address of the +// program stack. On ARM64 DWARF maps the register number 29 to +// the stack pointer. const StackRegister = 29