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 ESMTPS id 557333858D20 for ; Wed, 9 Nov 2022 16:22:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 557333858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1668010972; 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=D5iHsq/b/9N9dsWkJbyBz6GO0RWqqLi/mkbgekTgHnc=; b=PRZAM3d6gt3cxqykbj8i8V0TLc4v6m+eztd5WGwGcHFX2fxds1dlijpG0uepVoqQ4Yj2A6 beGcVLoP0vJbu7neYy2NqxJF2IDfzOsiYGnxFEL4oHkB0nTn9fEA6U2xX69mruzmCxWntS DraXeiSgdXumy757NfCAKXPxu+p8Mtg= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-604-pPg8FBM5NACUX1Ei48tEig-1; Wed, 09 Nov 2022 11:22:48 -0500 X-MC-Unique: pPg8FBM5NACUX1Ei48tEig-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 31A5487B2A1; Wed, 9 Nov 2022 16:22:38 +0000 (UTC) Received: from f35-zws-nvidia (unknown [10.2.17.47]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 589AA1121320; Wed, 9 Nov 2022 16:22:37 +0000 (UTC) Date: Wed, 9 Nov 2022 09:22:34 -0700 From: Kevin Buettner To: Lancelot SIX Cc: gdb-patches@sourceware.org, Subject: Re: [PATCH] Fix stepping in rtld without debug symbol Message-ID: <20221109092234.6a39e230@f35-zws-nvidia> In-Reply-To: <20221104182634.3726422-1-lancelot.six@amd.com> References: <20221104182634.3726422-1-lancelot.six@amd.com> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 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_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 List-Id: On Fri, 4 Nov 2022 18:26:34 +0000 Lancelot SIX wrote: > Commit be6276e0aed "Allow debugging of runtime loader / dynamic linker" > introduced a small regression when stepping into the runtime loader / > dynamic linker from function we do not have debug information for. This > is reported in PR/29747. > > This can be shown by the following example (given by Simon Marchi in > buzilla bug report): > > $ cat test.c > #include > > int main() > { > printf("Hi\n"); > return 0; > } > $ gcc test.c -O0 -o test > $ ./gdb -q -nx --data-directory=data-directory test -ex start -ex s > Reading symbols from test... > (No debugging symbols found in test) > Temporary breakpoint 1 at 0x1151 > Starting program: .../binutils-gdb/gdb/test > [Thread debugging using libthread_db enabled] > Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". > > Temporary breakpoint 1, 0x0000555555555151 in main () > Single stepping until exit from function main, > which has no line number information. > /home/smarchi/src/binutils-gdb/gdb/infrun.c:6960:64: runtime error: member call on null pointer of type 'struct symbol' > > The crash happens here: > > #0 __sanitizer::Die () at ../../../../src/libsanitizer/sanitizer_common/sanitizer_termination.cpp:50 > #1 0x00007ffff5dd7128 in __ubsan::__ubsan_handle_type_mismatch_v1_abort (Data=, Pointer=) at ../../../../src/libsanitizer/ubsan/ubsan_handlers.cpp:148 > #2 0x000055556183e1a7 in process_event_stop_test (ecs=0x7fffffffccd0) at .../binutils-gdb/gdb/infrun.c:6960 > #3 0x0000555561838ea4 in handle_signal_stop (ecs=0x7fffffffccd0) at .../binutils-gdb/gdb/infrun.c:6615 > #4 0x000055556182f77b in handle_inferior_event (ecs=0x7fffffffccd0) at .../binutils-gdb/gdb/infrun.c:5866 > > When evaluating: > > 6956 if (execution_direction != EXEC_REVERSE > 6957 && ecs->event_thread->control.step_over_calls == STEP_OVER_UNDEBUGGABLE > 6958 && in_solib_dynsym_resolve_code (ecs->event_thread->stop_pc ()) > 6959 && !in_solib_dynsym_resolve_code ( > 6961 ecs->event_thread->control.step_start_function->value_block () > 6962 ->entry_pc ())) > > we dereference, ecs->event_thread->control.step_start_function which is > nullptr. > > This patch changes this condition so it evaluates to true if > ecs->event_thread->control.step_start_function is nullptr since this > matches the behaviour before be6276e0aed. Thanks for fixing this! I see that Bruno has asked for the test case to be tweaked and your reply that you've fixed it in your local sources. That being the case... Approved-By: Kevin Buettner Kevin