summaryrefslogtreecommitdiff
path: root/bitbake/lib
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2010-08-20 12:52:33 +0100
committerRichard Purdie <rpurdie@linux.intel.com>2010-08-20 12:52:43 +0100
commitac3452c4316dce4b8d2620214087ab110c4573f6 (patch)
tree240cb27f0a641892dff2baabdd593b37ef7beee1 /bitbake/lib
parent616e75523b0b1bbe730631dba70224b55cfaaa57 (diff)
downloadopenembedded-core-ac3452c4316dce4b8d2620214087ab110c4573f6.tar.gz
openembedded-core-ac3452c4316dce4b8d2620214087ab110c4573f6.tar.bz2
openembedded-core-ac3452c4316dce4b8d2620214087ab110c4573f6.zip
bitbake/utils.py: Improve better_exec debug output
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/utils.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index 1778a1e2ee..fd7948f1de 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -292,7 +292,6 @@ def _print_trace(body, line):
Print the Environment of a Text Body
"""
# print the environment of the method
- bb.msg.error(bb.msg.domain.Util, "Printing the environment of the function")
min_line = max(1, line-4)
max_line = min(line + 4, len(body)-1)
for i in range(min_line, max_line + 1):
@@ -340,13 +339,18 @@ def better_exec(code, context, text, realfile):
bb.msg.error(bb.msg.domain.Util, "Error in executing python function in: %s" % realfile)
bb.msg.error(bb.msg.domain.Util, "Exception:%s Message:%s" % (t, value))
- # 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