Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion pkg/filter/accessor_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -667,10 +667,12 @@ func callstackFields(field string, kevt *kevent.Kevent) (kparams.Value, error) {
if kevt.Callstack.IsEmpty() {
return nil, nil
}

key, segment := captureInBrackets(field)
if key == "" || segment == "" {
return nil, nil
}

var i int
switch key {
case frameUStart:
Expand Down Expand Up @@ -702,9 +704,13 @@ func callstackFields(field string, kevt *kevent.Kevent) (kparams.Value, error) {
}
}

if i > kevt.Callstack.Depth() || i < 0 {
if i >= kevt.Callstack.Depth() {
i = kevt.Callstack.Depth() - 1
}
if i < 0 {
i = 0
}

f := kevt.Callstack[i]

switch segment {
Expand Down
2 changes: 1 addition & 1 deletion pkg/filter/filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ func TestThreadFilter(t *testing.T) {
{`thread.callstack[uend].address = '7ffb5c1d0396'`, true},
{`thread.callstack[kstart].address = 'fffff8072ebc1f6f'`, true},
{`thread.callstack[kend].address = 'fffff8072eb8961b'`, true},
{`thread.callstack[112222].address = '2638e59e0a5'`, true},
{`thread.callstack[112222].address = 'fffff8072eb8961b'`, true},
{`thread.callstack[2].symbol = 'Java_java_lang_ProcessImpl_create'`, true},
{`thread.callstack[2].offset = 266`, true},
{`thread.callstack[2].module = 'C:\\Program Files\\JetBrains\\GoLand 2021.2.3\\jbr\\bin\\java.dll'`, true},
Expand Down
Loading