Skip to content
Snippets Groups Projects
Commit 7a24c2f5 authored by Louis-Francis Ratté-Boulianne's avatar Louis-Francis Ratté-Boulianne Committed by Sjoerd Simons
Browse files

Add --no-interactive option to the debug command


When we only want the GDB server running

Signed-off-by: default avatarLouis-Francis Ratté-Boulianne <lfrb@collabora.com>
Reviewed-by: default avatarSjoerd Simons <sjoerd.simons@collabora.co.uk>
Differential Revision: https://phabricator.apertis.org/D5328
parent 3077eac9
Branches 16.12
Tags apertis/0.1612.6 v0.1612.6
No related merge requests found
...@@ -32,6 +32,12 @@ point is used when found\&. ...@@ -32,6 +32,12 @@ point is used when found\&.
.sp .sp
.RE .RE
.PP .PP
\fI\-\-no-interactive\fR
.RS 4
Only start the GDB server without entering the GDB interactive mode\&.
.sp
.RE
.PP
\fI\-\-device\fR \fI\-\-device\fR
.RS 4 .RS 4
Use device as target (e.g. user@apertis)\&. Use device as target (e.g. user@apertis)\&.
......
...@@ -218,6 +218,7 @@ class DebuggerServer: ...@@ -218,6 +218,7 @@ class DebuggerServer:
self.app = app self.app = app
self.args = args self.args = args
self.port = DEFAULT_GDBSERVER_PORT self.port = DEFAULT_GDBSERVER_PORT
self.host = self.target.host
self._thread = None self._thread = None
def __enter__(self): def __enter__(self):
...@@ -278,6 +279,7 @@ class Debugger: ...@@ -278,6 +279,7 @@ class Debugger:
class Simulator: class Simulator:
def __init__(self): def __init__(self):
self.host = 'localhost'
try: try:
with open('/etc/image_version') as f: with open('/etc/image_version') as f:
self.version = SysrootVersion.from_string(f.read()) self.version = SysrootVersion.from_string(f.read())
...@@ -527,6 +529,7 @@ class Sysroot: ...@@ -527,6 +529,7 @@ class Sysroot:
class SDK: class SDK:
def __init__(self): def __init__(self):
self.host = 'localhost'
try: try:
with open('/etc/image_version') as f: with open('/etc/image_version') as f:
self.version = SysrootVersion.from_string(f.read()) self.version = SysrootVersion.from_string(f.read())
...@@ -1056,6 +1059,7 @@ class Ade: ...@@ -1056,6 +1059,7 @@ class Ade:
self.force = False self.force = False
self.debug = False self.debug = False
self.verbose = False self.verbose = False
self.no_interactive = False
def get_sdk(self): def get_sdk(self):
try: try:
...@@ -1453,8 +1457,19 @@ class Ade: ...@@ -1453,8 +1457,19 @@ class Ade:
self.app = project.get_main_executable() self.app = project.get_main_executable()
with DebuggerServer(target, self.app, *self.args) as server: with DebuggerServer(target, self.app, *self.args) as server:
gdb = Debugger(self.unpack_sysroot(target), project) if self.no_interactive:
gdb.connect(server) self.info("* Gdb Server host is {0}".format(server.host))
self.info("* Gdb Server port is {0}".format(server.port))
self.info("* Gdb Server is ready")
if self.format == 'parseable':
print("GdbServerHost:{0}".format(server.host))
print("GdbServerPort:{0}".format(server.port))
print("GdbServerReady:true")
while True:
pass
else:
gdb = Debugger(self.unpack_sysroot(target), project)
gdb.connect(server)
def info(self, message): def info(self, message):
if self.format == 'friendly': if self.format == 'friendly':
...@@ -1575,6 +1590,7 @@ if __name__ == '__main__': ...@@ -1575,6 +1590,7 @@ if __name__ == '__main__':
# Debug parser # Debug parser
debug_parser = subparsers.add_parser('debug', help="Debug application") debug_parser = subparsers.add_parser('debug', help="Debug application")
debug_parser.add_argument('--app', help="Remote path to application to debug") debug_parser.add_argument('--app', help="Remote path to application to debug")
debug_parser.add_argument('--no-interactive', help="Don't start GDB interactive mode", action='store_true')
group = debug_parser.add_mutually_exclusive_group() group = debug_parser.add_mutually_exclusive_group()
group.add_argument('--device', help="Use device as target (e.g. user@apertis)") group.add_argument('--device', help="Use device as target (e.g. user@apertis)")
debug_parser.add_argument('args', help="Arguments to pass to application", nargs=argparse.REMAINDER) debug_parser.add_argument('args', help="Arguments to pass to application", nargs=argparse.REMAINDER)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment