Skip to content

update panels when separately executing commands #26

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

Merged
merged 1 commit into from
Sep 16, 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
11 changes: 7 additions & 4 deletions debuggers/gdb/gdb_mi_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,14 @@ def run_single_special_command(self, command, version):
if parsed_dict:
return parsed_dict

def get_state(self):
base_state = self.run_single_special_command('pstate', 'base')
regression_state = self.run_single_special_command('pstate', 'regressed')
def get_state(self, version=None):
if version is None:
base_state = self.run_single_special_command('pstate', 'base')
regression_state = self.run_single_special_command('pstate', 'regressed')

return { "base" : base_state, "regressed" : regression_state }
return { "base" : base_state, "regressed" : regression_state }

return self.run_single_special_command("pstate", version)

def get_current_stack_frames(self, state):
base_stack_frame = state['base']['stack_frame']
Expand Down
66 changes: 66 additions & 0 deletions idd.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@ def __init__(self, disable_asm=False, disable_registers=False):
self.disable_asm = disable_asm
self.disable_registers = disable_registers

async def set_command_result(self, version) -> None:
state = Debugger.get_state(version)

await self.set_pframes_result(state, version)
await self.set_pargs_result(state, version)
await self.set_plocals_result(state, version)
if not disable_assembly:
await self.set_pasm_result(state, version)
if not disable_registers:
await self.set_pregisters_result(state, version)

async def set_common_command_result(self, command_result) -> None:
if command_result:
raw_base_contents = command_result["base"]
Expand All @@ -77,6 +88,16 @@ async def compare_contents(self, raw_base_contents, raw_regression_contents):

diff2 = self.diff_driver.get_diff(raw_regression_contents, raw_base_contents, "regressed")
self.diff_area2.append(diff2)

async def set_pframes_result(self, state, version) -> None:
if state == None or "stack_frames" not in state:
return

file_contents = state["stack_frames"]
if version == "base":
self.diff_frames1.text(file_contents)
else:
self.diff_frames2.text(file_contents)

async def set_pframes_command_result(self, state) -> None:
if state["base"] == None or "stack_frames" not in state["base"] or state["regressed"] == None or "stack_frames" not in state["regressed"]:
Expand All @@ -91,6 +112,17 @@ async def set_pframes_command_result(self, state) -> None:
diff2 = self.diff_driver.get_diff(regressed_file_contents, base_file_contents, "regressed")
self.diff_frames2.text(diff2)

async def set_plocals_result(self, state, version) -> None:
if state == None or "locals" not in state:
return

file_contents = state["locals"]
if version == "base":
self.diff_locals1.text(file_contents)
else:
self.diff_locals2.text(file_contents)


async def set_plocals_command_result(self, state) -> None:
if state["base"] == None or "locals" not in state["base"] or state["regressed"] == None or "locals" not in state["regressed"]:
return
Expand All @@ -104,6 +136,16 @@ async def set_plocals_command_result(self, state) -> None:
diff2 = self.diff_driver.get_diff(regressed_file_contents, base_file_contents, "regressed")
self.diff_locals2.text(diff2)

async def set_pargs_result(self, state, version) -> None:
if state == None or "args" not in state:
return

file_contents = state["args"]
if version == "base":
self.diff_args1.text(file_contents)
else:
self.diff_args2.text(file_contents)

async def set_pargs_command_result(self, state) -> None:
if state["base"] == None or "args" not in state["base"] or state["regressed"] == None or "args" not in state["regressed"]:
return
Expand All @@ -117,6 +159,16 @@ async def set_pargs_command_result(self, state) -> None:
diff2 = self.diff_driver.get_diff(regressed_file_contents, base_file_contents, "regressed")
self.diff_args2.text(diff2)

async def set_pasm_result(self, state, version) -> None:
if state == None or "instructions" not in state:
return

file_contents = state["instructions"]
if version == "base":
self.diff_asm1.text(file_contents)
else:
self.diff_asm2.text(file_contents)

async def set_pasm_command_result(self, state) -> None:
if state["base"] == None or "instructions" not in state["base"] or state["regressed"] == None or "instructions" not in state["regressed"]:
return
Expand All @@ -130,6 +182,16 @@ async def set_pasm_command_result(self, state) -> None:
diff2 = self.diff_driver.get_diff(regressed_file_contents, base_file_contents, "regressed")
self.diff_asm2.text(diff2)

async def set_pregisters_result(self, state, version) -> None:
if state == None or "registers" not in state:
return

file_contents = state["registers"]
if version == "base":
self.diff_reg1.text(file_contents)
else:
self.diff_reg2.text(file_contents)

async def set_pregisters_command_result(self, state) -> None:
if state["base"] == None or "registers" not in state["base"] or state["regressed"] == None or "registers" not in state["regressed"]:
return
Expand Down Expand Up @@ -226,6 +288,8 @@ async def execute_debugger_command(self, event: Input.Changed) -> None:
self.diff_area1.append([self.base_command_bar.value])
self.diff_area1.append(result)

await self.set_command_result("base")

self.base_command_bar.value = ""

elif event.control.id == 'regressed-command-bar':
Expand All @@ -234,6 +298,8 @@ async def execute_debugger_command(self, event: Input.Changed) -> None:
self.diff_area2.append([self.regressed_command_bar.value])
self.diff_area2.append(result)

await self.set_command_result("regressed")

self.regressed_command_bar.value = ""

if __name__ == "__main__":
Expand Down