[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r22851 - monkey/branches/MonkeyBacktracking/monkey/src/monk
From: |
gnunet |
Subject: |
[GNUnet-SVN] r22851 - monkey/branches/MonkeyBacktracking/monkey/src/monkey |
Date: |
Mon, 23 Jul 2012 18:07:28 +0200 |
Author: safey
Date: 2012-07-23 18:07:28 +0200 (Mon, 23 Jul 2012)
New Revision: 22851
Modified:
monkey/branches/MonkeyBacktracking/monkey/src/monkey/action_api.c
monkey/branches/MonkeyBacktracking/monkey/src/monkey/monkey.c
Log:
Monkey produces reports for unknown bugs.
gdb and valgrind installation is checked.
Modified: monkey/branches/MonkeyBacktracking/monkey/src/monkey/action_api.c
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/monkey/action_api.c
2012-07-23 15:18:56 UTC (rev 22850)
+++ monkey/branches/MonkeyBacktracking/monkey/src/monkey/action_api.c
2012-07-23 16:07:28 UTC (rev 22851)
@@ -10,6 +10,8 @@
#include <libesmtp.h>
#include <string.h>
#include <stdio.h>
+#include <sys/stat.h>
+#include <errno.h>
extern void sendMail(const char *messageContents, const char *reportFileName,
const char *emailAddress);
@@ -796,28 +798,29 @@
char *valgrindCommand;
FILE *valgrindPipe;
const char *valgrindPath = cntxt->valgrind_binary_path;
+ struct stat buf;
- MONKEY_asprintf(&cntxt->valgrind_output_tmp_file_name, "%d", rand());
- cntxt->debug_mode = DEBUG_MODE_VALGRIND;
if (NULL == valgrindPath)
- valgrindPath = "/usr/bin/valgrind"; /* Assumption for valgrind
installation */
+ valgrindPath = "/usr/bin/valgrind"; /* Assumption for valgrind
installation */
- if (0 != access(valgrindPath, X_OK)) {
- /* Valgrind is not installed, stop */
- fprintf(stderr,
- "Warning: Valgrind is not installed. Memory check aborted!\n");
- return MONKEY_NO;
+ /* Check if Valgrind is installed */
+ if (stat(valgrindPath, &buf) != 0 && errno == ENOENT ) {
+ fprintf(stderr,
+ "Warning: Valgrind is not installed. Memory check aborted!\n");
+ return MONKEY_NO;
}
+ MONKEY_asprintf(&cntxt->valgrind_output_tmp_file_name, "%d", rand());
+ cntxt->debug_mode = DEBUG_MODE_VALGRIND;
MONKEY_asprintf(&valgrindCommand,
"%s --leak-check=yes --log-file=%s %s", valgrindPath,
cntxt->valgrind_output_tmp_file_name,
cntxt->binary_name);
valgrindPipe = popen(valgrindCommand, "r");
if (NULL == valgrindPipe) {
- fprintf(stderr, "Error in running Valgrind!\n");
- MONKEY_free(valgrindCommand);
- return MONKEY_NO;
+ fprintf(stderr, "Error in running Valgrind! Memory check aborted!\n");
+ MONKEY_free(valgrindCommand);
+ return MONKEY_NO;
}
pclose(valgrindPipe);
@@ -830,13 +833,24 @@
*cntxt)
{
struct MONKEY_EDB_Context *edbCntxt;
+ struct stat buf;
+
+ /* Check if gdb is installed */
+ if (NULL == cntxt->gdb_binary_path) {
+ cntxt->gdb_binary_path = "/usr/bin/gdb"; /* Assumption for gdb default
installation */
+ }
+ if (stat(cntxt->gdb_binary_path, &buf) != 0 && errno == ENOENT ) {
+ fprintf(stderr,
+ "Error: gdb is not installed!\n");
+ return MONKEY_NO;
+ }
+
epoch = NULL; /* Initializing epoch Data Structure */
-
cntxt->debug_mode = DEBUG_MODE_GDB;
/* This is like a file-handle for fopen.
Here we have all the state of gdb "connection". */
if (NULL != cntxt->gdb_binary_path)
- mi_set_gdb_exe(cntxt->gdb_binary_path);
+ mi_set_gdb_exe(cntxt->gdb_binary_path);
int ret;
/* Connect to gdb child. */
@@ -1128,10 +1142,13 @@
case BUG_SIG_BUS:
cntxt->xml_report_node =
createXmlCrashNode("Bus Error", functionPtr->name,
- functionPtr->line, functionPtr->file);
+ functionPtr->line, functionPtr->file);
break;
default:
- return MONKEY_NO; //problem!
+ cntxt->xml_report_node =
+ createXmlCrashNode("Unknown", functionPtr->name,
+ functionPtr->line, functionPtr->file);
+ break;
}
historyNode =
Modified: monkey/branches/MonkeyBacktracking/monkey/src/monkey/monkey.c
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/monkey/monkey.c
2012-07-23 15:18:56 UTC (rev 22850)
+++ monkey/branches/MonkeyBacktracking/monkey/src/monkey/monkey.c
2012-07-23 16:07:28 UTC (rev 22851)
@@ -106,12 +106,15 @@
switch (result)
{
int retVal;
+ case MONKEY_NO:
+ fprintf (stderr, "Error in using gdb. Monkey will exit now!");
+ ret = 1;
+ break;
case GDB_STATE_ERROR:
break;
case GDB_STATE_EXIT_NORMALLY:
fprintf (stderr,
"Debug with gdb, program exited normally!\n");
- /*FIXME: Valgrind should be launched here */
break;
case GDB_STATE_STOPPED:
retVal = MONKEY_ACTION_inspect_expression_database (cntxt);
@@ -129,7 +132,7 @@
retVal = MONKEY_ACTION_rerun_with_valgrind (cntxt);
if (MONKEY_NO == retVal)
{
- fprintf( stderr, "Error using Valgrind!\n");
+ fprintf( stderr, "Error using Valgrind! Monkey will continue
debugging!\n");
ret = 1;
}
}
@@ -175,6 +178,7 @@
default:
break;
}
+
MONKEY_ACTION_delete_context (cntxt);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r22851 - monkey/branches/MonkeyBacktracking/monkey/src/monkey,
gnunet <=