diff --git a/hilda/hilda_client.py b/hilda/hilda_client.py index 0e5b3d0..bfdd3e3 100644 --- a/hilda/hilda_client.py +++ b/hilda/hilda_client.py @@ -18,11 +18,11 @@ from pathlib import Path from typing import Any, Callable, List, Optional, Union -import hexdump import IPython +import hexdump +from IPython.core.magic import register_line_magic # noqa: F401 from humanfriendly import prompts from humanfriendly.terminal.html import html_to_ansi -from IPython.core.magic import register_line_magic # noqa: F401 from pygments import highlight from pygments.formatters import TerminalTrueColorFormatter from pygments.lexers import XmlLexer @@ -524,7 +524,7 @@ def callback(hilda, frame, bp_loc, options): value = hilda.symbol(hilda.evaluate_expression(name)) log_message += f'\n\t{name} = {hilda._monitor_format_value(fmt, value)}' - if options.get('force_return', False): + if options.get('force_return', None) is not None: hilda.force_return(options['force_return']) log_message += f'\nforced return: {options["force_return"]}' @@ -533,7 +533,7 @@ def callback(hilda, frame, bp_loc, options): hilda.finish() hilda.bt() - if options.get('retval', False): + if options.get('retval', None) is not None: # return from function hilda.finish() value = hilda.evaluate_expression('$arg1') @@ -638,11 +638,13 @@ def bp(self, address_or_name: Union[int, str], callback: Optional[Callable] = No for bp_id, bp in breakpoints: if address_or_name == bp.address: self.remove_hilda_breakpoint(bp_id) - + thread_id = self.process.GetSelectedThread().GetThreadID() if isinstance(address_or_name, int): bp = self.target.BreakpointCreateByAddress(address_or_name) + elif isinstance(address_or_name, str): bp = self.target.BreakpointCreateByName(address_or_name) + bp.SetThreadID(thread_id) if condition is not None: bp.SetCondition(condition)