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

No way to expose full C++ backtrace to Python #405

Open
lohedges opened this issue Oct 3, 2022 · 2 comments
Open

No way to expose full C++ backtrace to Python #405

lohedges opened this issue Oct 3, 2022 · 2 comments
Labels
2023.0 Work related to the 2023 release

Comments

@lohedges
Copy link
Member

lohedges commented Oct 3, 2022

Currently the full C++ backtrace is not exposed to the Python wrappers so cannot be parsed, e.g. by BioSimSpace. This is used in various places to provide additional contextual information to the user. Currently the output implies that the functionality can be exposed by calling sire.error.enable_backtrace_exceptions(), but this function doesn't appear to be exposed (yet).

For example:

{'why': 'There are no lead parsers!',
 'backtrace': 'Backtrace disabled. Call sire.error.enable_backtrace_exceptions() to re-enable.',
 'pid': '',
 'type': 'SireError::program_bug',
 'where': 'FILE: /home/lester/Code/Sire/corelib/src/libs/SireIO/moleculeparser.cpp, LINE: 1838, FUNCTION: void SireIO::MoleculeParser::sortParsers(QList<SireBase::PropPtr<SireIO::MoleculeParser> >&, QList<SireBase::PropPtr<SireIO::MoleculeParser> >&) const',
 'from': 'FILE: /home/lester/Code/Sire/corelib/src/libs/SireIO/moleculeparser.cpp, LINE: 1838, FUNCTION: void SireIO::MoleculeParser::sortParsers(QList<SireBase::PropPtr<SireIO::MoleculeParser> >&, QList<SireBase::PropPtr<SireIO::MoleculeParser> >&) const'}

In this case, we only get the last error message. I would like to be able to parse the full trace to see if this was due to the presence of CMAP records, which are currently unsupported, e.g. in relation to this issue.

(The only function that currently appears to be exposed through sire.error is get_last_error_details.)

@lohedges lohedges added the 2023.0 Work related to the 2023 release label Oct 3, 2022
@lohedges
Copy link
Member Author

lohedges commented Oct 3, 2022

Okay, I figured out that this functionality resides in the sire.legacy.Error package, not sire.error as described by the error message above. I'll leave this open for now, although I imagine that it will be resolved as the full 2023 API is fleshed out.

@chryswoods
Copy link
Member

Thanks - yes, I forgot to expose this in sire.error. Yes, this will need fleshing out and fixing before the 2023.1 release.

I made the change to disable backtraces by default as they were a major performance hit in key parts of the code. Ideally I'd like to find a way to automatically enable them when needed... but am not sure this is possible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2023.0 Work related to the 2023 release
Projects
None yet
Development

No branches or pull requests

2 participants