From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25964 invoked by alias); 19 Oct 2017 22:13:42 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 25915 invoked by uid 89); 19 Oct 2017 22:13:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=H*M:00db, HX-ClientProxiedBy:sk:BN6PR13, 2625 X-HELO: NAM01-SN1-obe.outbound.protection.outlook.com Received: from mail-sn1nam01on0071.outbound.protection.outlook.com (HELO NAM01-SN1-obe.outbound.protection.outlook.com) (104.47.32.71) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 19 Oct 2017 22:13:38 +0000 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Mike.Gulick@mathworks.com; Received: from [172.28.194.135] (144.212.3.4) by BLUPR0501MB2036.namprd05.prod.outlook.com (10.164.23.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.156.4; Thu, 19 Oct 2017 22:13:35 +0000 Subject: Re: [RFC][PATCH] fix gdb segv when objfile can't be opened To: Simon Marchi Cc: gdb-patches@sourceware.org References: <59E8B251.4050100@mathworks.com> <8c08307a-94ad-92b8-9c8b-c713cad541fd@mathworks.com> <56b1cb34b33613ca4496abfcd28f135a@polymtl.ca> <402f0a7a85cc7c3ba1c26cd296d570a1@polymtl.ca> From: Mike Gulick Message-ID: <32323843-00db-a8ef-efc3-ee2d8a63cd02@mathworks.com> Date: Thu, 19 Oct 2017 22:13:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <402f0a7a85cc7c3ba1c26cd296d570a1@polymtl.ca> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: BN6PR13CA0042.namprd13.prod.outlook.com (10.171.172.28) To BLUPR0501MB2036.namprd05.prod.outlook.com (10.164.23.18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fcb6e19a-04f5-44f0-03ea-08d5173ea418 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017030254172)(4534020)(4602075)(4627075)(201703031133081)(201702281549075)(2017052603199)(201703131423095);SRVR:BLUPR0501MB2036; X-Microsoft-Exchange-Diagnostics: 1;BLUPR0501MB2036;3:gjik1CfbiepgwD1vbfR3HFxugk39yxeUFdNI4lHayXAU4SSZgwgWBYrhrEsy/dNSoUh3IasxVWBOUwBAzJyrUobr1ed90dpjH8MCOrm0MX2oTKNqUN5AYcnn5UfftGxbdrmNubrP0UKqAz5hKK1301JYDOW3YIRpAwL74i31FQRyHtS4jE4kYQKwIZcc4e/mPCUTgUgCkY9p2SH1OnyWtjkXl8i011EUW5b4uO7VwkrE+2xQqCoJyY85vF/9MtEx;25:8pV0z+vcKzFaL1yJRqW2d24kHde8dEVHmSH89HgvZMUAKl4JDatNt8Yq9QcH2AsJhMjueyc66l8u0EYwMejK0J/L+rZw4KnZhOvjJqI+fRm2F7giXtwEl23AgM1fintgpTsncnWEZ1DLkNWNNH/GqwyQ38RaAyQEJ6vxrgxffkXkPwEOc7Ic+Ys4c3RPhcJ/UlGXNfyNVIadXzx0k6VkiQkuWdIL4q8nnFW3A1u8Xfd5PJNbBL/0YPMIQHPQc/RUhPuTckMsLGaWsxH5KG68yfMZfPdtGKK1tCrStIw42H2sphxsZlS6GRiOzhsSDCApdqEphy0gKCBke6p0JhFsZA==;31:TnyNRSfF6mFixNJZo5jm84gR/NvToSoYn637+tX85DMsTundTQbVaqLOjJtew9I8w3SREDg+RxraUVU0UuZXpbfB9WQcfvjiu4vOhMJf8YRWFBKM+U5uekKtNNMTTvccsEEL6EgA3T6hsFWpfxeXBq8P6RaoX9gV4TR4P/i8OHoUcadAipn6wDJqUOL1Q2lPSHShROaQ4p+6Km3lM+4Eo51XxANvCbJguxAKUAqRPGU= X-MS-TrafficTypeDiagnostic: BLUPR0501MB2036: X-Microsoft-Exchange-Diagnostics: 1;BLUPR0501MB2036;20:dPBbA4SldyuypxuJlV/6gSHE+QChzAz7RIJFzMexipEmU3W01BR9Kai4VJMXXJSGwf7ob2+w8AKEFPtevHmOxvgDyeYA3VvSEcIHsD1lsNxhQVdv2xQSCFQli5HyfVnnXaqgm8G8UxdHhcvAaOdVA87PGex7RXK479g3fG7lxa5Wnpe5fUG/VmD1/i9+wEZzf2IQqNTj/TjyN6jtQ1q+pI4zvDKK8QwCDoxW0BU7N3XWvy8sg+y8MZg/9v+Lx6MHJG86/nifBOMhvsiCG5eRkcdUvGxAz5Vzw9IHHAgJREylX5o+OmYCIeEJN9xpPIaMJ993iZYGjVJUDtWNq+1qJbXjO0DYusnpU+BSW9Ip6qPrhfbMAHbZmu+xneiE/84kNeSRSsXzfcGSX827U1lFpR5kus7dIkGd9y1xq+pr9EhpJmG6U397i9JNyNGoAwg8ITDBXQF61kcDsjT48P/NZ9kRN59031bREvDfWKgHYpQvG0vR1Ge7SHsXhELRhijC;4:mdrdaswMr/ghGP8Io0RcHlOOB/fygJ3DdLV796BInz5NB6cEJA+oTBlviPMAEg5nT+aKuFqKA3h8vpgzh1fAu180X2gNOnjjI6mdN+rC2Ra0i/ddsL9VptAp2ONowPRulrOcksoEqJ+SNQZSXtoV2i5Eiruo8n54G2YaFYAlSJylaMF73MTUpeF8MP+MY66Bgj9D3l7f0vW+OXnJ3DRwM4TzXDgcBM9Zw2Dv7nA4jKXZyn+Pz+B80UDlW//OyhQ0 X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(10201501046)(100000703101)(100105400095)(93006095)(93001095)(3002001)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123562025)(20161123558100)(20161123564025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:BLUPR0501MB2036;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:BLUPR0501MB2036; X-Forefront-PRVS: 0465429B7F X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(979002)(6049001)(6009001)(346002)(376002)(189002)(199003)(24454002)(7736002)(36756003)(8936002)(68736007)(189998001)(72206003)(25786009)(6116002)(305945005)(33646002)(229853002)(3846002)(101416001)(16526018)(575784001)(86362001)(23676002)(81156014)(83506002)(81166006)(6916009)(8676002)(65826007)(6666003)(230700001)(5660300001)(2950100002)(478600001)(31686004)(6246003)(53546010)(64126003)(50466002)(106356001)(105586002)(2906002)(93886005)(97736004)(4326008)(47776003)(65806001)(65956001)(66066001)(90366009)(31696002)(77096006)(54356999)(6486002)(76176999)(50986999)(16576012)(316002)(58126008)(53936002)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1101;SCL:1;SRVR:BLUPR0501MB2036;H:[172.28.194.135];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; Received-SPF: None (protection.outlook.com: mathworks.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCTFVQUjA1MDFNQjIwMzY7MjM6MnJqS1RlTXdlcXVSb0V0eThrOSt0bi9O?= =?utf-8?B?c1RUR3dSQzhqdmZtc2NmTzJjUm11VzJPNCswTjJBS1lSSnJybnphR0dPNDlG?= =?utf-8?B?WE42S2FNVW8wT2Jicz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riginatorOrg: mathworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2017 22:13:35.0304 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fcb6e19a-04f5-44f0-03ea-08d5173ea418 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 99dd3a11-4348-4468-9bdd-e5072b1dc1e6 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0501MB2036 X-SW-Source: 2017-10/txt/msg00651.txt.bz2 On 10/19/2017 04:09 PM, Simon Marchi wrote: > Indeed, "error" throws an exception. You should be able at least to step into the error function (although it's not particularly useful nor interesting). It is defined in common/errors.c. > Thanks. I looked at the stack when stopped on 'error', and I see that there is a TRY/CATCH in 'frame_unwind_try_unwinder'. That doesn't handle the exception, and just re-throws it. It looks like the exception is ultimately caught in 'print_stack_frame', which explains why the stack frame is never printed when the exception is thrown (although it's still unclear why the message passed to 'error' isn't printed). Here is the top half of the stack: #0 gdb_bfd_map_section (sectp=0x31e4eb8, size=0x31ddc58) at gdb_bfd.c:708 #1 0x0000000000628b15 in dwarf2_read_section (objfile=0x31c0be0, info=0x31ddc48) at dwarf2read.c:2553 #2 0x0000000000628e8b in dwarf2_get_section_info (objfile=0x31c0be0, sect=DWARF2_EH_FRAME, sectp=0x31ddf20, bufp=0x31ddf10, sizep=0x31ddf18) at dwarf2read.c:2634 #3 0x0000000000611616 in dwarf2_build_frame_info (objfile=0x31c0be0) at dwarf2-frame.c:2222 #4 0x0000000000610262 in dwarf2_frame_find_fde (pc=0x7ffd1fc37ad0, out_offset=0x0) at dwarf2-frame.c:1707 #5 0x000000000060f874 in dwarf2_frame_sniffer (self=0xa2c480 , this_frame=0x2fceb60, this_cache=0x2fceb78) at dwarf2-frame.c:1337 #6 0x00000000006913cc in frame_unwind_try_unwinder (this_frame=0x2fceb60, this_cache=0x2fceb78, unwinder=0xa2c480 ) at frame-unwind.c:106 #7 0x0000000000691598 in frame_unwind_find_by_frame (this_frame=0x2fceb60, this_cache=0x2fceb78) at frame-unwind.c:164 #8 0x000000000068fe3c in get_frame_type (frame=0x2fceb60) at frame.c:2625 #9 0x000000000077404e in print_frame_info (frame=0x2fceb60, print_level=0, print_what=SRC_AND_LOC, print_args=1, set_current_sal=1) at stack.c:795 #10 0x00000000007729b0 in print_stack_frame (frame=0x2fceb60, print_level=0, print_what=SRC_AND_LOC, set_current_sal=1) at stack.c:177 #11 0x00000000006d3ee5 in print_stop_location (ws=0x7ffd1fc37db0) at infrun.c:8041 #12 0x00000000006d3f5b in print_stop_event (uiout=0x30f1900) at infrun.c:8058 ... >> I was also >> unable to figure out why the error message isn't displayed. The new >> reproducer shows this issue. I wasn't sure if setting *size or even >> descriptor->size was the right thing to do, but it seemed reasonable to >> me since the comment in gdb_bfd.h states that this function updates >> *size. There's currently only one caller for 'gdb_bfd_map_section', so >> I have no problem updating *size there if that is preferred. > > Actually it says "If successful, the section data is returned and *SIZE is set to the size of the section data;". And this is what I would generally expect from functions. Unless stated otherwise, the value of output parameters should be considered undefined if the function failed. So I would lean towards blaming the caller for not taking enough precautions. It trusts that gdb_bfd_map_section won't fail. > I'm not sure how the gdb_bfd_map_section caller can pre-determine that it will fail. It looks like there may be situations where gdb_bfd_map_section doesn't actually need to read the file, so that would mean that simply checking if the object file is readable before calling gdb_bfd_map_section might not be a good way to address this. Outside of that, I don't see what pre-conditions I can check to determine if gdb_bfd_map_section is going to fail in this case. Do you have any suggestions? To add a little more info, the segfault happens after trying to run 'next' in the debugger after this error is thrown. Here is a snippet of the stack: #0 0x000000000083b3e1 in bfd_getl32 (p=0x0) at libbfd.c:557 #1 0x000000000060fb3e in read_initial_length (abfd=0x31805e0, buf=0x0, bytes_read_ptr=0x7ffd1fc3797c) at dwarf2-frame.c:1482 #2 0x0000000000610592 in decode_frame_entry_1 (unit=0x31ddf40, start=0x0, eh_frame_p=1, cie_table=0x7ffd1fc37b00, fde_table=0x7ffd1fc37af0, entry_type=EH_CIE_OR_FDE_TYPE_ID) at dwarf2-frame.c:1792 #3 0x00000000006111b5 in decode_frame_entry (unit=0x31ddf40, start=0x0, eh_frame_p=1, cie_table=0x7ffd1fc37b00, fde_table=0x7ffd1fc37af0, entry_type=EH_CIE_OR_FDE_TYPE_ID) at dwarf2-frame.c:2090 #4 0x00000000006116d1 in dwarf2_build_frame_info (objfile=0x31c0be0) at dwarf2-frame.c:2247 #5 0x0000000000610262 in dwarf2_frame_find_fde (pc=0x7ffd1fc37d30, out_offset=0x2fcec58) at dwarf2-frame.c:1707 #6 0x000000000060ead3 in dwarf2_frame_cache (this_frame=0x2fceb60, this_cache=0x2fceb78) at dwarf2-frame.c:1000 #7 0x000000000060f2d7 in dwarf2_frame_this_id (this_frame=0x2fceb60, this_cache=0x2fceb78, this_id=0x2fcebc0) at dwarf2-frame.c:1198 #8 0x000000000068baab in compute_frame_id (fi=0x2fceb60) at frame.c:505 #9 0x000000000068bbf7 in get_frame_id (fi=0x2fceb60) at frame.c:537 #10 0x00000000006bee4e in step_command_fsm_prepare (sm=0x3175e10, skip_subroutines=1, single_inst=0, count=1, thread=0x3162ac0) at infcmd.c:1056 #11 0x00000000006bef73 in step_1 (skip_subroutines=1, single_inst=0, count_string=0x0) at infcmd.c:1096 #12 0x00000000006bed3f in next_command (count_string=0x0, from_tty=1) at infcmd.c:969 ... dwarf2_build_frame_info first checks if unit->dwarf_frame_size is non-zero (it is), then it calls decode_frame_entry on unit->dwarf_frame_buffer. unit->dwarf_frame_buffer is null, which triggers the segfault. Adding checks in dwarf2_build_frame_info to check that dwarf_frame_buffer is non-zero (which needs to be done in two places) also prevents the crash. However, this doesn't address the issue that the stack frame info isn't printed when the initial breakpoint is hit (because gdb_bfd_map_section throws an error). It would be nice if this could be gracefully handled so that the current frame and source code line are printed instead of just dumping you back to a (gdb) prompt without knowing where you are. Since my patch changes the error to a warning, and updates the size pointer, it fixes both of these issues. I can imagine two alternatives: - Change the error to a warning, and make the caller of gdb_bfd_map_section check if the returned pointer is NULL, and if so set *size to 0. This requires the ugly-ish early return that I had to add in gdb_bfd_map_section. - Add a TRY/CATCH around dwarf2_read_section in dwarf2_get_section_info, that sets *sectp, *bufp, and *sizep to NULL. I'm not sure if I should then re-throw the exception. Thanks, Mike