summaryrefslogtreecommitdiffstats
path: root/lib/bb/utils.py
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2010-08-20 12:52:33 +0100
committerChris Larson <chris_larson@mentor.com>2010-12-03 12:24:46 -0700
commit3b66db2b56616fee15428b5ebdc97388f3b6126b (patch)
treeffb45d20c9eb1a3b47880d57a69668bf5488924f /lib/bb/utils.py
parent873633d8bc15fa50bf642e864b2953f66a4d74b2 (diff)
downloadbitbake-3b66db2b56616fee15428b5ebdc97388f3b6126b.tar.gz
bitbake/utils.py: Improve better_exec debug output
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'lib/bb/utils.py')
-rw-r--r--lib/bb/utils.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index edc0f4975..1e3b71f0b 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -295,7 +295,6 @@ def _print_trace(body, line):
Print the Environment of a Text Body
"""
# print the environment of the method
- logger.error("Printing the environment of the function")
min_line = max(1, line-4)
max_line = min(line + 4, len(body)-1)
for i in xrange(min_line, max_line + 1):
@@ -344,13 +343,18 @@ def better_exec(code, context, text, realfile = "<code>"):
logger.exception("Error executing python function in '%s'", code.co_filename)
- # let us find the line number now
- while tb.tb_next:
- tb = tb.tb_next
+ # Strip 'us' from the stack (better_exec call)
+ tb = tb.tb_next
import traceback
- line = traceback.tb_lineno(tb)
+ tbextract = traceback.extract_tb(tb)
+ tbextract = "\n".join(traceback.format_list(tbextract))
+ bb.msg.error(bb.msg.domain.Util, "Traceback:")
+ for line in tbextract.split('\n'):
+ bb.msg.error(bb.msg.domain.Util, line)
+ line = traceback.tb_lineno(tb)
+ bb.msg.error(bb.msg.domain.Util, "The lines leading to this error were:")
_print_trace( text.split('\n'), line )
raise