summaryrefslogtreecommitdiff
path: root/src/SConscript
diff options
context:
space:
mode:
authorNathan Binkert <nate@binkert.org>2008-10-09 04:58:23 -0700
committerNathan Binkert <nate@binkert.org>2008-10-09 04:58:23 -0700
commit68c75c589b2e006292f623bd6428754d7d590f01 (patch)
treead9af6c1660326fc9f435190387b4893284aa05a /src/SConscript
parent886c5f8fe5011bf9a610d2bc3cb3bb010c592510 (diff)
downloadgem5-68c75c589b2e006292f623bd6428754d7d590f01.tar.xz
pdb: Try to make pdb work better.
I've done a few things here. First, I invoke the script a little bit differently so that pdb doesn't get confused. Second, I've stored the actual filename in the module's __file__ so that pdb can find the source file on your machine.
Diffstat (limited to 'src/SConscript')
-rw-r--r--src/SConscript20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/SConscript b/src/SConscript
index 1b968ec90..09ccf7722 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -61,8 +61,9 @@ def sort_list(_list):
class PySourceFile(object):
invalid_sym_char = re.compile('[^A-z0-9_]')
- def __init__(self, package, source):
- filename = str(source)
+ def __init__(self, package, tnode):
+ snode = tnode.srcnode()
+ filename = str(tnode)
pyname = basename(filename)
assert pyname.endswith('.py')
name = pyname[:-3]
@@ -70,7 +71,8 @@ class PySourceFile(object):
path = package.split('.')
else:
path = []
- modpath = path
+
+ modpath = path[:]
if name != '__init__':
modpath += [name]
modpath = '.'.join(modpath)
@@ -78,13 +80,17 @@ class PySourceFile(object):
arcpath = path + [ pyname ]
arcname = joinpath(*arcpath)
- self.tnode = source
- self.snode = source.srcnode()
+ debugname = snode.abspath
+ if not exists(debugname):
+ debugname = tnode.abspath
+
+ self.tnode = tnode
+ self.snode = snode
self.pyname = pyname
self.package = package
self.modpath = modpath
self.arcname = arcname
- self.filename = filename
+ self.debugname = debugname
self.compiled = File(filename + 'c')
self.assembly = File(filename + '.s')
self.symname = "PyEMB_" + self.invalid_sym_char.sub('_', modpath)
@@ -849,7 +855,7 @@ def objectifyPyFile(target, source, env):
dst = file(str(target[0]), 'w')
pysource = py_sources_tnodes[source[0]]
- compiled = compile(src, pysource.snode.path, 'exec')
+ compiled = compile(src, pysource.debugname, 'exec')
marshalled = marshal.dumps(compiled)
compressed = zlib.compress(marshalled)
data = compressed