Fix extra_cmds is None crash
The previous patch introduced extra_cmds flag to the command line,
but somehow not checking if such flag was never added.
This patch add check to avoid script crashing.
Change-Id: I18071e5f082f8058c8f8fa78bfe69f7ef5ef560d
Test: lldbclient.py (without --extra-cmds-file)
diff --git a/scripts/gdbclient.py b/scripts/gdbclient.py
index 02f4519..1d6dd87 100755
--- a/scripts/gdbclient.py
+++ b/scripts/gdbclient.py
@@ -351,9 +351,10 @@
commands.append('# If the below `gdb-remote` fails, run the command manually, '
+ 'as it may have raced with lldbserver startup.')
commands.append('gdb-remote {}'.format(str(port)))
- for cmd in extra_cmds:
- if not cmd.startswith('#'):
- commands.append(cmd)
+ if extra_cmds is not None:
+ for cmd in extra_cmds:
+ if not cmd.startswith('#'):
+ commands.append(cmd)
return '\n'.join(commands)