diff --git a/main.py b/main.py index e89613b..4d6ddaa 100644 --- a/main.py +++ b/main.py @@ -113,6 +113,7 @@ def __init__(self): self.elf_parser = ExtractGlobalVariablesThread(None, self.ui.tbl_vars) self.var_watcher = MonitoringThread(self.vars_watched_dict) self.var_watcher.signal_update_variable.connect(self.update_variable_in_table) # Assuming 'self.update_variable_in_table' is a method that handles the update + self.var_watcher.var_monitor_active.connect(self.update_var_monitor_active) # USE CUSTOM TITLE BAR | USE AS "False" FOR MAC OR LINUX Settings.ENABLE_CUSTOM_TITLE_BAR = False # used to store the current popup window when selecting var type @@ -793,6 +794,14 @@ def mousePressEvent(self, event): if event.buttons() == Qt.RightButton: pass #print('Mouse click: RIGHT CLICK') + def update_var_monitor_active(self, state): + if state == False: + # change button text to start + self.ui.btn_monitor.setText.setText("Start") + else: + # change button text to stop + self.ui.btn_monitor.setText.setText("Stop") + def update_variable_in_table(self, var_name, value): # Check if the variable name is in the dictionary if var_name in self.vars_watched_dict: diff --git a/modules/btn_callbacks.py b/modules/btn_callbacks.py index 763f02d..8d834d1 100644 --- a/modules/btn_callbacks.py +++ b/modules/btn_callbacks.py @@ -598,11 +598,10 @@ def handle_symbol_extracted(name, address): def start_monitoring(main_window): if main_window.var_watcher.isRunning(): main_window.var_watcher.exit_early = True - main_window.ui.btn_monitor.setText("Start Monitoring") main_window.stop_monitoringThread() else: main_window.var_watcher.start() - main_window.ui.btn_monitor.setText("Stop Monitoring") + def get_core_regs(main_window): logger = logging.getLogger("PDexLogger") diff --git a/modules/elf_insights.py b/modules/elf_insights.py index 298f8f5..8ecde1a 100644 --- a/modules/elf_insights.py +++ b/modules/elf_insights.py @@ -55,6 +55,7 @@ def run(self): class MonitoringThread(QThread): signal_update_variable = Signal(str, object) # Signal to update the variable value + var_monitor_active = Signal(bool) monitor_active = False exit_early = False logger = logging.getLogger("PDexLogger") @@ -99,6 +100,7 @@ def run(self): self.logger.info("Monitoring variables ended") self.exit_early = False monitor_active = False + self.var_monitor_active.emit(False) # TODO emit signal to update UI monitoring button return @@ -106,6 +108,7 @@ def run(self): monitor_active = True target = probe.target target.resume() + self.var_monitor_active.emit(True) self.print_core_registers(target) self.monitor_variables(target, self.address_dict) @@ -150,6 +153,7 @@ def monitor_variables(self, target, addresses): #target.close() # Replace this with the appropriate method to close the connection to the target # You can also add any other cleanup code that needs to be executed here self.logger.info("Monitoring variables ended") + self.var_monitor_active.emit(False) self.exit_early = False monitor_active = False