1 # Copyright (C) 2011-2013 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 """Configure GDB using the ELinOS environment."""
24 print "warning: %s" % msg
27 def 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, it is then assumed that the ELinOS
39 environment is not properly set up. Return None in such a case,
43 for key
in ("project", "cdk", "target"):
44 var
= "ELINOS_" + key
.upper()
46 result
[key
] = os
.environ
[var
]
48 warn("%s not set" % var
)
51 result
["xenomai"] = glob
.glob(result
["project"] + "/xenomai-[0-9.]*")
56 """Initialize debugger environment for ELinOS.
58 Let the debugger know where to find the ELinOS libraries on host. This
59 assumes that an ELinOS environment is properly set up. If not, abort
62 elinos_env
= get_elinos_environment()
64 if elinos_env
is None:
65 warn("ELinOS system libraries will not be loaded")
67 solib_prefix
= "%s/%s" % (elinos_env
["cdk"], elinos_env
["target"])
70 for dir in elinos_env
['xenomai']:
71 solib_dirs
+= ["%s/%s" % (dir, "xenomai-build/usr/realtime/lib")]
72 solib_dirs
+= ["%s/%s" % (solib_prefix
, "lib")]
74 gdb
.execute("set solib-absolute-prefix %s" % solib_prefix
)
75 gdb
.execute("set solib-search-path %s" % ":".join(solib_dirs
))
78 if __name__
== "__main__":
This page took 0.036375 seconds and 4 git commands to generate.