From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id YxXjIqhU2WOiayYAWB0awg (envelope-from ) for ; Tue, 31 Jan 2023 12:49:28 -0500 Received: by simark.ca (Postfix, from userid 112) id 7B80C1E128; Tue, 31 Jan 2023 12:49:28 -0500 (EST) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=NdGeyeYL; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, RDNS_DYNAMIC,URIBL_BLOCKED,WEIRD_PORT autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id F1C0E1E112 for ; Tue, 31 Jan 2023 12:49:27 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 33C1E3858C50 for ; Tue, 31 Jan 2023 17:49:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 33C1E3858C50 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675187366; 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=NdGeyeYLo8L9q5qCjizhs15+GgyIecJ+DuappHFSG0jPK7pSumlYaee+GTqCvbk5s b53mNOWjPSdOwjDPaK9QjF/dveHa+PWPUEqlvjETcRgGECx0V2+IIFZWQcObPZHdio dqLmcrbB0B6eOc+ThyxR/N73/rvubd58X0Q7s4Ks= 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 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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: , From: Andrew Burgess via Gdb-patches Reply-To: Andrew Burgess Errors-To: gdb-patches-bounces+public-inbox=simark.ca@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 -- 2.25.4