16"""Configure GDB using the ELinOS environment."""
24 print(
"warning: %s" % msg)
27def get_elinos_environment():
28 """Return the ELinOS environment.
30 If the ELinOS environment is properly set up, return a dictionary
32 * The path to the ELinOS project at key 'project';
33 * The path to the ELinOS CDK at key 'cdk';
34 * The ELinOS target name at key 'target' (Eg. 'i486-linux');
35 * A list of Xenomai install prefixes (which could be empty, if
36 the ELinOS project does not include Xenomai) at key 'xenomai'.
38 If one of these cannot be found, print a warning; the corresponding
39 value in the returned dictionary will be None.
42 for key
in (
"project",
"cdk",
"target"):
43 var =
"ELINOS_" + key.upper()
45 result[key] = os.environ[var]
47 warn(
"%s not set" % var)
50 if result[
"project"]
is not None:
51 result[
"xenomai"] = glob.glob(result[
"project"] +
"/xenomai-[0-9.]*")
53 result[
"xenomai"] = []
59 """Initialize debugger environment for ELinOS.
61 Let the debugger know where to find the ELinOS libraries on host. This
62 assumes that an ELinOS environment is properly set up. If some environment
63 variables are missing, warn about which library may be missing.
65 elinos_env = get_elinos_environment()
70 if None in (elinos_env[key]
for key
in (
"cdk",
"target")):
71 warn(
"ELinOS system libraries will not be loaded")
73 solib_prefix =
"%s/%s" % (elinos_env[
"cdk"], elinos_env[
"target"])
74 solib_dirs += [
"%s/%s" % (solib_prefix,
"lib")]
75 gdb.execute(
"set solib-absolute-prefix %s" % solib_prefix)
79 if elinos_env[
"project"]
is None:
80 warn(
"Xenomai libraries may not be loaded")
82 for dir
in elinos_env[
"xenomai"]:
83 solib_dirs += [
"%s/%s" % (dir,
"xenomai-build/usr/realtime/lib")]
85 if len(solib_dirs) != 0:
86 gdb.execute(
"set solib-search-path %s" %
":".join(solib_dirs))
89if __name__ ==
"__main__":