MCPcopy Create free account
hub / github.com/rabbitstack/fibratus / CallsiteAssembly

Method CallsiteAssembly

pkg/callstack/callstack.go:147–176  ·  view source on GitHub ↗

CallsiteAssembly decodes the callsite trailing/leading bytes depending on the value of the `leading` argument. The resulting string contains the decoded x86 machine opcodes in Intel assembler syntax.

(proc windows.Handle, leading bool)

Source from the content-addressed store, hash-verified

145// The resulting string contains the decoded x86 machine
146// opcodes in Intel assembler syntax.
147func (f *Frame) CallsiteAssembly(proc windows.Handle, leading bool) string {
148 if f.Addr.InSystemRange() {
149 return ""
150 }
151
152 size := uint(512)
153 base := f.Addr.Uintptr()
154 if leading {
155 base -= uintptr(size)
156 }
157
158 buf := va.ReadArea(proc, base, size, size, false)
159 if len(buf) == 0 || va.Zeroed(buf) {
160 return ""
161 }
162
163 var b strings.Builder
164
165 for i := 0; i < len(buf); {
166 ins, err := x86asm.Decode(buf[i:], 64)
167 if err != nil {
168 return b.String()
169 }
170 b.WriteString(x86asm.IntelSyntax(ins, f.Addr.Uint64(), nil))
171 b.WriteRune('|')
172 i += ins.Len
173 }
174
175 return b.String()
176}
177
178// Callstack is a sequence of stack frames
179// representing function executions.

Callers 2

CallsiteInsnsMethod · 0.80
callstackMapValuerMethod · 0.80

Calls 6

ReadAreaFunction · 0.92
ZeroedFunction · 0.92
InSystemRangeMethod · 0.80
UintptrMethod · 0.80
StringMethod · 0.65
Uint64Method · 0.45

Tested by

no test coverage detected