[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r25627 - monkey/trunk/pathologist/src/pathologist
From: |
gnunet |
Subject: |
[GNUnet-SVN] r25627 - monkey/trunk/pathologist/src/pathologist |
Date: |
Fri, 21 Dec 2012 15:50:12 +0100 |
Author: teichm
Date: 2012-12-21 15:50:12 +0100 (Fri, 21 Dec 2012)
New Revision: 25627
Modified:
monkey/trunk/pathologist/src/pathologist/action_api.c
monkey/trunk/pathologist/src/pathologist/pathologist.c
Log:
indentation fixes
Modified: monkey/trunk/pathologist/src/pathologist/action_api.c
===================================================================
--- monkey/trunk/pathologist/src/pathologist/action_api.c 2012-12-21
14:42:18 UTC (rev 25626)
+++ monkey/trunk/pathologist/src/pathologist/action_api.c 2012-12-21
14:50:12 UTC (rev 25627)
@@ -143,7 +143,7 @@
static int safetyCount = 0;
while (!mi_get_response(cntxt->gdb_handle))
- usleep(GDB_MI_ASYNC_WAIT);
+ usleep(GDB_MI_ASYNC_WAIT);
/* The end of the async. */
cntxt->gdb_stop_reason = mi_res_stop(cntxt->gdb_handle);
Modified: monkey/trunk/pathologist/src/pathologist/pathologist.c
===================================================================
--- monkey/trunk/pathologist/src/pathologist/pathologist.c 2012-12-21
14:42:18 UTC (rev 25626)
+++ monkey/trunk/pathologist/src/pathologist/pathologist.c 2012-12-21
14:50:12 UTC (rev 25627)
@@ -82,179 +82,175 @@
*/
static void run()
{
- int result;
- struct MONKEY_ACTION_Context *cntxt;
+ int result;
+ struct MONKEY_ACTION_Context *cntxt;
- /* Check files existence */
- if (MONKEY_NO == checkFileExistence(binaryName)) {
- fprintf(stderr, "Error: Target binary file does not exist.\n");
- ret = 1;
- return;
- }
+ /* Check files existence */
+ if (MONKEY_NO == checkFileExistence(binaryName)) {
+ fprintf(stderr, "Error: Target binary file does not exist.\n");
+ ret = 1;
+ return;
+ }
- if (MONKEY_NO == checkFileExistence(edbFilePath)) {
- fprintf(stderr, "Error: Expression database file does not exist.\n");
- ret = 1;
- return;
- }
+ if (MONKEY_NO == checkFileExistence(edbFilePath)) {
+ fprintf(stderr, "Error: Expression database file does not
exist.\n");
+ ret = 1;
+ return;
+ }
- if (NULL != gdbBinaryPath) {
- if (MONKEY_NO == checkFileExistence(gdbBinaryPath)) {
- fprintf(stderr, "Error: gdb binary file does not exist.\n");
- ret = 1;
- return;
- }
- }
+ if (NULL != gdbBinaryPath &&
+ MONKEY_NO == checkFileExistence(gdbBinaryPath))
+ {
+ fprintf(stderr, "Error: gdb binary file does not exist.\n");
+ ret = 1;
+ return;
+
+ }
- if (NULL != valgrindBinaryPath) {
- if (MONKEY_NO == checkFileExistence(valgrindBinaryPath)) {
- fprintf(stderr, "Error: valgrind binary file does not
exist.\n");
- ret = 1;
- return;
- }
- }
-
- /* Check if the target program is and ELF binary */
- if (MONKEY_NO == checkELF(binaryName)) {
- FILE* targetProgramPipe;
- char buffer[128];
- ret = 1;
-
- fprintf(stderr, "Target program is not an ELF. Pathologist will not
debug the program.\n");
- fprintf(stderr, "Pathologist will attempt to run the program
normally.\n");
-
- targetProgramPipe = popen(command, "r");
- if (NULL == targetProgramPipe) {
- fprintf(stderr, "Target is not a binary.\n");
- return;
- }
- while(!feof(targetProgramPipe)) {
- if (NULL != fgets(buffer, 128, targetProgramPipe)) {
- fputs(buffer, stderr);
- }
- }
- pclose(targetProgramPipe);
- return;
- }
-
- if (NULL == edbFilePath)
- {
- /* lookup a file named test.db in the working directory */
- struct stat buf;
- if (0 != stat ("test.db", &buf))
+ if (NULL != valgrindBinaryPath &&
+ MONKEY_NO == checkFileExistence(valgrindBinaryPath))
{
- fprintf( stderr,
- "Expression Database file was not provided as and
argument, "
- "and there is no file named test.db in pathologist's
working directory!\n");
- MONKEY_break (0);
- ret = 1;
- return;
+ fprintf(stderr, "Error: valgrind binary file does not
exist.\n");
+ ret = 1;
+ return;
}
- }
+ /* Check if the target program is and ELF binary */
+ if (MONKEY_NO == checkELF(binaryName)) {
+ FILE* targetProgramPipe;
+ char buffer[128];
+ ret = 1;
- if (NULL == dumpFileName)
- {
- /* if no file name provided for the output report, the default report
name will be binaryName_PIDpid */
- const char *bn = strrchr(binaryName, '/');
- if (NULL == bn) {
- bn = binaryName;
- } else {
- bn++;
- }
- MONKEY_asprintf(&dumpFileName, "%s_PID%d", bn, getpid());
- }
+ fprintf(stderr, "Target program is not an ELF. Pathologist will
not debug the program.\n");
+ fprintf(stderr, "Pathologist will attempt to run the program
normally.\n");
- /* Initialize context for the Action API */
- cntxt = MONKEY_malloc (sizeof (struct MONKEY_ACTION_Context));
- cntxt->email_address = emailAddress;
- cntxt->binary_name = binaryName;
- cntxt->binaryArgs = binaryArgs;
- cntxt->expression_database_path = edbFilePath;
- cntxt->gdb_binary_path = gdbBinaryPath;
- cntxt->valgrind_binary_path = valgrindBinaryPath;
- cntxt->inspect_expression = inspectExpression;
- cntxt->inspect_function = inspectFunction;
- cntxt->scope_depth = scopeDepth;
- cntxt->bug_detected = NO_BUG_DETECTED;
- cntxt->has_null = MONKEY_NO;
- cntxt->xml_report_node = NULL;
- cntxt->run_reverse = reverseExecutionAllowed;
- cntxt->gdb_connected = MONKEY_NO;
+ targetProgramPipe = popen(command, "r");
+ if (NULL == targetProgramPipe) {
+ fprintf(stderr, "Target is not a binary.\n");
+ return;
+ }
+ while(!feof(targetProgramPipe)) {
+ if (NULL != fgets(buffer, 128, targetProgramPipe)) {
+ fputs(buffer, stderr);
+ }
+ }
+ pclose(targetProgramPipe);
+ return;
+ }
- result = MONKEY_ACTION_rerun_with_gdb (cntxt);
- switch (result)
- {
- int retVal;
- case MONKEY_NO:
- case GDB_STATE_ERROR:
- fprintf (stderr, "Error in using gdb. Pathologist will exit now!\n");
- ret = 1;
- break;
- case GDB_STATE_EXIT_NORMALLY:
- fprintf (stderr,
- "Debug with gdb, program exited normally!\n");
- break;
- case GDB_STATE_STOPPED:
- retVal = MONKEY_ACTION_inspect_expression_database (cntxt);
- if (MONKEY_NO == retVal)
+ if (NULL == edbFilePath)
{
- fprintf( stderr,
- "Error in using the expression database. Pathologist will
exit now!\n");
- ret = 1;
- break;
+ /* lookup a file named test.db in the working directory */
+ struct stat buf;
+ if (0 != stat ("test.db", &buf))
+ {
+ fprintf( stderr,
+ "Expression Database file was not provided as and
argument, "
+ "and there is no file named test.db in pathologist's
working directory!\n");
+ MONKEY_break (0);
+ ret = 1;
+ return;
+ }
}
- else if (BUG_BAD_MEM_ACCESS == cntxt->bug_detected
- || BUG_SIG_BUS == cntxt->bug_detected)
+
+ if (NULL == dumpFileName)
{
- /* launch valgrind */
- retVal = MONKEY_ACTION_rerun_with_valgrind (cntxt);
- if (MONKEY_NO == retVal)
- {
- fprintf( stderr, "Error using Valgrind! Pathologist will continue
debugging!\n");
- }
+ /* if no file name provided for the output report, the default
report name will be binaryName_PIDpid */
+ const char *bn = strrchr(binaryName, '/');
+ if (NULL == bn) {
+ bn = binaryName;
+ } else {
+ bn++;
+ }
+ MONKEY_asprintf(&dumpFileName, "%s_PID%d", bn, getpid());
}
- /* Start backtracking if enabled by user */
- if (cntxt->run_reverse) {
- retVal = MONKEY_ACTION_start_reverse_execution(cntxt);
- if (MONKEY_NO == retVal) {
- fprintf(stderr, "Error during Backtracking! Pathologist will
continue debugging with backtracking.\n");
- }
- }
+ /* Initialize context for the Action API */
+ cntxt = MONKEY_malloc (sizeof (struct MONKEY_ACTION_Context));
+ cntxt->email_address = emailAddress;
+ cntxt->binary_name = binaryName;
+ cntxt->binaryArgs = binaryArgs;
+ cntxt->expression_database_path = edbFilePath;
+ cntxt->gdb_binary_path = gdbBinaryPath;
+ cntxt->valgrind_binary_path = valgrindBinaryPath;
+ cntxt->inspect_expression = inspectExpression;
+ cntxt->inspect_function = inspectFunction;
+ cntxt->scope_depth = scopeDepth;
+ cntxt->bug_detected = NO_BUG_DETECTED;
+ cntxt->has_null = MONKEY_NO;
+ cntxt->xml_report_node = NULL;
+ cntxt->run_reverse = reverseExecutionAllowed;
+ cntxt->gdb_connected = MONKEY_NO;
+ result = MONKEY_ACTION_rerun_with_gdb (cntxt);
+ int retVal;
+ switch (result)
+ {
+ case MONKEY_NO:
+ case GDB_STATE_ERROR:
+ fprintf (stderr, "Error in using gdb. Pathologist will exit
now!\n");
+ ret = 1;
+ break;
+ case GDB_STATE_EXIT_NORMALLY:
+ fprintf (stderr, "Debug with gdb, program exited normally!\n");
+ break;
+ case GDB_STATE_STOPPED:
+ retVal = MONKEY_ACTION_inspect_expression_database (cntxt);
+ if (MONKEY_NO == retVal)
+ {
+ fprintf( stderr,
+ "Error in using the expression database. Pathologist
will exit now!\n");
+ ret = 1;
+ break;
+ }
+ else if (BUG_BAD_MEM_ACCESS == cntxt->bug_detected
+ || BUG_SIG_BUS == cntxt->bug_detected)
+ {
+ /* launch valgrind */
+ retVal = MONKEY_ACTION_rerun_with_valgrind (cntxt);
+ if (MONKEY_NO == retVal)
+ fprintf( stderr, "Error using Valgrind!
Pathologist will continue debugging!\n");
+ }
- /* REPORTING
*/
- if (MONKEY_OK != MONKEY_ACTION_format_report_xml (cntxt))
- {
- fprintf( stderr,
- "Error in generating debug report!\n");
- ret = 1;
+ /* Start backtracking if enabled by user */
+ if (cntxt->run_reverse) {
+ retVal = MONKEY_ACTION_start_reverse_execution(cntxt);
+ if (MONKEY_NO == retVal)
+ fprintf(stderr, "Error during Backtracking!
Pathologist will continue debugging with backtracking.\n");
+ }
+
+
+ /* REPORTING
*/
+ if (MONKEY_OK != MONKEY_ACTION_format_report_xml (cntxt))
+ {
+ fprintf( stderr,
+ "Error in generating debug report!\n");
+ ret = 1;
+ }
+ if (emailAddress != NULL)
+ {
+ if (MONKEY_OK != MONKEY_ACTION_report_email (cntxt,
dumpFileName))
+ {
+ fprintf( stderr, "Error sending email!\n");
+ ret = 1;
+ }
+ }
+ if (dumpFileName != NULL)
+ {
+ if (MONKEY_OK !=
+ MONKEY_ACTION_report_file (cntxt, dumpFileName,
MONKEY_YES))
+ {
+ fprintf( stderr,
+ "Error in saving debug file!\n");
+ ret = 1;
+ }
+ }
+ break;
+ default:
+ break;
}
- if (emailAddress != NULL)
- {
- if (MONKEY_OK != MONKEY_ACTION_report_email (cntxt, dumpFileName))
- {
- fprintf( stderr, "Error sending email!\n");
- ret = 1;
- }
- }
- if (dumpFileName != NULL)
- {
- if (MONKEY_OK !=
- MONKEY_ACTION_report_file (cntxt, dumpFileName, MONKEY_YES))
- {
- fprintf( stderr,
- "Error in saving debug file!\n");
- ret = 1;
- }
- }
- break;
- default:
- break;
- }
- MONKEY_ACTION_delete_context (cntxt);
+MONKEY_ACTION_delete_context (cntxt);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r25627 - monkey/trunk/pathologist/src/pathologist,
gnunet <=