From: Alexandra Hájková Date: Mon, 3 Mar 2025 11:14:08 +0000 (-0500) Subject: syswrap-generic: Emit pp_ExeContext after the file descriptor backtrace X-Git-Tag: VALGRIND_3_25_0~126 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=838dc01d2c42f7f22785c771bd74bc4e595da444;p=thirdparty%2Fvalgrind.git syswrap-generic: Emit pp_ExeContext after the file descriptor backtrace Adjust use_after_close test for the change. --- diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c index 175c94b4d..dea656aab 100644 --- a/coregrind/m_syswrap/syswrap-generic.c +++ b/coregrind/m_syswrap/syswrap-generic.c @@ -1185,6 +1185,7 @@ void fd_pp_Error (const Error *err) } VG_(emit)("%sFile descriptor %d %s%s\n", whatpre, nce->fd, error_string, whatpost); + VG_(pp_ExeContext)(where); /* If the file descriptor was never created we won't have where_closed and where_opened. Only print them in a use after close case. */ @@ -1196,7 +1197,6 @@ void fd_pp_Error (const Error *err) VG_(emit)("%sOriginally opened%s\n", auxpre, auxpost); VG_(pp_ExeContext)(nce->where_opened); } - VG_(pp_ExeContext)(where); } else { vg_assert2 (False, "Unknown error kind: %d", VG_(get_error_kind)(err)); diff --git a/none/tests/use_after_close.stderr.exp b/none/tests/use_after_close.stderr.exp index 1ef31c655..75a8d6672 100644 --- a/none/tests/use_after_close.stderr.exp +++ b/none/tests/use_after_close.stderr.exp @@ -1,13 +1,13 @@ bad File descriptor 3 was closed already + at 0x........: write (in /...libc...) + by 0x........: main Previously closed at 0x........: close (in /...libc...) by 0x........: main Originally opened at 0x........: dup (in /...libc...) by 0x........: main - at 0x........: write (in /...libc...) - by 0x........: main File descriptor 7 was never created at 0x........: write (in /...libc...) by 0x........: main