From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id Uc4eE838OGpALhMAWB0awg (envelope-from ) for ; Mon, 22 Jun 2026 05:13:49 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=HqD+63Rg; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 4902B1E098; Mon, 22 Jun 2026 05:13:49 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=unavailable autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id C54C11E024 for ; Mon, 22 Jun 2026 05:13:48 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6FB054BA543C for ; Mon, 22 Jun 2026 09:13:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6FB054BA543C Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=HqD+63Rg Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by sourceware.org (Postfix) with ESMTPS id 4FA974BA5435 for ; Mon, 22 Jun 2026 09:13:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4FA974BA5435 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4FA974BA5435 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::102f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1782119598; cv=none; b=KPSrrlDhb/6h7Mz3cchB3mB7pqgplhCCrXQT9gZCiGbClR8hJRGifSsKQgjgyrTc+3UD0bbEUp5f7C2B7ip7kpP7nu9jE3df3T6i7guQdIAMu4Ad4DVQDTUiCW7iWB/FyMt9gAzU8V95azvNhc5vVqEY+z9t/cV3fZL+CPrztDU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1782119598; c=relaxed/simple; bh=LFJqOsbNxUp4TNuVyMh1DHG1vrPIEc6ty3nFtxFewwo=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=DZbypeWTclNYRR0DonvnWDPqoxWVrLJN8VQS8j1UAZ8DE8CJBoAgx24ztm0BdWGUkbEjK4GVu72siz3aIWTUqWdtwm0QwQ4We6BjYojFgPcPD7peUTd+dzPzsJprT6T96BBtiHVTesfxILjIHbEHhqk++5ghjTJIEXzKIFNJZco= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=HqD+63Rg DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4FA974BA5435 Received: by mail-pj1-x102f.google.com with SMTP id 98e67ed59e1d1-37c867bd3e0so1957108a91.0 for ; Mon, 22 Jun 2026 02:13:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782119597; x=1782724397; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=3/wSKcqXFG7NOqNQJHby5g5c4hGVaD8U+Nu0WGBORho=; b=HqD+63RgOvyGkxwIYS9OWn4d6YZgFL1In34T7i1KTz81e3EomyeyCmAdN+9RUme6Bm 7f5oFdLrnW6c4FrGFZppRAGO57PB0eKcexiG6PC5VkxEnicXknq/st/n3XEbvlGEsWWI BjhpdZkMwXhgNQfbDJzezEhOhF45r/iTyFqkjygjCq324x1BcY7VD65+ag07KnU/yWdF 9V0bXsMjJNaMU1EpUX0cbeamd5jHPiNeU+w5EvF7MbY8txnfU0Y+K+LOVEQpMaDKtpD4 3LeiOqNbUfMYRi2+GWwLXb08yjGtQgSA7qCEmqUoWnUWbXftlQrTvnfNmOicrNcqHmRe qTwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782119597; x=1782724397; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=3/wSKcqXFG7NOqNQJHby5g5c4hGVaD8U+Nu0WGBORho=; b=UdaroDdVoB05xNA6QHtmxZlvpH2tNPjiC96Q1n6dKFC6nEt9VDqOoMxK1n7pbwZEhB OMr8+uD22BfiyEFPhpX6ZxpQpBpf8TrokS9Z0r+sRbnkyMjFw0B9uvy3q4DkGqCQ1DMK 3XT5elEKS8FrDskfJeSpQ5mRDCSMRiyIqW8pkCqxVFogRAIYAsgd6wTVvELbM8/ARfu5 RcttQFFJ+8r3kAjSVs6FyoM8p6zOGlCSDKxi03MbLSYItwVDaiMIkb1OQ9Tv6vVp5/1P vIqa3xouTt4hh08kMbVwav+xDSibLzRp1CnEPA3NZll3J6UzUZpFj7gptf5zXzCEYxzy /pEg== X-Gm-Message-State: AOJu0YzK+9NIpn1P+37Bio47jVp/Se+oMVMZJPzxNoJJI6NF3E5cV/8G 4bQvzbgHpOuu6mq3vbwx9J7cuk4nxaVaNjZCWZpBpNAZMMVUHxyLbEHZ X-Gm-Gg: AfdE7clzg44SaOT3emVGVUWBYiy8Tdj+opNauV+qs3PcSWlO4sSLwV96KKSCXBCEA9p 9flE3k0oZyrR7W25+2EZ6x9Pi9ePXEz+Sk/D7+De90HZtTXwl/kPNCBxQCycslrI0oYZikxfDVg 3GRHhpuO9FGvNQLf/EWpSKyV45hBcoJXoK8tOJKCN0kIO3h0X4D7Ihh+npuLDEhfkKNeJ5XM/9E 6vVUVgxB8zSjpemN+kVefRJMsvRlXvPoY/6t4HqnjPRiAlh3uCpgfXi+94Z5d7ioiWq8nhRa162 q2Nklg3IHdJlSwN3kUYC6X8sIPctJWdS1sW9T3BjMO1t5K4tPyijxtTCPguiol+S/hsA7sobY+l Ny5FV89usBi6qp8cnR9/PmQtnfeftxCObLn3eQMeVstrZMCMXOAZAaINSzWEqIrvJUqKZxG0Wiv 94hNkA1E3yApUtB6j3mRGCT1E9F/G/DzHOzHGe3cSM1AZMPGoY1vs= X-Received: by 2002:a17:90b:350a:b0:37d:8426:40de with SMTP id 98e67ed59e1d1-37d842640f7mr4110942a91.1.1782119597172; Mon, 22 Jun 2026 02:13:17 -0700 (PDT) Received: from dhcp-9-123-15-62.bl1-in.ibm.com ([129.41.58.6]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-37d4f2f098dsm6186274a91.13.2026.06.22.02.13.14 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 22 Jun 2026 02:13:16 -0700 (PDT) From: Aditya Vidyadhar Kamath To: ulrich.weigand@de.ibm.com, simon.marchi@polymtl.ca, tom@tromey.com Cc: gdb-patches@sourceware.org, Aditya.Kamath1@ibm.com, sangamesh.swamy@in.ibm.com, PRAJWAL.B.MEHENDARKAR@ibm.com Subject: [PATCH] Fix crash in AIX when current working directory is NULL Date: Mon, 22 Jun 2026 14:41:15 +0530 Message-ID: <20260622091114.18783-2-akamath996@gmail.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org From: Aditya Kamath In AIX if we cannot read in the current directory we get, gdb ~/gdb_tests/simple_test gdb: warning: error finding working directory: A parameter must be a directory. GNU gdb (GDB) 18.0.50.20260619-git Copyright (C) 2026 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "powerpc64-ibm-aix7.2.0.0". Type "show configuration" for configuration details. For bug reporting instructions, please see: . +------------------------------------------------------------------------------+ | Find the GDB manual online at: | | http://www.gnu.org/software/gdb/documentation/. | | For help, type "help". | | Type "apropos word" to search for commands related to "word". | +------------------------------------------------------------------------------+ Reading symbols from //gdb_tests/simple_test... terminate called after throwing an instance of 'std::logic_error' what(): basic_string: construction from null is not valid Fatal signal: IOT/Abort trap ----- Backtrace ----- 0x100943f1b gdb_internal_backtrace_1 //home/binutils-gdb/gdb/bt-utils.c:122 0x100944027 _Z22gdb_internal_backtracev //home/binutils-gdb/gdb/bt-utils.c:173 0x10060faa7 handle_fatal_signal //home/binutils-gdb/gdb/event-top.c:1008 0x4fdf ??? --------------------- A fatal error internal to GDB has been detected, further debugging is not possible. GDB will now terminate. This is a bug, please report it. For instructions, see: . ============================= The reason for the same above is that in AIX, the variable current_directory in dwarf2/read.c can be NULL if getcwd () fails during GDB initialisation. When this happens the dwarf2_per_bfd construction initialisation list captured_cwd to NULL resulting in this segmentation fault shown above. There are two reasons this happened: 1: The current working directory got deleted in another terminal. 2: Insufficient permission to read the current directory or its parent/predicissor directory. This patch is a fix to the same. Afer this fix we get GDB loaded correctly. gdb ~/gdb_tests/simple_test gdb: warning: error finding working directory: A parameter must be a directory. GNU gdb (GDB) 18.0.50.20260619-git Copyright (C) 2026 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "powerpc64-ibm-aix7.2.0.0". Type "show configuration" for configuration details. For bug reporting instructions, please see: . +------------------------------------------------------------------------------+ | Find the GDB manual online at: | | http://www.gnu.org/software/gdb/documentation/. | | For help, type "help". | | Type "apropos word" to search for commands related to "word". | +------------------------------------------------------------------------------+ Reading symbols from //gdb_tests/simple_test... (gdb) q --- gdb/dwarf2/read.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 84b1480dbcb..7962acc784d 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -859,7 +859,7 @@ dwarf2_per_bfd::dwarf2_per_bfd (bfd *obfd, const dwarf2_debug_sections *names, bool can_copy_) : obfd (obfd), can_copy (can_copy_), - captured_cwd (current_directory), + captured_cwd (current_directory == NULL ? "" : current_directory), captured_debug_dir (debug_file_directory) { if (names == NULL) -- 2.51.2