From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 3A7EE3858D20 for ; Mon, 28 Oct 2024 18:53:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3A7EE3858D20 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 3A7EE3858D20 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=1730141625; cv=none; b=hcav0DuGklzRjy1tR6lpF8xc8n5f6hI0Vbe/NMyW2j+3JVdLV1fgjm6GLq4c/S3vmvM+l+w+NTv7yfkaBQOoUWVqPrZlk8Rbhv2PFqnzewgc6q2cMDo9L7sZ68R5TmLqU4+tpS2TwA6YqY8N6dZIWHTRzO7hGDj1qfdNegw3SrM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730141625; c=relaxed/simple; bh=B0qaMbJzn0++zlTSsTr2Fy1ys9b8MP271+K6fzcSfjY=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=trfxae0kiL72MM/OC1zFuhlgAls+L0nO5sf9KFpNJix4jvnu1+zXV60kt1V623T5LSHq1YKwvk65U3b8ufW4+LkW71H4Q/0Nq29OKts3WTZA/5WQeBl6IZJ9cczdqbd37GCyMiThBwyJVM/BQmSFGEzG2eYwYjhK2yZM33bH/Dk= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1730141624; 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=GVUZ8aepBIUlUXLm5a6qw+93qoCZYSRZHHk6AqmyXkw=; b=G2L7RKFuv3qzfAwQzydcBZ22dJxRG8txAs7JwSN7mJ3z2QjX19IMukP/cxhqc22I2L5/K3 k3ZiIo3bVI8bPPb3PnWfHT1dAiODgdrsYzv4y+iZ5mQjWex0yqDm0MZNt/99sXTqoHsZ+H mdEzejvI/Z4QX7ACabSa2NrU15VDXwY= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-124-5FfjXz2oO3uqad2TIl65TA-1; Mon, 28 Oct 2024 14:53:42 -0400 X-MC-Unique: 5FfjXz2oO3uqad2TIl65TA-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4316e350d6aso33456125e9.3 for ; Mon, 28 Oct 2024 11:53:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730141621; x=1730746421; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GVUZ8aepBIUlUXLm5a6qw+93qoCZYSRZHHk6AqmyXkw=; b=uZSOYUUxFmrZ9w8JKKSBZ5tEN3JyN4WfSwnl8XKiaMZDyXJhcrl/FXi5L3iWSgBzm+ UfizuolSK2WM4VMlSr+IZqqJ+s2ySNJJ7hhBt+VMaI0YHGeAZRpCS0cMiViUeLnER486 C/oz9ug9Uvd+N+xhvrTI6/igmuIDgs5wpJCrYG8FaF9FUXYDEbqatnNNYBf4+InbJrAs xVledbUa7is/rgZwQ8zSo2Ky8OY/Z5TjsW5mVbS65ZCIMDWPEzREKCCMVo1HT90NvOWg 9sdKsMpL0gbRKbfPN00p8jd48mbEeoX82KF++h57GkJ9qxZLjWKhaB9n7E1ieN0s4C4y bDDg== X-Gm-Message-State: AOJu0Yw5HdXJrxMYN3k7DqjsKrmx5hXgymbAqOPs73rSAsaDqmvBLnWg jbnU/GEkKBuACf0Rycd71lMjhZay5TS4nspHX4VY6sPtOH1qBB0zjodHbbynhhzG+YuxAU3jrB3 5nItOF2EZysMFZGI1aUlqZDeUx41QcEUYUieBoyvEW/WhanHzisgvYCmwAApbVACf7ReCoYowom SS+MhPlds5xs30OUcuvw/37syQh3u1wwzKGUiPvRVAf+M= X-Received: by 2002:a05:600c:3c9a:b0:42f:823d:dddd with SMTP id 5b1f17b1804b1-4319ad165cfmr62526225e9.27.1730141621243; Mon, 28 Oct 2024 11:53:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGhsjPspo0gxYAnQj1KUbS1M/5bT4sMWoYzNdal9zt2JTKL35EpLqShwD1cVymNDUTjnI+1sA== X-Received: by 2002:a05:600c:3c9a:b0:42f:823d:dddd with SMTP id 5b1f17b1804b1-4319ad165cfmr62526105e9.27.1730141620835; Mon, 28 Oct 2024 11:53:40 -0700 (PDT) Received: from localhost (197.209.200.146.dyn.plus.net. [146.200.209.197]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-431935a3ea8sm118494345e9.21.2024.10.28.11.53.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Oct 2024 11:53:40 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv2 0/5] Better executable auto-loading when opening a core file Date: Mon, 28 Oct 2024 18:53:33 +0000 Message-Id: X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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 List-Id: In v2: - Fixed an incorrect use of gdb::function_view in patch #1 which was causing undefined behaviour, and crashes when GDB was built with optimisation. - Rebased and retested. --- There's actually a couple of core file related improvements in this series. Patches #1 and #2 improve what information GDB can extract about the execution context (executable name, inferior arguments, and environment) when opening a core file. Then patch #4 improves GDB's ability to auto-load the executable that matches a core file (on GNU/Linux). Patch #3 is a testsuite refactor to allow for patch #4. And patch #5 replicates patch #4, but for FreeBSD. Thanks, Andrew --- Andrew Burgess (5): gdb: add gdbarch method to get execution context from core file gdb: parse and set the inferior environment from core files gdb/testsuite: make some of the core file / build-id tests harder gdb: improve GDB's ability to auto-load the exec for a core file gdb/freebsd: port core file context parsing to FreeBSD gdb/arch-utils.c | 26 ++ gdb/arch-utils.h | 89 +++++ gdb/corefile.c | 10 + gdb/corelow.c | 172 +++++++++- gdb/fbsd-tdep.c | 134 ++++++++ gdb/gdbarch-gen.c | 22 ++ gdb/gdbarch-gen.h | 15 + gdb/gdbarch.h | 1 + gdb/gdbarch_components.py | 20 ++ gdb/linux-tdep.c | 307 ++++++++++++++++++ gdb/testsuite/gdb.base/coredump-filter.exp | 17 +- gdb/testsuite/gdb.base/corefile-buildid.exp | 252 ++++++-------- .../gdb.base/corefile-exec-context.c | 25 ++ .../gdb.base/corefile-exec-context.exp | 165 ++++++++++ gdb/testsuite/gdb.base/corefile-find-exec.c | 25 ++ gdb/testsuite/gdb.base/corefile-find-exec.exp | 252 ++++++++++++++ gdb/testsuite/gdb.base/corefile.exp | 9 + 17 files changed, 1378 insertions(+), 163 deletions(-) create mode 100644 gdb/testsuite/gdb.base/corefile-exec-context.c create mode 100644 gdb/testsuite/gdb.base/corefile-exec-context.exp create mode 100644 gdb/testsuite/gdb.base/corefile-find-exec.c create mode 100644 gdb/testsuite/gdb.base/corefile-find-exec.exp base-commit: a723c56efb07c4f8b3f6a3ed4b878a2f8f5572cc -- 2.25.4