improve debugging

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/tools/make/trunk@32329 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2011-02-23 15:03:11 +00:00
parent 8426d7f77d
commit f905ca3ea0
3 changed files with 25 additions and 12 deletions

View file

@ -1,3 +1,12 @@
2011-01-23 Richard Frith-Macdonald <rfm@gnu.org>
* TestFramework/gnustep-tests.in:
* TestFramework/Testing.h:
Change automated setting of breakpoints in gdb to account for
platforms where you can't conditionally break on entry to a function
based on a function argument ... so we set a variable before entry
instead.
2011-01-23 Richard Frith-Macdonald <rfm@gnu.org>
* Testing.h: Fix excess args to printf and incorrect setting of the

View file

@ -107,17 +107,17 @@ static void pass(int passed, const char *format, ...)
#endif
}
/* The testStart() function is used by the PASS macros to record the line number
* in the source code at which the test occurs. This value is then available
* in the testLineNumber variable.
* This is also useful when debugging ... you can set a breakpoint in the
/* The testStart() function is used by the PASS macros to provide a break
* point in the source code after the current test line has been stored in
* testLineNumber.
* This is provided for when debugging ... you can set a breakpoint in the
* testStart() function for the line number reported in a test failure and
* have the debugger stop in just the right place.
*/
static void testStart(unsigned line) __attribute__((unused));
static void testStart(unsigned line)
static void testStart() __attribute__((unused));
static void testStart()
{
testLineNumber = line;
return;
}
/* The unresolved() function is called with a single string argument to
@ -171,7 +171,8 @@ static void unsupported(const char *format, ...)
int _cond; \
id _tmp = testRaised; testRaised = nil; [_tmp release]; \
[[NSGarbageCollector defaultCollector] collectExhaustively]; \
testStart(__LINE__); \
testLineNumber = __LINE__; \
testStart(); \
_cond = (int)(expression); \
[[NSGarbageCollector defaultCollector] collectExhaustively]; \
pass(_cond, "%s:%d ... " format, __FILE__, __LINE__, ## __VA_ARGS__); \
@ -205,7 +206,8 @@ static void unsupported(const char *format, ...)
id _exp; \
id _tmp = testRaised; testRaised = nil; [_tmp release]; \
[[NSGarbageCollector defaultCollector] collectExhaustively]; \
testStart(__LINE__); \
testLineNumber = __LINE__; \
testStart(); \
_obj = (id)(expression);\
_exp = (id)(expect);\
_cond = _obj == _exp || [_obj isEqual: _exp]; \
@ -249,7 +251,8 @@ static void unsupported(const char *format, ...)
NS_DURING \
id _tmp = testRaised; testRaised = nil; [_tmp release]; \
{ \
testStart(__LINE__); \
testLineNumber = __LINE__; \
testStart(); \
code; \
} \
pass(0, "%s:%d ... " format, __FILE__, __LINE__, ## __VA_ARGS__); \
@ -275,7 +278,8 @@ static void unsupported(const char *format, ...)
NS_DURING \
id _tmp = testRaised; testRaised = nil; [_tmp release]; \
{ \
testStart(__LINE__); \
testLineNumber = __LINE__; \
testStart(); \
code; \
} \
pass(1, "%s:%d ... " format, __FILE__, __LINE__, ## __VA_ARGS__); \

View file

@ -358,7 +358,7 @@ run_test_file ()
then
if present "$GSTESTSUM.tmp" "^Failed test:"
then
grep '^Failed test:' "$GSTESTLOG.tmp" | sed -e 's/^Failed test:[^:]*:\([0-9][0-9]*\).*/break testStart if line==\1/' > "$GSTESTDBG"
grep '^Failed test:' "$GSTESTLOG.tmp" | sed -e 's/^Failed test:[^:]*:\([0-9][0-9]*\).*/break testStart if testLineNumber==\1/' > "$GSTESTDBG"
gdb "./obj/$TESTNAME" -x "$GSTESTDBG"
rm -f "$GSTESTDBG"
fi