From nobody Sun Sep 24 10:26:21 2023 X-Original-To: ports-bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RthxT4wYtz4tm9M for ; Sun, 24 Sep 2023 10:26:21 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RthxT3rqnz4HBZ for ; Sun, 24 Sep 2023 10:26:21 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1695551181; a=rsa-sha256; cv=none; b=Roq76U9UgyeajOfswgqAJ77nA5rgUT9TDzUhaJ6NksFRhcntXBvcxR3XhdHBjDJCsXDhZ1 zq1OXdHPBdEB6XvZTORIUErg1hNYL0DBGDhGBSv7CGThLtwINXgbetDEjRh73JLN/1m8Ef QihSmrS6uwM8wvytNaL4Nf3dea3hhor8zgprK6rEpArZV+AJq2I4/tqTZ+7/DYJgkvimAB C6Q9VACr3QSuUfKAaXmL/LNsdtQ7VhMpkkh+8hervTlpWUOOlnTxIz7mEXj6IYc8UwGvOX bjMRpFQSM4s4SNsYfIXOqsHCVxrSYZhfJqy/XJQf63g8bMUWlaDu3sXPSNN3dQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1695551181; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=13SCOA7s7L9eJuPHzI1D/13ahnvmjO4kAqG/QggQhD0=; b=vEXWTfW99b8Pe7B+g6OUhIzTbiP82XaVJCEzLx/CJJtR9Oyy2Z6vCRE+wM6ye6J1BVS2u7 hTNNs3LOC2G7Qduo9YYkN+Ot6L/ci4P/yjgQ8C2pQS6XgaLXshI8fIYbo0G5OUjFB6zjkJ gG5szSKjuvlTY9+Oqi68mMVS4ESOTH3nikwKLLmVy2b359R54bMaqr0HJKBoxric/jO24U AAHT7LwlJcB4/Z7anPgqOI5vd/reJEOEOZJVJS5IrnRv7sOwiy/59Jfywm6NJZNQugwBAZ 9DMwahuNLfWQM3lvp6IUGXvZjhumrEWHQ4Y4El5hl9GRUEDkW+jvfoX1ftVM5Q== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4RthxT2qQ3zjjQ for ; Sun, 24 Sep 2023 10:26:21 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 38OAQLim087176 for ; Sun, 24 Sep 2023 10:26:21 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 38OAQLG3087175 for ports-bugs@FreeBSD.org; Sun, 24 Sep 2023 10:26:21 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: ports-bugs@FreeBSD.org Subject: [Bug 273688] sysutils/pstack: does not work with Valgrind Date: Sun, 24 Sep 2023 10:26:21 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Ports & Packages X-Bugzilla-Component: Individual Port(s) X-Bugzilla-Version: Latest X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: pjfloyd@wanadoo.fr X-Bugzilla-Status: Open X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: ports-bugs@FreeBSD.org X-Bugzilla-Flags: maintainer-feedback? X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Ports bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-ports-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-ports-bugs@freebsd.org X-BeenThere: freebsd-ports-bugs@freebsd.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D273688 --- Comment #2 from Paul Floyd --- Some more analysis In first window,=20 ./vg-in-place sleep 100000 Tthat's my dev build of Valgrind, just 'valgrind' from pkd devel/valgrind-d= evel should be fine as well. In the second window, GDB test (gdb) attach 48907 Attaching to process 48907 Reading symbols from /usr/home/paulf/scratch/valgrind/memcheck/memcheck-amd64-freebsd... [Switching to LWP 104670 of process 48907] vgModuleLocal_do_syscall_for_client_WRK () at m_syswrap/syscall-amd64-freebsd.S:144 144 setc 0(%rsp) /* stash returned carry flag */ (gdb) bt #0 vgModuleLocal_do_syscall_for_client_WRK () at m_syswrap/syscall-amd64-freebsd.S:144 #1 0x000000003819f27a in do_syscall_for_client (syscallno=3D240, tst=3D0x1002024f10, syscall_mask=3D0x1002ca9e20) at m_syswrap/syswrap-main.= c:368 #2 vgPlain_client_syscall (tid=3Dtid@entry=3D1, trc=3Dtrc@entry=3D73) at m_syswrap/syswrap-main.c:2341 #3 0x000000003819b150 in handle_syscall (tid=3Dtid@entry=3D1, trc=3Dtrc@en= try=3D73) at m_scheduler/scheduler.c:1206 #4 0x0000000038199223 in vgPlain_scheduler (tid=3Dtid@entry=3D1) at m_scheduler/scheduler.c:1552 #5 0x00000000381ab33c in thread_wrapper (tidW=3D1) at m_syswrap/syswrap-freebsd.c:112 #6 run_a_thread_NORETURN (tidW=3D1) at m_syswrap/syswrap-freebsd.c:166 #7 0x0000000000000000 in ?? () That's what I'd expect. And lldb: (lldb) attach 48907 This version of LLDB has no plugin for the language "assembler". Inspection= of frame variables will be limited. Process 48907 stopped * thread #1, name =3D 'memcheck-amd64-f', stop reason =3D signal SIGSTOP frame #0: 0x00000000381a03a6 memcheck-amd64-freebsd`vgModuleLocal_do_syscall_for_client_WRK at syscall-amd64-freebsd.S:144 141 but hasn't been committed to RAX. */ 142=20 143 /* stack contents: 3 words for syscall above, plus our prologue = */ -> 144 setc 0(%rsp) /* stash returned carry flag */ 145=20 146 movq -16(%rbp), %r11 /* r11 =3D VexGuestAMD64State * */ 147 movq %rax, OFFSET_amd64_RAX(%r11) /* save back to RAX */ Executable module set to "/usr/home/paulf/scratch/valgrind/memcheck/memcheck-amd64-freebsd". Architecture set to: x86_64-unknown-freebsd13.2. (lldb) bt * thread #1, name =3D 'memcheck-amd64-f', stop reason =3D signal SIGSTOP * frame #0: 0x00000000381a03a6 memcheck-amd64-freebsd`vgModuleLocal_do_syscall_for_client_WRK at syscall-amd64-freebsd.S:144 frame #1: 0x000000003819f27a memcheck-amd64-freebsd`vgPlain_client_sysc= all [inlined] do_syscall_for_client(syscallno=3D240, tst=3D0x0000001002024f10, syscall_mask=3D0x0000001002ca9e20) at syswrap-main.c:368:10 frame #2: 0x000000003819f232 memcheck-amd64-freebsd`vgPlain_client_syscall(tid=3D1, trc=3D73) at syswrap-main.c:2341:10 frame #3: 0x000000003819b150 memcheck-amd64-freebsd`handle_syscall(tid= =3D1, trc=3D73) at scheduler.c:1206:4 frame #4: 0x0000000038199223 memcheck-amd64-freebsd`vgPlain_scheduler(tid=3D1) at scheduler.c:1552:3 frame #5: 0x00000000381ab33c memcheck-amd64-freebsd`run_a_thread_NORETU= RN [inlined] thread_wrapper(tidW=3D1) at syswrap-freebsd.c:112:10 frame #6: 0x00000000381ab2c6 memcheck-amd64-freebsd`run_a_thread_NORETURN(tidW=3D1) at syswrap-freebsd.c:166:10 Again, that's OK. I've dowloaded the pstack source from github and built it. In gdb, looking at elfFindSymbolByAddress I see that the address that pstac= k is using is the same as the address I see when attaching gdb. Namely 0x381a03a= 6. There is no .dynsym so elfFindSectionByName finds .symtab. symStrings looks OK to me. The frst entry is nil, and after that there is (gdb) x /s obj->fileData + shdrs[symSection->sh_link]->sh_offset+1 0x8027e5829: "mc_leakcheck.c" That matches what I see with objdump -t: paulf> objdump -t /usr/home/paulf/scratch/valgrind/memcheck/memcheck-amd64-freebsd | less=20= =20=20=20=20=20=20=20=20 /usr/home/paulf/scratch/valgrind/memcheck/memcheck-amd64-freebsd: file format elf64-x86-64-freebsd SYMBOL TABLE: 0000000000000000 l df *ABS* 0000000000000000 mc_leakcheck.c And the function where it is sleeping is 00000000381a034c g .text 0000000000000000 vgModuleLocal_do_syscall_for_client_WRK I've done some more debugging and I've seen one error. @ -196,11 +198,23 @@ elfFindSymbolByAddress(struct ElfObject *obj, Elf_Addr addr, symSection->sh_offset + symSection->sh_size); for (; sym < endSym; sym++) { - if ((type =3D=3D STT_NOTYPE || + if ((ELF_ST_TYPE(sym->st_info) =3D=3D STT_NOTYPE || elfFindSymbolByAddress is only ever called with type =3D=3D STT_FUNC and so STT_FUNC =3D=3D STT_NOTYPE is always false and any function with type STT_NOTYPE aren't processed. I suppose STT_NOTYPE also means a size of 0. With the above change I get 0x381a03a6 vgModuleLocal_do_syscall_for_client_WRK (3819f27a, 0, 1301, 0, 3812ddf8, 0) + 5a but only the one line. I need to so some more debugging of elfFindSymbolByAddress() to see why it's not getting the full callstack. --=20 You are receiving this mail because: You are the assignee for the bug.=