git://git.jankratochvil.net
/
debugger.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2400866
)
+LOOPS_MIN
author
lace
<>
Sun, 29 Apr 2007 21:37:39 +0000
(21:37 +0000)
committer
lace
<>
Sun, 29 Apr 2007 21:37:39 +0000
(21:37 +0000)
debugger.c
patch
|
blob
|
history
diff --git
a/debugger.c
b/debugger.c
index
8313f78
..
94d8a64
100644
(file)
--- a/
debugger.c
+++ b/
debugger.c
@@
-20,6
+20,9
@@
#define USLEEP (1000000 / 2)
#endif
#define TIMEOUT_SECS 20
#define USLEEP (1000000 / 2)
#endif
#define TIMEOUT_SECS 20
+/* LOOPS_MIN is a safety as QEMU clock time sucks.
+ 100000 is 4s natively and 53s in QEMU. */
+#define LOOPS_MIN 500000
#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
@@
-152,6
+155,7
@@
static enum state state (pid_t pid, unsigned expect_mask, const char *expect_mas
{
enum state found;
time_t timeout = time (NULL) + TIMEOUT_SECS;
{
enum state found;
time_t timeout = time (NULL) + TIMEOUT_SECS;
+ unsigned loops = 0;
/* Sanity check `1 << enum state' was not misplaced with `enum state'. */
assert (1 << (STATE_FIRST + 1) >= STATE_LAST);
/* Sanity check `1 << enum state' was not misplaced with `enum state'. */
assert (1 << (STATE_FIRST + 1) >= STATE_LAST);
@@
-170,7
+174,7
@@
static enum state state (pid_t pid, unsigned expect_mask, const char *expect_mas
if (((1 << found) & expect_mask) != 0)
return found;
}
if (((1 << found) & expect_mask) != 0)
return found;
}
- while (time (NULL) < timeout);
+ while (
loops++ < LOOPS_MIN ||
time (NULL) < timeout);
fprintf (stderr, "Found for PID %d state %s but expecting (%s)\n",
(int) pid, state_to_name (found), expect_mask_string);
fprintf (stderr, "Found for PID %d state %s but expecting (%s)\n",
(int) pid, state_to_name (found), expect_mask_string);