mirror of
https://git.yoctoproject.org/poky
synced 2026-01-29 21:08:42 +01:00
devtool: ide-sdk recommend DEBUG_BUILD
The debug_build_config function was never called. Compiling with debug optimized compiler flags was not working. Even with the --debug-build-config flag set, the build configuration from the recipe was used. The devtool ide-sdk --debug-build-config approach didn't work very well anyway. The problem is that changing the bbappend file doesn't work while bitbake uses the bbappend file. As a workaround, it would be possible to parse the recipe, get DEBUG_BUILD and the path to the append file, exit tinfoil, change the bbappend file, reopen tinfoil and do what ide-sdk is supposed to do. Such an implementation would be complicated and slow. Therefore, the code that was originally supposed to implement this is removed from ide-sdk and the new --debug-build function of devtool modify is used instead. Additionally, a hint should be given on how to manually add DEBUG_BUILD = '1' to bbappend. This is compatible with the VSCode Bitbake plug-in, which does not support this parameter anyway. (From OE-Core rev: 23795962683c792347a17854fb0521734497d4a8) Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Steve Sakoman <steve@sakoman.com>
This commit is contained in:
committed by
Steve Sakoman
parent
d104122e52
commit
04484c6dde
@@ -288,6 +288,7 @@ class RecipeModified:
|
|||||||
self.bblayers = None
|
self.bblayers = None
|
||||||
self.bpn = None
|
self.bpn = None
|
||||||
self.d = None
|
self.d = None
|
||||||
|
self.debug_build = None
|
||||||
self.fakerootcmd = None
|
self.fakerootcmd = None
|
||||||
self.fakerootenv = None
|
self.fakerootenv = None
|
||||||
self.libdir = None
|
self.libdir = None
|
||||||
@@ -348,6 +349,7 @@ class RecipeModified:
|
|||||||
self.bpn = recipe_d.getVar('BPN')
|
self.bpn = recipe_d.getVar('BPN')
|
||||||
self.cxx = recipe_d.getVar('CXX')
|
self.cxx = recipe_d.getVar('CXX')
|
||||||
self.d = recipe_d.getVar('D')
|
self.d = recipe_d.getVar('D')
|
||||||
|
self.debug_build = recipe_d.getVar('DEBUG_BUILD')
|
||||||
self.fakerootcmd = recipe_d.getVar('FAKEROOTCMD')
|
self.fakerootcmd = recipe_d.getVar('FAKEROOTCMD')
|
||||||
self.fakerootenv = recipe_d.getVar('FAKEROOTENV')
|
self.fakerootenv = recipe_d.getVar('FAKEROOTENV')
|
||||||
self.libdir = recipe_d.getVar('libdir')
|
self.libdir = recipe_d.getVar('libdir')
|
||||||
@@ -389,17 +391,6 @@ class RecipeModified:
|
|||||||
self.recipe_id = self.bpn + "-" + self.package_arch
|
self.recipe_id = self.bpn + "-" + self.package_arch
|
||||||
self.recipe_id_pretty = self.bpn + ": " + self.package_arch
|
self.recipe_id_pretty = self.bpn + ": " + self.package_arch
|
||||||
|
|
||||||
def append_to_bbappend(self, append_text):
|
|
||||||
with open(self.bbappend, 'a') as bbap:
|
|
||||||
bbap.write(append_text)
|
|
||||||
|
|
||||||
def remove_from_bbappend(self, append_text):
|
|
||||||
with open(self.bbappend, 'r') as bbap:
|
|
||||||
text = bbap.read()
|
|
||||||
new_text = text.replace(append_text, '')
|
|
||||||
with open(self.bbappend, 'w') as bbap:
|
|
||||||
bbap.write(new_text)
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def is_valid_shell_variable(var):
|
def is_valid_shell_variable(var):
|
||||||
"""Skip strange shell variables like systemd
|
"""Skip strange shell variables like systemd
|
||||||
@@ -412,34 +403,6 @@ class RecipeModified:
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def debug_build_config(self, args):
|
|
||||||
"""Explicitely set for example CMAKE_BUILD_TYPE to Debug if not defined otherwise"""
|
|
||||||
if self.build_tool is BuildTool.CMAKE:
|
|
||||||
append_text = os.linesep + \
|
|
||||||
'OECMAKE_ARGS:append = " -DCMAKE_BUILD_TYPE:STRING=Debug"' + os.linesep
|
|
||||||
if args.debug_build_config and not 'CMAKE_BUILD_TYPE' in self.cmake_cache_vars:
|
|
||||||
self.cmake_cache_vars['CMAKE_BUILD_TYPE'] = {
|
|
||||||
"type": "STRING",
|
|
||||||
"value": "Debug",
|
|
||||||
}
|
|
||||||
self.append_to_bbappend(append_text)
|
|
||||||
elif 'CMAKE_BUILD_TYPE' in self.cmake_cache_vars:
|
|
||||||
del self.cmake_cache_vars['CMAKE_BUILD_TYPE']
|
|
||||||
self.remove_from_bbappend(append_text)
|
|
||||||
elif self.build_tool is BuildTool.MESON:
|
|
||||||
append_text = os.linesep + 'MESON_BUILDTYPE = "debug"' + os.linesep
|
|
||||||
if args.debug_build_config and self.meson_buildtype != "debug":
|
|
||||||
self.mesonopts.replace(
|
|
||||||
'--buildtype ' + self.meson_buildtype, '--buildtype debug')
|
|
||||||
self.append_to_bbappend(append_text)
|
|
||||||
elif self.meson_buildtype == "debug":
|
|
||||||
self.mesonopts.replace(
|
|
||||||
'--buildtype debug', '--buildtype plain')
|
|
||||||
self.remove_from_bbappend(append_text)
|
|
||||||
elif args.debug_build_config:
|
|
||||||
logger.warn(
|
|
||||||
"--debug-build-config is not implemented for this build tool yet.")
|
|
||||||
|
|
||||||
def solib_search_path(self, image):
|
def solib_search_path(self, image):
|
||||||
"""Search for debug symbols in the rootfs and rootfs-dbg
|
"""Search for debug symbols in the rootfs and rootfs-dbg
|
||||||
|
|
||||||
@@ -988,6 +951,13 @@ def ide_setup(args, config, basepath, workspace):
|
|||||||
recipe_modified.gen_meson_wrapper()
|
recipe_modified.gen_meson_wrapper()
|
||||||
ide.setup_modified_recipe(
|
ide.setup_modified_recipe(
|
||||||
args, recipe_image, recipe_modified)
|
args, recipe_image, recipe_modified)
|
||||||
|
|
||||||
|
if recipe_modified.debug_build != '1':
|
||||||
|
logger.warn(
|
||||||
|
'Recipe %s is compiled with release build configuration. '
|
||||||
|
'You might want to add DEBUG_BUILD = "1" to %s. '
|
||||||
|
'Note that devtool modify --debug-build can do this automatically.',
|
||||||
|
recipe_modified.name, recipe_modified.bbappend)
|
||||||
else:
|
else:
|
||||||
raise DevtoolError("Must not end up here.")
|
raise DevtoolError("Must not end up here.")
|
||||||
|
|
||||||
@@ -1065,6 +1035,4 @@ def register_commands(subparsers, context):
|
|||||||
'-p', '--no-preserve', help='Do not preserve existing files', action='store_true')
|
'-p', '--no-preserve', help='Do not preserve existing files', action='store_true')
|
||||||
parser_ide_sdk.add_argument(
|
parser_ide_sdk.add_argument(
|
||||||
'--no-check-space', help='Do not check for available space before deploying', action='store_true')
|
'--no-check-space', help='Do not check for available space before deploying', action='store_true')
|
||||||
parser_ide_sdk.add_argument(
|
|
||||||
'--debug-build-config', help='Use debug build flags, for example set CMAKE_BUILD_TYPE=Debug', action='store_true')
|
|
||||||
parser_ide_sdk.set_defaults(func=ide_setup)
|
parser_ide_sdk.set_defaults(func=ide_setup)
|
||||||
|
|||||||
Reference in New Issue
Block a user