Message ID | 20250120032041.280173-3-amerey@redhat.com |
---|---|
State | Superseded |
Headers |
Return-Path: <elfutils-devel-bounces~patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 472C5385841C for <patchwork@sourceware.org>; Mon, 20 Jan 2025 03:22:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 472C5385841C Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Eo8Xavmd X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 83BD53858D38 for <elfutils-devel@sourceware.org>; Mon, 20 Jan 2025 03:20:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 83BD53858D38 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 83BD53858D38 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1737343249; cv=none; b=iiQasO+vSMNZqkAgDvQI+ER0mzBuykf3WEorhMKFGQkE4Iou3eIiXFUPLg+mMpFTWW6fsRQCrdOHIAeDxeK6PYIzNdE+7onAVlfDtJScKzldWHZ4iqffcsV5bTN6wwHgjsIIA3KtPwVBRMOTKQS0b2wP+XrnkMwlPCGjqIkSiMc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1737343249; c=relaxed/simple; bh=ICMHdugfpKyG73c9CuK/X/Znwm6JbaTGtYupVy5bto8=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=AHyuif5XBcFk2o3AljS+KWJ0g+jS7DDgXz9YHArRcRPeQuNWaI0kR3gBuqHZnN1gnY08T510kJAN9X9Sp9kCF0SNaLcZXIwXvTKKVLfHVY4dXFS/VuO4h7AYZ1P6CK+rb8LD9Fu0nxCO1/ND8P7oKhzqiPCPVtarptk8pOuwtF8= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 83BD53858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1737343249; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Pz+VBLN1fu52ppQJdrOKvmYe5dl5t7SyK/Jznp55uEo=; b=Eo8Xavmdnj7d3ZMlQ53ez6da4JvAHicpkFiaiGlQR58PL2rTMVWLcnCm36vOwT448ku9nr Gh7X4BpAcvW0kZhjpa7QFQtNKEpSpF4ie+bDYK8+/C35/KyTUF+vqDvL9y/2rfPG0tWMB2 gqShq8VKzQM1gDQb3BfJ5vHYbDigzTI= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-680-NStO__knO46dWAJHDlzAQQ-1; Sun, 19 Jan 2025 22:20:47 -0500 X-MC-Unique: NStO__knO46dWAJHDlzAQQ-1 X-Mimecast-MFC-AGG-ID: NStO__knO46dWAJHDlzAQQ Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id F1B9219560AB for <elfutils-devel@sourceware.org>; Mon, 20 Jan 2025 03:20:46 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.22.80.25]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 46A1D195608A; Mon, 20 Jan 2025 03:20:46 +0000 (UTC) From: Aaron Merey <amerey@redhat.com> To: elfutils-devel@sourceware.org Cc: Aaron Merey <amerey@redhat.com> Subject: [PATCH 03/15] dwarf_filesrc.c: Add locking Date: Sun, 19 Jan 2025 22:20:29 -0500 Message-ID: <20250120032041.280173-3-amerey@redhat.com> In-Reply-To: <20250120032041.280173-1-amerey@redhat.com> References: <20250120032041.280173-1-amerey@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: L4j68nQ4UshocRIs4vTYXeOoLD7wP2fl65O6bu8lk5w_1737343247 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Elfutils-devel mailing list <elfutils-devel.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/elfutils-devel>, <mailto:elfutils-devel-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/elfutils-devel/> List-Post: <mailto:elfutils-devel@sourceware.org> List-Help: <mailto:elfutils-devel-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/elfutils-devel>, <mailto:elfutils-devel-request@sourceware.org?subject=subscribe> Errors-To: elfutils-devel-bounces~patchwork=sourceware.org@sourceware.org |
Series |
[01/15] Add eu_search_tree_init
|
|
Commit Message
Aaron Merey
Jan. 20, 2025, 3:20 a.m. UTC
* libdw/dwarf_filesrc.c (dwarf_filesrc): Use dwarf_lock.
Signed-off-by: Aaron Merey <amerey@redhat.com>
---
libdw/dwarf_filesrc.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
Comments
On Sun, Jan 19, 2025 at 10:20:29PM -0500, Aaron Merey wrote: > * libdw/dwarf_filesrc.c (dwarf_filesrc): Use dwarf_lock. I didn't got this patch till I saw 06/15 Add Dwarf member to Dwarf_Lines and Dwarf_Files. So this patch should at least come after that. In general I find it a little difficult to understand the locking of the Dwarf_Lines and Dwarf_Files structure of a Dwarf. Maybe some of these patches need reordering and maybe squashing? > diff --git a/libdw/dwarf_filesrc.c b/libdw/dwarf_filesrc.c > index d866ce72..a0881f36 100644 > --- a/libdw/dwarf_filesrc.c > +++ b/libdw/dwarf_filesrc.c > @@ -38,14 +38,23 @@ const char * > dwarf_filesrc (Dwarf_Files *file, size_t idx, Dwarf_Word *mtime, > Dwarf_Word *length) > { > - if (file == NULL || idx >= file->nfiles) > + if (file == NULL) > return NULL; > > + mutex_lock (file->dbg->dwarf_lock); > + if (idx >= file->nfiles) > + { > + mutex_unlock (file->dbg->dwarf_lock); > + return NULL; > + } > + > if (mtime != NULL) > *mtime = file->info[idx].mtime; > > if (length != NULL) > *length = file->info[idx].length; > > - return file->info[idx].name; > + const char *res = file->info[idx].name; > + mutex_unlock (file->dbg->dwarf_lock); > + return res; > } If Dwarf_Files had a Dwarf dbg field then this should work (locally). But I need to read the other patches to see if there are any interactions. Cheers, Mark
Hi Mark, On Wed, Jan 22, 2025 at 5:10 PM Mark Wielaard <mark@klomp.org> wrote: > > On Sun, Jan 19, 2025 at 10:20:29PM -0500, Aaron Merey wrote: > > * libdw/dwarf_filesrc.c (dwarf_filesrc): Use dwarf_lock. > > I didn't got this patch till I saw 06/15 Add Dwarf member to > Dwarf_Lines and Dwarf_Files. So this patch should at least come after > that. Apologies, this patch should have been included after 06/15. I will address this in v2. Aaron
diff --git a/libdw/dwarf_filesrc.c b/libdw/dwarf_filesrc.c index d866ce72..a0881f36 100644 --- a/libdw/dwarf_filesrc.c +++ b/libdw/dwarf_filesrc.c @@ -38,14 +38,23 @@ const char * dwarf_filesrc (Dwarf_Files *file, size_t idx, Dwarf_Word *mtime, Dwarf_Word *length) { - if (file == NULL || idx >= file->nfiles) + if (file == NULL) return NULL; + mutex_lock (file->dbg->dwarf_lock); + if (idx >= file->nfiles) + { + mutex_unlock (file->dbg->dwarf_lock); + return NULL; + } + if (mtime != NULL) *mtime = file->info[idx].mtime; if (length != NULL) *length = file->info[idx].length; - return file->info[idx].name; + const char *res = file->info[idx].name; + mutex_unlock (file->dbg->dwarf_lock); + return res; }