From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21643 invoked by alias); 21 Jan 2015 01:42:47 -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 21631 invoked by uid 89); 21 Jan 2015 01:42:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mail-ob0-f171.google.com Received: from mail-ob0-f171.google.com (HELO mail-ob0-f171.google.com) (209.85.214.171) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 21 Jan 2015 01:42:42 +0000 Received: by mail-ob0-f171.google.com with SMTP id va2so27632088obc.2 for ; Tue, 20 Jan 2015 17:42:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=OyrafHPp2dlCcJxrd7tEBIsf4He6/lQLMaLiLZT6dLI=; b=M6sXG6ft7wX1zrtY+HMtIy/+UgBVcGuOqm6Bg4mf7L1JyGIGeVzYdl8z8QRIBHIKzG bAYoERU/wljxyn9ONpExotZG33314jyukLIj2Y5nwyyCPGP9FY5ke69GZ/LyVWBXVLG4 x5SuiVrGOKUmLdD0roUZZpXwj1qqsaUERON7xAfimMjp+DMHt9k0TSGOb+bCYh3RccXK /cHKP/o+DvfRvA16o8Z9Qafxk7BF4hn83Yddo3b5XVeUFS5Fa6gqroubH5P2gQojCwaS t8QDq3WuFX6oMkK56MOQdpVzKbl7n0eKLRjov9T4xzHYI5OeqSZ5t2VFffOKBT90Ae7P hvcA== X-Gm-Message-State: ALoCoQmmuosp0lm8xoBOoe9jUvRWgKCfFc7v+I8Pr4G3VJ8Wh/02sdkAiQ0rYRDDFOIOQzaFU9KK MIME-Version: 1.0 X-Received: by 10.182.234.15 with SMTP id ua15mr23030432obc.77.1421804561023; Tue, 20 Jan 2015 17:42:41 -0800 (PST) Received: by 10.182.222.98 with HTTP; Tue, 20 Jan 2015 17:42:40 -0800 (PST) In-Reply-To: <1421340032-30709-1-git-send-email-simon.marchi@ericsson.com> References: <1421340032-30709-1-git-send-email-simon.marchi@ericsson.com> Date: Wed, 21 Jan 2015 01:42:00 -0000 Message-ID: Subject: Re: [PATCH] Introduce gdb_interact in testsuite From: Doug Evans To: Simon Marchi Cc: gdb-patches Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-01/txt/msg00559.txt.bz2 On Thu, Jan 15, 2015 at 8:40 AM, Simon Marchi wrote: > > gdb_interact is a small utility that we have found quite useful to debug > test cases. > > Putting gdb_interact in a test suspends it and allows to interact with > gdb to inspect whatever you want. You can then type ">>>" to resume the > test execution. Of course, this is only for gdb devs. It wouldn't make > sense to leave a gdb_interact permanently in a test case. > > When starting the interaction with the user, the script prints this > banner: > > +------------------------------------------+ > | Script interrupted, you can now interact | > | with by gdb. Type >>> to continue. | > +------------------------------------------+ > > Notes: > * When gdb is launched, the gdb_spawn_id variable (lib/gdb.exp) is > assigned -1. Given the name, I would expect it to contain the gdb > expect spawn id, which is needed for interact. I changed all places > that set gdb_spawn_id to -1 to set it to the actual gdb spawn id > instead. > > * When entering the "interact" mode, the last (gdb) prompt is already > eaten by expect, so it doesn't show up on the terminal. Subsequent > prompts do appear though. We tried to print "(gdb)" just before the > interact to replace it. However, it could be misleading if you are > debugging an MI test case, it makes you think that you are typing in a > CLI prompt, when in reality it's MI. In the end I decided that since > the feature is for developers who know what they're doing and that one > is normally consciously using gdb_interact, the script doesn't need > to babysit the user. > > * There are probably some quirks depending on where in the script > gdb_interact appears (e.g. it could interfere with following > commands and make them fail), but it works for most cases. Quirks can > always be fixed later. > > The idea and original implementation was contributed by Anders > Granlund, a colleague of mine. Thanks to him. > > gdb/testsuite/ChangeLog: > > * gdb.base/statistics.exp: Assign spawn id to gdb_spawn_id. > * gdb.base/valgrind-db-attach.exp: Same. > * gdb.base/valgrind-infcall.exp: Same. > * lib/mi-support.exp (default_mi_gdb_start): Same. > * lib/prompt.exp (default_prompt_gdb_start): Same. > * lib/gdb.exp (default_gdb_spawn): Same. > (gdb_interact): New. [Apologies for the resend.] I'm not sure why we're assigning -1 instead of a usable value, but I can't find anything to suggest assigning a real id will cause problems. Plus given how trivial gdb_interact is, the patch is fine by me. Another way such things are debugged is by first running tests with TRANSCRIPT=y, and then massaging the transcript.N files afterwards. I'm all for adding more ways of debugging tests. Thanks!