forked from avocado-framework/avocado
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GDB: add
--gdb-prerun-commands
option to GDB plugin
This feature allows custom GDB commands to be executed before the actual binary is run. What it can do then, is only limited by the user's goals. This is intended to allow complex applications, such as QEMU, to be debugged inside Avocado tests. Configuring GDB for QEMU, for example, involves passing signals to the application that would otherwise result in an event that would stop the debugger. Signed-off-by: Cleber Rosa <[email protected]>
- Loading branch information
Showing
7 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
This directory contains examples of GDB "prerun" command files. These are | ||
intended to be examples of how to use the "--gdb-prerun-commands" option | ||
of the Avocado GDB plugin. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
signal SIGUSR1 pass | ||
signal SIGUSR1 nostop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/usr/bin/env python | ||
|
||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 2 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
# | ||
# See LICENSE for more details. | ||
# | ||
# Copyright: Red Hat Inc. 2014 | ||
# Author: Cleber Rosa <[email protected]> | ||
|
||
import os | ||
import sys | ||
import unittest | ||
|
||
# simple magic for using scripts within a source tree | ||
basedir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..', '..', '..') | ||
basedir = os.path.abspath(basedir) | ||
if os.path.isdir(os.path.join(basedir, 'avocado')): | ||
sys.path.append(basedir) | ||
|
||
from avocado import runtime | ||
from avocado.utils import process | ||
|
||
|
||
class GDBPluginTest(unittest.TestCase): | ||
|
||
def test_gdb_prerun_commands(self): | ||
os.chdir(basedir) | ||
cmd_line = './scripts/avocado run --gdb-prerun-commands=/dev/null sleeptest' | ||
process.run(cmd_line) | ||
|
||
def test_gdb_multiple_prerun_commands(self): | ||
os.chdir(basedir) | ||
cmd_line = ('./scripts/avocado run --gdb-prerun-commands=/dev/null ' | ||
'--gdb-prerun-commands=foo:/dev/null sleeptest') | ||
process.run(cmd_line) | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |