https://bugs.llvm.org/show_bug.cgi?id=48264
David Blaikie <dblai...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|INVALID |---
Status|RESOLVED |REOPENED
--- Comment #5 from David Blaikie <dblai...@gmail.com> ---
(In reply to Yibiao Yang from comment #4)
> (In reply to David Blaikie from comment #3)
> > (In reply to Yibiao Yang from comment #2)
> > > (In reply to David Blaikie from comment #1)
> > > > That sounds correct to me - the program forked, so two processes reached
> > > > those two lines. lldb probably only follows one of those processes.
> > > >
> > > > Try adding a printf/output between line 9 and 10, and you'll see it
> > > > prints
> > > > out twice.
> > >
> > > Thank you very much. Yes, it is indeed fork. So there is no problem as
> > > Line
> > > 9 and Line 10 are marked as executed twice.
> > >
> > > But for Line 3 and Line 4, I was wondering that they should marked as only
> > > executed once since calling to fork is at Line 9. Only at that time, there
> > > are two processes.
> >
> > That's how fork works - a single process runs until fork is called, then
> > that process is cloned into two that continue from the fork call.
> > https://man7.org/linux/man-pages/man2/fork.2.html
>
> From this point of view, it also make sense as these two lines are marked as
> executed twice. Gcov behaves differently. I think both are correct. Thank
> you very much.
Sorry, misunderstood your comment and I didn't look at the text closely.
Yeah, it is noteworthy that the early statements show as executed twice - when
they certainly were not. (the fork only executes statements after it twice).
I'd guess LLVM kept the counts in memory/registers that were duplicated when
the process forked, then both sets of values were added to the counts.
That does seem questionable, and gcc/gcov seems more accurate here.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs