From patchwork Tue Jan 31 17:27:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 64027 Return-Path: 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 17A3E3858438 for ; Tue, 31 Jan 2023 17:49:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 17A3E3858438 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675187370; bh=GM+gpQWNaF082Wnc8jC/iYjI+Cs6aWV4B/kEe/bQtVM=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=sN9upf10swDwNU/writH4+ytIwLjAvuRO/2+S6L0HMR1Y1u4UERTiApVT/QBbYpzi FRd3iEds4aFiT/fuSPateVUtrBsflFZzPxjX9NW8qZB1iT+PobGQzyr3M9X2tMyT9c R7u7TlZzjeJ3/G0DWe+abKnIPHnW9xCRNUQx3m2E= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 25C3D3858D33 for ; Tue, 31 Jan 2023 17:49:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 25C3D3858D33 Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-564-7y8f8GUUPZilAKDciU2_lQ-1; Tue, 31 Jan 2023 12:27:24 -0500 X-MC-Unique: 7y8f8GUUPZilAKDciU2_lQ-1 Received: by mail-qk1-f198.google.com with SMTP id q13-20020a37f70d000000b007283b33bfb3so405123qkj.4 for ; Tue, 31 Jan 2023 09:27:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=GM+gpQWNaF082Wnc8jC/iYjI+Cs6aWV4B/kEe/bQtVM=; b=7O38cCPlQoYPy+DPxY+vb0DTIRBm6Zoiji8sX22LyXXA+zN8puvG/ojLX7HgORwcx1 tl46KDI0sY5BT+rBc7c9u+Rd6dDRxEurKCaXGLWNfvpcfJiMjXxE+MefqaESKRpXFuAE 5o2zgfS8vSzrdf+dYaGOxnm3UINuX8+ol3rhg9grdMJePqgeAvL6C2KPyQlLK+MD1uZC iL+2Qw4oQqNNiu1DYLvpYA/XR+4Agt3k8kvjwNw9MSFzTfOBCEdzXqUtVt2o4V2R4yPE 3GOmYc9/VMwHgu/cmihyv4JAjJms3PGirTCGRRuoXwSx1A+BQfrhOVAAWJzX/zFPs8Ts vxbw== X-Gm-Message-State: AO0yUKVMQYLrmTfzgBWIzTzJcAQpRiLh3qbqQxA2mfsFlsWOBF1pbOn/ AC/K7MjUWo+jTm/Ts3rTM+AQkOiTR7nxKdhE6fptliCkiZHgYSzs/BayISrA2QsWerbUcsEq96l vScLEEZL4ZHujuYUVsD9t5Tj1ZYTbvWTQ+KfXtmo3irY2bWMoQUXQK95J1m4D9UXHLssE4DVVJw == X-Received: by 2002:a05:622a:610:b0:3b8:5ad9:3fe8 with SMTP id z16-20020a05622a061000b003b85ad93fe8mr17721727qta.48.1675186043423; Tue, 31 Jan 2023 09:27:23 -0800 (PST) X-Google-Smtp-Source: AK7set/Qt2GGwcKjc52EbDSwZMiVFlxL8QVmrDDbn2gUcbGRuNeu7zyXMahaDCQN4FTDCjkmX2EhnQ== X-Received: by 2002:a05:622a:610:b0:3b8:5ad9:3fe8 with SMTP id z16-20020a05622a061000b003b85ad93fe8mr17721686qta.48.1675186043092; Tue, 31 Jan 2023 09:27:23 -0800 (PST) Received: from localhost (95.72.115.87.dyn.plus.net. [87.115.72.95]) by smtp.gmail.com with ESMTPSA id v3-20020ac87283000000b003b62e9c82ebsm10178671qto.48.2023.01.31.09.27.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Jan 2023 09:27:22 -0800 (PST) To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv3 01/13] gdb/doc: extended documentation for inferior function calls Date: Tue, 31 Jan 2023 17:27:06 +0000 Message-Id: <69209dfdfad2e171fd8015c7ca4741e591416d44.1675185990.git.aburgess@redhat.com> 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 X-Spam-Status: No, score=-11.8 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, WEIRD_PORT 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: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Andrew Burgess via Gdb-patches From: Andrew Burgess Reply-To: Andrew Burgess Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" I noticed that the documentation for inferior function calls doesn't say much about what happens if/when an inferior function call is interrupted, i.e. it doesn't describe what the dummy frame looks like on the stack, or how GDB behaves when the inferior is continued and reaches the dummy frame. This commit aims to add some of this missing information. --- gdb/doc/gdb.texinfo | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 03033c7f9e3..682f85387e5 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -20708,6 +20708,7 @@ in that case is controlled by the @code{set unwind-on-terminating-exception} command. +@anchor{stack unwind settings} @table @code @item set unwindonsignal @kindex set unwindonsignal @@ -20765,6 +20766,37 @@ @end table +When calling a function within a program, it is possible that the +program could enter a state from which the called function may never +return. If this happens then it is possible to interrupt the function +call by typing the interrupt character (often @kbd{Ctrl-c}). + +If a called function is interrupted for any reason, including hitting +a breakpoint, or triggering a watchpoint, and the stack is not unwound +due to @code{set unwind-on-terminating-exception on} or @code{set +unwindonsignal on} (@pxref{stack unwind settings}), +then the dummy-frame, created by @value{GDBN} to facilitate the call +to the program function, will be visible in the backtrace, for example +frame @code{#3} in the following backtrace: + +@smallexample +(@value{GDBP}) backtrace +#0 0x00007ffff7b3d1e7 in nanosleep () from /lib64/libc.so.6 +#1 0x00007ffff7b3d11e in sleep () from /lib64/libc.so.6 +#2 0x000000000040113f in deadlock () at test.cc:13 +#3 +#4 breakpt () at test.cc:20 +#5 0x0000000000401151 in main () at test.cc:25 +@end smallexample + +At this point it is possible to examine the state of the inferior just +like any other stop. + +Depending on why the function was interrupted then it may be possible +to resume the inferior (using commands like @code{continue}, +@code{step}, etc). In this case, when the inferior finally returns to +the dummy-frame, @value{GDBN} will once again halt the inferior. + @subsection Calling functions with no debug info @cindex no debug info functions