[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r25636 - monkey/trunk/pathologist/src/pathologist
From: |
gnunet |
Subject: |
[GNUnet-SVN] r25636 - monkey/trunk/pathologist/src/pathologist |
Date: |
Fri, 21 Dec 2012 19:28:46 +0100 |
Author: teichm
Date: 2012-12-21 19:28:46 +0100 (Fri, 21 Dec 2012)
New Revision: 25636
Modified:
monkey/trunk/pathologist/src/pathologist/action_api.c
monkey/trunk/pathologist/src/pathologist/edb_api.c
Log:
minor code embeautifications
Modified: monkey/trunk/pathologist/src/pathologist/action_api.c
===================================================================
--- monkey/trunk/pathologist/src/pathologist/action_api.c 2012-12-21
16:48:59 UTC (rev 25635)
+++ monkey/trunk/pathologist/src/pathologist/action_api.c 2012-12-21
18:28:46 UTC (rev 25636)
@@ -727,17 +727,16 @@
oldLine = tracePtr->functionListHead->line;
if (MONKEY_NO != gmi_exec_next_reverse(cntxt->gdb_handle)) {
if (GDB_STATE_ERROR == wait_for_stop(cntxt)) {
- fprintf(stderr,
- "Error: Analysis during Reverse Execution has
failed!\n");
- return MONKEY_NO;
+ fprintf(stderr, "Error: Analysis during Reverse
Execution has failed!\n");
+ return MONKEY_NO;
}
if (oldLine == cntxt->gdb_frames->line)
break;// We reached the end of record history
TODO: DIRTY SOLUTION! WILL FAIL IF TWO EXPRESSIONS ON THE SAME LINE
MONKEY_ACTION_inspect_expression_database(cntxt);
- } else {
- fprintf(stderr, "Error: Reverse Execution has failed!\n");
- return MONKEY_NO;
- }
+ } else {
+ fprintf(stderr, "Error: Reverse Execution has
failed!\n");
+ return MONKEY_NO;
+ }
tracePtr = tracePtr->next; // tracePtr will have the new trace added
after examining the expression database for this reverse execution step
} while ((NULL != tracePtr)
@@ -832,56 +831,34 @@
/* Set the name of the child and the command line arguments. */
if (!gmi_set_exec(cntxt->gdb_handle, cntxt->binary_name,
cntxt->binaryArgs)) {
fprintf(stderr, "Error: could not set gdb exec y args\n");
- if (MONKEY_YES == cntxt->gdb_connected) {
- mi_disconnect(cntxt->gdb_handle);
- cntxt->gdb_connected = MONKEY_NO;
- }
- return MONKEY_NO;
+ goto fail;
}
/* Tell gdb to attach the child to a terminal. */
if (!gmi_target_terminal(cntxt->gdb_handle, ttyname(STDIN_FILENO))) {
fprintf(stderr, "Error: could not select gdb target
terminal\n");
- if (MONKEY_YES == cntxt->gdb_connected) {
- mi_disconnect(cntxt->gdb_handle);
- cntxt->gdb_connected = MONKEY_NO;
- }
- return MONKEY_NO;
+ goto fail;
}
if (MONKEY_YES == cntxt->run_reverse) {
/* If Backtracking is enabled, we must set a breakpoint at the
main function, starting the program, then starting recording */
- mi_bkpt *bp =
- gmi_break_insert_full(cntxt->gdb_handle, 0, 0, NULL,
-1, -1,
- "main");
+ mi_bkpt *bp = gmi_break_insert_full(cntxt->gdb_handle, 0, 0,
NULL, -1, -1, "main");
if (NULL == bp) {
fprintf(stderr, "Error: gdb could not set a breakpoint
at function:%s\n",
cntxt->inspect_function);
- if (MONKEY_YES == cntxt->gdb_connected) {
- mi_disconnect(cntxt->gdb_handle);
- cntxt->gdb_connected = MONKEY_NO;
- }
- return MONKEY_NO;
+ goto fail;
}
mi_free_bkpt(bp);
}
- if ((NULL != cntxt->inspect_expression)
- && (NULL != cntxt->inspect_function)) {
+ if ((NULL != cntxt->inspect_expression) && (NULL !=
cntxt->inspect_function)) {
/* Setting a breakpoint at the function containing the
expression to inspect */
- mi_bkpt *bp =
- gmi_break_insert_full(cntxt->gdb_handle, 0, 0, NULL,
-1, -1,
- cntxt->inspect_function);
+ mi_bkpt *bp = gmi_break_insert_full(cntxt->gdb_handle, 0, 0,
NULL, -1, -1, cntxt->inspect_function);
if (NULL == bp) {
- fprintf(stderr, "Error: gdb could not set a breakpoint
at function:%s\n",
- cntxt->inspect_function);
- if (MONKEY_YES == cntxt->gdb_connected) {
- mi_disconnect(cntxt->gdb_handle);
- cntxt->gdb_connected = MONKEY_NO;
- }
- return MONKEY_NO;
+ fprintf(stderr, "Error: gdb could not set a breakpoint
at function:%s\n", cntxt->inspect_function);
+ goto fail;
}
mi_free_bkpt(bp);
}
@@ -891,13 +868,12 @@
if (NULL == edbCntxt) {
fprintf(stderr,
"Unable to connect to Expression Database file!\n");
- return MONKEY_NO;
+ goto fail;
}
- if (MONKEY_OK != MONKEY_EDB_get_file_names(edbCntxt,
- &iterateFileNames, NULL)) {
+ if (MONKEY_OK != MONKEY_EDB_get_file_names(edbCntxt, &iterateFileNames,
NULL)) {
fprintf(stderr, "Error: Pathologist could not retrieve source file
names from expression database!\n");
- return MONKEY_NO;
+ goto fail;
}
MONKEY_EDB_disconnect(edbCntxt);
@@ -905,11 +881,7 @@
/* Run the program. */
if (!gmi_exec_run(cntxt->gdb_handle)) {
fprintf(stderr, "Error: gdb could not run the target
program!\n");
- if (MONKEY_YES == cntxt->gdb_connected) {
- mi_disconnect(cntxt->gdb_handle);
- cntxt->gdb_connected = MONKEY_NO;
- }
- return MONKEY_NO;
+ goto fail;
}
/* Backtracking is issued after running the program */
@@ -927,6 +899,14 @@
}
return ret;
+
+ // cleanup and abort
+fail:
+ if (MONKEY_YES == cntxt->gdb_connected) {
+ mi_disconnect(cntxt->gdb_handle);
+ cntxt->gdb_connected = MONKEY_NO;
+ }
+ return MONKEY_NO;
}
Modified: monkey/trunk/pathologist/src/pathologist/edb_api.c
===================================================================
--- monkey/trunk/pathologist/src/pathologist/edb_api.c 2012-12-21 16:48:59 UTC
(rev 25635)
+++ monkey/trunk/pathologist/src/pathologist/edb_api.c 2012-12-21 18:28:46 UTC
(rev 25636)
@@ -139,7 +139,7 @@
if (MONKEY_asprintf
(&query,
- "select MAX(end_lineno) from Expression where file_name LIKE
\'%%%s\' and start_lineno < %d",
+ "select MAX(end_lineno) from Expression where file_name LIKE
\'%%%s\' and start_lineno < %d and end_lineno != 32767",
file_name, start_lineno) == -1)
{
fprintf(stderr,
@@ -214,7 +214,7 @@
if (MONKEY_asprintf
(&query,
- "select end_lineno from Expression where file_name LIKE \'%%%s\' and
start_lineno = %d",
+ "select min(end_lineno) from Expression where file_name LIKE \'%%%s\'
and start_lineno = %d",
file_name, start_line_no) == -1)
{
fprintf(stderr,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r25636 - monkey/trunk/pathologist/src/pathologist,
gnunet <=