Gabe Black has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/49383 )
9 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the
submitted one.
Change subject: scons: Accumulate debug flags in a construction variable.
......................................................................
scons: Accumulate debug flags in a construction variable.
Do this instead of putting them in a dictionary side channel.
Change-Id: I52319f2d42c87ef8e7861e7dc700ba45b8e1629e
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49383
Maintainer: Bobby R. Bruce <[email protected]>
Tested-by: kokoro <[email protected]>
Reviewed-by: Hoa Nguyen <[email protected]>
---
M src/SConscript
1 file changed, 16 insertions(+), 15 deletions(-)
Approvals:
Hoa Nguyen: Looks good to me, approved
Bobby R. Bruce: Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/SConscript b/src/SConscript
index 50633df..932bed1 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -443,30 +443,31 @@
code.write(str(target[0]))
-debug_flags = {}
def DebugFlag(name, desc=None, fmt=False):
if name == "All":
raise AttributeError('The "All" flag name is reserved')
- if name in debug_flags:
- raise AttributeError("Flag {} already specified".format(name))
+ debug_flags = env.get('DEBUG_FLAGS', [])
+ if any(name == flag[0] for flag in debug_flags):
+ raise AttributeError(f'Flag {name} already specified')
flag = (name, (), desc, fmt)
- debug_flags[name] = flag
+ env.Append(DEBUG_FLAGS=[flag])
- hh_file = Dir(env['BUILDDIR']).Dir('debug').File('%s.hh' % name)
+ hh_file = Dir(env['BUILDDIR']).Dir('debug').File(f'{name}.hh')
env.Command(hh_file, ToValue(flag),
MakeAction(makeDebugFlagHH, Transform("TRACING", 0)))
def CompoundFlag(name, flags, desc=None):
if name == "All":
raise AttributeError('The "All" flag name is reserved')
- if name in debug_flags:
- raise AttributeError('Flag {} already specified'.format(name))
+ debug_flags = env.get('DEBUG_FLAGS', [])
+ if any(name == flag[0] for flag in debug_flags):
+ raise AttributeError(f'Flag {name} already specified')
flag = (name, flags, desc, False)
- debug_flags[name] = flag
+ env.Append(DEBUG_FLAGS=[flag])
- env.Command(Dir(env['BUILDDIR']).Dir('debug').File('%s.hh' % name),
+ env.Command(Dir(env['BUILDDIR']).Dir('debug').File(f'{name}.hh'),
ToValue(flag),
MakeAction(makeDebugFlagHH, Transform("TRACING", 0)))
@@ -887,7 +888,7 @@
# Handle debug flags
#
def makeDebugFlagCC(target, source, env):
- assert(len(target) == 1 and len(source) == 1)
+ assert(len(target) == 1)
code = code_formatter()
@@ -909,9 +910,8 @@
''')
- for name, flag in sorted(source[0].read().items()):
- n, compound, desc, fmt = flag
- assert n == name
+ for flag in sorted(env.get('DEBUG_FLAGS', [])):
+ name, compound, desc, fmt = flag
# We intentionally make flag a reference to a heap allocated
object so
# (1) It has a similar interface to a global object like before
@@ -948,8 +948,9 @@
code.write(str(target[0]))
# Generate the files for the debug and debug-format flags
-env.Command('debug/flags.cc', Value(debug_flags),
- MakeAction(makeDebugFlagCC, Transform("TRACING", 0)))
+env.Command('debug/flags.cc', [],
+ MakeAction(makeDebugFlagCC, Transform("TRACING", 0),
+ varlist=['DEBUG_FLAGS']))
Source('debug/flags.cc', add_tags='gem5 trace')
# version tags
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/49383
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I52319f2d42c87ef8e7861e7dc700ba45b8e1629e
Gerrit-Change-Number: 49383
Gerrit-PatchSet: 11
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Bobby R. Bruce <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Hoa Nguyen <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s