-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Conversation
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.
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: |
There was a problem hiding this comment.
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
@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 |
There was a problem hiding this comment.
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..
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