Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
toki
build-systems
yocto
meta-toki
Commits
b539d234
Commit
b539d234
authored
Apr 19, 2020
by
Oliver Horst
Browse files
[add] toki-debug class to assist in debugging bitbake issues
parent
da09ab6e
Changes
1
Hide whitespace changes
Inline
Side-by-side
classes/toki-debug.bbclass
0 → 100644
View file @
b539d234
# This code is adapted from the Python Cookbook section "Getting More Information from Tracebacks" by Bryn Keller
# https://www.oreilly.com/library/view/python-cookbook/0596001673/ch14s05.html
def debug_yocto(d)
import inspect
import traceback
tb = traceback.extract_stack()
bb.warn('\n'.join(traceback.format_list(tb)))
bb.warn("Locals by frame, innermost last")
stack = inspect.stack()
for frameinfo in stack:
frame = frameinfo.frame
bb.warn("")
bb.warn("Frame %s in %s at line %s" % (frame.f_code.co_name,
frame.f_code.co_filename,
frame.f_lineno))
for key, value in frame.f_locals.items():
# We have to be VERY careful not to cause a new error in our error
# printer! Calling str() on an unknown object could cause an
# error we don't want, so we must use try/except to catch it --
# we can't stop it from happening, but we can and should
# stop it from propagating if it does happen!
try:
bb.warn("\t%20s = %s" % (key, str(value)))
except:
bb.warn("\t%20s = <ERROR WHILE PRINTING VALUE>" % key,)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment