|
From: Mark W. <ma...@kl...> - 2023-04-19 15:41:45
|
Hi Philippe,
On Sun, 2023-04-16 at 14:35 +0200, Philippe Waroquiers wrote:
> > > Not too sure what is going wrong/what I am doing wrong ...
> >
> > Nothing. There is something about sleepers that causes this. It also
> > happens for me. I'll try to debug it. But it works when you give vgdb
> > -d -d debug options...
> Humph, race condition/timing related bugs are hard to debug :(.
Finally found where this happens (sometimes):
diff --git a/coregrind/vgdb.c b/coregrind/vgdb.c
index 7ed9a8b2e..2373bf335 100644
--- a/coregrind/vgdb.c
+++ b/coregrind/vgdb.c
@@ -398,7 +398,9 @@ int read_buf(int fd, char* buf, const char* desc)
{
int nrread;
DEBUG(2, "reading %s\n", desc);
- nrread = read(fd, buf, PBUFSIZ);
+ do {
+ nrread = read(fd, buf, PBUFSIZ);
+ } while (nrread == -1 && errno == EAGAIN);
if (nrread == -1) {
ERROR(errno, "error reading %s\n", desc);
return -1;
This means the pipe isn't actually ready to be read from. Which really
shouldn't happen because we do a poll on the fd to make sure we get an
POLLIN event before starting to read from it.
I'll check in the above if I cannot find a more elegant solution.
Cheers,
Mark
|