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

Make the tables that are registered configurable #15

Merged
merged 3 commits into from
Sep 26, 2023
Merged

Conversation

fzakaria
Copy link
Owner

Make the list of tables configurable in the API.
Some of the tables are quite expensive to generate such a instructions or symbols.

Allow the users to configure which tables to generate when they create a sql_engine.

CC @markrwilliams

Make the list of tables configurable in the API.
Some of the tables are quite expensive to generate such a instructions
or symbols.

Allow the users to configure which tables to generate when they create a
sql_engine.
Comment on lines +39 to +59
class GeneratorFlag(Flag):
NONE = 0
DYNAMIC_ENTRIES = auto()
HEADERS = auto()
INSTRUCTIONS = auto()
SECTIONS = auto()
SYMBOLS = auto()
STRINGS = auto()
VERSION_REQUIREMENTS = auto()
VERSION_DEFINITIONS = auto()

@classmethod
def ALL(cls: type[GeneratorFlag]) -> GeneratorFlag:
retval = cls.NONE
for member in cls.__members__.values():
retval |= member
return retval


@dataclass
class MakeGeneratorResponse:
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@markrwilliams maybe you have ideas how to make this nicer.
Kind of hate my naming and how this all gets constructed....
at least it's data class /shrug

Comment on lines +7 to +31
@pytest.mark.slow
def test_symbol_resolutions() -> None:
# TODO(fzakaria): Make sure this binary
# is always present in the CI environment.
sql_engine = sql.make_sql_engine(
["/usr/bin/ruby"], recursive=True, flags=elf.GeneratorFlag.SYMBOLS
)
result = sql_engine.execute(
"""
SELECT caller.path as 'caller.path',
callee.path as 'calee.path',
caller.name,
caller.demangled_name
FROM ELF_SYMBOLS caller
INNER JOIN ELF_SYMBOLS callee
ON
caller.name = callee.name AND
caller.path != callee.path AND
caller.imported = TRUE AND
callee.exported = TRUE
LIMIT 25
"""
)
rows = list(result)
assert len(rows) == 25
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method even with only the symbols takes ~4 seconds..

@fzakaria fzakaria merged commit ce12395 into main Sep 26, 2023
2 checks passed
@fzakaria fzakaria deleted the config-tables branch September 26, 2023 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant