4 from SCons.Action
import Action
6 split_debug_action = Action(
7 'objcopy ${STRIP_EXTRA_ARGUMENTS} --only-keep-debug ${TARGET} ${TARGET.dir}/.debug/${TARGET.file}.debug && '
8 'objcopy --strip-debug --strip-unneeded ${STRIP_EXTRA_ARGUMENTS} '
9 ' --add-gnu-debuglink ${TARGET.dir}/.debug/${TARGET.file}.debug ${TARGET}',
10 "${STRIPCOMSTR}", chdir=
False)
12 strip_debug_action = Action(
13 'objcopy --strip-debug --strip-unneeded ${STRIP_EXTRA_ARGUMENTS} ${TARGET}',
14 "${STRIPCOMSTR}", chdir=
False)
17 def strip_debug_method(env, target):
20 if env[
'SPLIT_DEBUGINFO']:
21 result.append(t.dir.Dir(
".debug").File(t.name+
".debug"))
22 env.SideEffect(result[-1], t)
23 env.AddPostAction(t, split_debug_action)
24 env.Clean(t, result[-1])
26 env.AddPostAction(t, strip_debug_action)
31 env.AddMethod(strip_debug_method,
'StripDebug')
32 env[
'SPLIT_DEBUGINFO'] =
True
33 env[
'STRIP_EXTRA_ARGUMENTS'] =
"-R '.gnu.debuglto_*'"