Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing debugger scripts #1120

Merged
merged 2 commits into from
Jul 29, 2024
Merged
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
14 changes: 7 additions & 7 deletions debug/kgdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,10 +375,10 @@ def __init__(self, val, cat, sortName):
self.kompiled_dir = getKompiledDir()

def getSymbolNameForTag(self, tag):
return gdb.lookup_global_symbol("table_getSymbolNameForTag").value()[tag]
return gdb.lookup_global_symbol("table_get_symbol_name_for_tag").value()[tag]

def isSymbolABinder(self, tag):
return gdb.lookup_global_symbol("table_isSymbolABinder").value()[tag]
return gdb.lookup_global_symbol("table_is_symbol_a_binder").value()[tag]

def getLayoutData(self, layout):
return gdb.lookup_global_symbol("layout_" + str(layout)).value()
Expand Down Expand Up @@ -610,7 +610,7 @@ def append(self, subject, isVar, sort):
argData = layoutData['args'] + i
arg = subject.cast(self.long_int) + int(argData.dereference()['offset'])
cat = argData.dereference()['cat']
sort = gdb.lookup_global_symbol("table_getArgumentSortsForTag").value()[tag][i].string("iso-8859-1")
sort = gdb.lookup_global_symbol("table_get_argument_sorts_for_tag").value()[tag][i].string("iso-8859-1")
if cat == @MAP_LAYOUT@:
self.appendMap(arg.cast(self.map_ptr), sort)
elif cat == @RANGEMAP_LAYOUT@:
Expand Down Expand Up @@ -748,7 +748,7 @@ def invoke(self, arg, from_tty):
argv = gdb.string_to_argv(arg)
if gdb.selected_inferior().pid == 0:
raise gdb.GdbError("You can't do that without a process to debug.")
gdb.lookup_global_symbol("resetMatchReason").value()()
gdb.lookup_global_symbol("reset_match_reason").value()()
if (len(argv) != 2):
raise gdb.GdbError("k match takes two arguments.")
fun = gdb.lookup_global_symbol(argv[0] + '.match')
Expand All @@ -759,8 +759,8 @@ def invoke(self, arg, from_tty):
except gdb.error as err:
raise gdb.GdbError(*err.args)
fun.value()(subject)
entries = gdb.lookup_global_symbol("getMatchLog").value()()
size = int(gdb.lookup_global_symbol("getMatchLogSize").value()())
entries = gdb.lookup_global_symbol("getmatch_log").value()()
size = int(gdb.lookup_global_symbol("getmatch_log_size").value()())
for i in range(size):
entry = entries[i]
if entry['kind'] == self.SUCCESS:
Expand All @@ -771,7 +771,7 @@ def invoke(self, arg, from_tty):
print(debugFunctionName + '(', end='')
name = functionName if functionName[:5] == 'hook_' else debugFunctionName
function = gdb.lookup_global_symbol(name).value().type
front = gdb.lookup_global_symbol("getMatchFnArgs").value()(entry.address)
front = gdb.lookup_global_symbol("get_match_fn_args").value()(entry.address)
conn = ""
for i in range(len(function.fields())):
arg = front[i]
Expand Down
8 changes: 4 additions & 4 deletions debug/klldb.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def _field_expr(self, field):
return self.exe_ctx.target.EvaluateExpression(ptr_exp)

def get_match_function_args(self):
return target_call(self.exe_ctx, 'getMatchFnArgs', 'void **',
return target_call(self.exe_ctx, 'get_match_fn_args', 'void **',
['MatchLog *'], [self.root])

@property
Expand Down Expand Up @@ -190,18 +190,18 @@ def __init__(self, exe_ctx):
self.exe_ctx = exe_ctx

def _reset_match_reason(self):
target_call(self.exe_ctx, 'resetMatchReason', 'void')
target_call(self.exe_ctx, 'reset_match_reason', 'void')

def _try_match(self, rule_name, subject):
expr = self.exe_ctx.target.EvaluateExpression(subject)
target_call(self.exe_ctx, f'{rule_name}.match',
'void', ['block *'], [expr])

def _get_match_log_size(self):
return target_call(self.exe_ctx, 'getMatchLogSize', 'size_t').data.uint64[0]
return target_call(self.exe_ctx, 'getmatch_log_size', 'size_t').data.uint64[0]

def _get_match_log(self):
return target_call(self.exe_ctx, 'getMatchLog', 'MatchLog *')
return target_call(self.exe_ctx, 'getmatch_log', 'MatchLog *')

def _type_to_sort(self, ty):
return {
Expand Down
Loading