diff options
Diffstat (limited to 'build-aux/measurestack')
-rw-r--r-- | build-aux/measurestack/app_main.py | 4 | ||||
-rw-r--r-- | build-aux/measurestack/app_plugins.py | 14 | ||||
-rw-r--r-- | build-aux/measurestack/test_app_plugins.py | 101 |
3 files changed, 5 insertions, 114 deletions
diff --git a/build-aux/measurestack/app_main.py b/build-aux/measurestack/app_main.py index c5b5a79..69247ed 100644 --- a/build-aux/measurestack/app_main.py +++ b/build-aux/measurestack/app_main.py @@ -28,7 +28,7 @@ def main( # sbc-harness #################################################### libmisc_plugin = app_plugins.LibMiscPlugin(arg_c_fnames) - lib9p_plugin = app_plugins.Lib9PPlugin(arg_base_dir, arg_c_fnames, libmisc_plugin) + lib9p_plugin = app_plugins.Lib9PPlugin(arg_base_dir, arg_c_fnames) def sbc_is_thread(name: QName) -> int: if str(name).endswith("_cr") and name.base() != BaseName("lib9p_srv_read_cr"): @@ -48,7 +48,7 @@ def main( plugins += [ app_plugins.CmdPlugin(), libmisc_plugin, - app_plugins.PicoFmtPlugin(arg_pico_platform, lib9p_plugin.formatters), + app_plugins.PicoFmtPlugin(arg_pico_platform, []), app_plugins.LibHWPlugin(arg_pico_platform, libmisc_plugin), app_plugins.LibCRPlugin(), app_plugins.LibCRIPCPlugin(), diff --git a/build-aux/measurestack/app_plugins.py b/build-aux/measurestack/app_plugins.py index 8009c0c..26eb66d 100644 --- a/build-aux/measurestack/app_plugins.py +++ b/build-aux/measurestack/app_plugins.py @@ -260,20 +260,12 @@ class Lib9PPlugin: lib9p_msgs: set[str] _CONFIG_9P_MAX_CONNS: int | None _CONFIG_9P_MAX_REQS: int | None - formatters: typing.Collection[BaseName] def __init__( self, arg_base_dir: str, arg_c_fnames: typing.Collection[str], - libmisc_plugin: LibMiscPlugin, ) -> None: - self.formatters = { - x.base() - for x in libmisc_plugin.objcalls["format"] - if str(x.base()).startswith("lib9p_") - } - # Find filenames ####################################################### def _is_config_h(fname: str) -> bool: @@ -347,7 +339,7 @@ class Lib9PPlugin: re_table_call = re.compile( r"\s*_lib9p_(?P<meth>validate|unmarshal|marshal)\(.*(?P<grp>[RT])msg.*\);\s*" ) - re_print_call = re.compile(r".*lib9p_table_msg.*\.box_as_fmt_formatter\(.*") + re_print_call = re.compile(r".*lib9p_table_msg.*\.print\(.*") def indirect_callees( self, loc: str, line: str @@ -366,9 +358,7 @@ class Lib9PPlugin: ], True if self.re_print_call.fullmatch(line): # Functions for disabled protocol extensions will be missing. - return [ - QName(f"lib9p_msg_{msg}_format") for msg in self.lib9p_msgs - ], True + return [QName(f"fmt_print_{msg}") for msg in self.lib9p_msgs], True if "lib9p/srv.c:" in loc: if "srv->msglog(" in line: # Actual ROMs shouldn't set this, and so will be missing on rp2040 builds. diff --git a/build-aux/measurestack/test_app_plugins.py b/build-aux/measurestack/test_app_plugins.py index 808d55a..3e281b7 100644 --- a/build-aux/measurestack/test_app_plugins.py +++ b/build-aux/measurestack/test_app_plugins.py @@ -8,7 +8,7 @@ import typing from . import analyze, app_plugins, testutil, util -from .analyze import BaseName, QName +from .analyze import QName def test_fct() -> None: @@ -70,102 +70,3 @@ def test_fct() -> None: graph_plugin.assert_nstatic(result.groups["Main"].rows[QName("a")].nstatic, exp_a) graph_plugin.assert_nstatic(result.groups["Main"].rows[QName("b")].nstatic, exp_b) - - -def test_assert_formatter() -> None: - # _____________________________________________________ - # | | - # | | - # | main | - # | | | - # | __wrap_vprintf | - # | | _______________ | - # | fmt_vfctprintf / \ | - # | \ fmt_state_printf | | - # | \____ ____/ | | - # | \ / | | - # | _vfctprintf | | - # | ____/ \____ ^ | - # | / ?<---snip | | - # | conv_builtin \ | | - # | | libfmt_conv_formatter | | - # | | | | | - # | \ lib9p_msg_Rread_format | | - # | \___________ __/ \___________/ | - # | \ / | - # | fmt_state_putchar | - # | | | - # | stdio_buffered_printer | - # | | - # |_____________________________________________________| - # - graph: typing.Sequence[tuple[str, typing.Collection[str]]] = [ - ("main", {"vprintf"}), - ("__wrap_vprintf", {"fmt_vfctprintf"}), - ("fmt_vfctprintf", {"_vfctprintf"}), - ("fmt_state_printf", {"_vfctprintf"}), - ("_vfctprintf", {"conv_builtin", "libfmt_conv_formatter"}), - ("conv_builtin", {"fmt_state_putchar"}), - ("libfmt_conv_formatter", {"lib9p_msg_Rread_format"}), - ("lib9p_msg_Rread_format", {"fmt_state_putchar", "fmt_state_printf"}), - ("fmt_state_putchar", {"stdio_buffered_printer", "_out_buffer"}), - ("stdio_buffered_printer", {}), - ("_out_buffer", {}), # wrong fct - ] - - # 1 2 3 4 5 6 7 8 9 10 11 <= call_depth - # - main() ; + - # - __wrap__vprintf() ; + - # - fmt_vfctprintf() ; + - # - _vfctprintf() ; + - # - conv_builtin() ; - # - fmt_state_putchar() ; - # - stdio_buffered_printer() ; - # - libfmt_conv_formatter() ; + - # - lib9p_msg_Rread_format() ; + - # - fmt_state_putchar() ; - # - stdio_buffered_printer() ; - # - fmt_state_printf() ; + - # - _vfctprintf() ; + - # - conv_builtin() ; + - # - fmt_state_putchar() ; + - # - stdio_buffered_printer() ; + - # - libfmt_conv_formatter() ; skip (formatter won't use %v) - max_call_depth = 11 - exp = [ - "main", - "__wrap_vprintf", - "fmt_vfctprintf", - "_vfctprintf", - "libfmt_conv_formatter", - "lib9p_msg_Rread_format", - "fmt_state_printf", - "_vfctprintf", - "conv_builtin", - "fmt_state_putchar", - "stdio_buffered_printer", - ] - - graph_plugin = testutil.GraphProviderPlugin(max_call_depth, graph) - - plugins: list[util.Plugin] = [ - graph_plugin, - app_plugins.LibMiscPlugin(arg_c_fnames=[]), - app_plugins.PicoFmtPlugin("rp2040", [BaseName("lib9p_msg_Rread_format")]), - ] - - def test_filter(name: QName) -> tuple[int, bool]: - if name.base() == BaseName("main"): - return 1, True - return 0, False - - result = analyze.analyze( - ci_fnames=[], - app_func_filters={ - "Main": test_filter, - }, - app=util.PluginApplication(testutil.nop_location_xform, plugins), - cfg_max_call_depth=max_call_depth, - ) - - graph_plugin.assert_nstatic(result.groups["Main"].rows[QName("main")].nstatic, exp) |