From patchwork Wed Jan 18 16:17:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 63346 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 BAD6D3858417 for ; Wed, 18 Jan 2023 16:18:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BAD6D3858417 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1674058723; bh=rRJaLXSfhEhZ70URiE03Yme6ELdRTEtJ1ojH5Bq/Rww=; 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=svpJTre2qo+vJNnB4EJKJBYmfzi7+sKV2jvbQxl1UDq3PGSkxEhXH+pKa1m6WnPs7 fTUauusGIKftAfc9vzlpvNOmV5fAG5YbUZ+BC6ZOzzLV5Bo9uu4mFDa9NLUdE8QZ1O ATLjQiNPmC1G8oGzT6h6YZHQITM/H2IFyeuDWYEs= 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 3BA263858C52 for ; Wed, 18 Jan 2023 16:18:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3BA263858C52 Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-663-Lo-L9IyuPPaMGqC0RV3g3Q-1; Wed, 18 Jan 2023 11:18:17 -0500 X-MC-Unique: Lo-L9IyuPPaMGqC0RV3g3Q-1 Received: by mail-qk1-f197.google.com with SMTP id bm30-20020a05620a199e00b006ff813575b1so25363292qkb.16 for ; Wed, 18 Jan 2023 08:18:17 -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=rRJaLXSfhEhZ70URiE03Yme6ELdRTEtJ1ojH5Bq/Rww=; b=HRSdEykT4hJ8Q0/2RWBC2oGlSO3ezUWBL9X/xPT813e+wuBnksSsQ5uFqSQIipNOhy cvoT0iHcADP7yWi+WTAyrh2fP0b057X1QGgQQHenmS3gg4AqWFBHd3PuaMC8OjaE3/ho 9w0NHYCgl1hLyOzq5RZyTCRcyljsrSg8ZFb4IH8NygAtmKGM6auG8hhV+FJMdz4/OBIk XLMqplf+Nw+zkTVUtIf4WIafF5qgou7sE9eL5n5WtChRgTrtXmMrEbcHQbF7A0tT4mEl NWrO1v8md2Xn24sS0MSOjhE+YgFjCfqOsXUe34PfBg7DnYfoZfCM3hZOy6TdGmoNJRfu G1cA== X-Gm-Message-State: AFqh2kqEH6t6IfhqeAbBIGBM7BRm5aWJ1PRkd6+9xSoJnkHXQojrHPfy Vw2ReKN+tu+H4mIZqTt0CNdEW7opJyA1siH15Y9zUbUTVHhS+qSynoZq6Dwk8ZbkgFyHzrbxHc+ oRjXZ6kvj18mBLQhOhpaMV/ZpcbgwYXvgXRQSDDQnH1+gPIrzFwP44HYUmLQBI7pxQeFaUobXIQ == X-Received: by 2002:a05:6214:4413:b0:534:6d5c:d5ad with SMTP id oj19-20020a056214441300b005346d5cd5admr11582896qvb.4.1674058696832; Wed, 18 Jan 2023 08:18:16 -0800 (PST) X-Google-Smtp-Source: AMrXdXuHzv6Q5GhWvlBKAoA7LBRDAZKEcVeAUNfDRQl9MLzkqw+choWj98bMaKQ3QIvgZrHAQOZAsw== X-Received: by 2002:a05:6214:4413:b0:534:6d5c:d5ad with SMTP id oj19-20020a056214441300b005346d5cd5admr11582860qvb.4.1674058696465; Wed, 18 Jan 2023 08:18:16 -0800 (PST) Received: from localhost (95.72.115.87.dyn.plus.net. [87.115.72.95]) by smtp.gmail.com with ESMTPSA id y15-20020a05620a0e0f00b006f7ee901674sm22305402qkm.2.2023.01.18.08.18.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Jan 2023 08:18:16 -0800 (PST) To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv2 01/13] gdb/doc: extended documentation for inferior function calls Date: Wed, 18 Jan 2023 16:17:57 +0000 Message-Id: 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.7 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 | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 9c0018ea5c1..e05813ff502 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -20731,6 +20731,36 @@ @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, and the stack is +not unwound (due to @code{set unwind-on-terminating-exception on} or +@code{set unwindonsignal on}), 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