From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 52574 invoked by alias); 31 Aug 2017 22:42:23 -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 52527 invoked by uid 89); 31 Aug 2017 22:42:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_SOFTFAIL autolearn=no version=3.3.2 spammy=hung X-HELO: mail.baldwin.cx Received: from bigwig.baldwin.cx (HELO mail.baldwin.cx) (96.47.65.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 31 Aug 2017 22:42:22 +0000 Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id 6FC7610AF3A; Thu, 31 Aug 2017 18:42:20 -0400 (EDT) From: John Baldwin To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Add a 'starti' command. Date: Thu, 31 Aug 2017 22:42:00 -0000 Message-ID: <5114354.GEl45UTj2G@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <645c49bd-86fb-88c8-e22c-3613a72f2be7@redhat.com> References: <20170829225457.66096-1-jhb@FreeBSD.org> <645c49bd-86fb-88c8-e22c-3613a72f2be7@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-IsSubscribed: yes X-SW-Source: 2017-08/txt/msg00557.txt.bz2 On Thursday, August 31, 2017 11:51:33 PM Pedro Alves wrote: > Hi John, > > On 08/30/2017 12:54 AM, John Baldwin wrote: > > This works like 'start' but it stops at the first instruction rather than > > the first line in main(). This is useful if one wants to single step > > through runtime linker startup. > > I like the idea. I actually once wrote a patch quite similar to this. > I had called the command "create", inspired by "target_create_inferior". > Is there a reason to actually set a breakpoint at the first instruction and > run to it, actually? My old prototype just created the inferior and > didn't resume it all, see: > > https://github.com/palves/gdb/commits/create_command > > though maybe going through normal_stop may be a good idea. I had initially tried something like this (but without the print... line), but GDB hung for me without printing a prompt and accepting more commands. I assumed that there was some additional handling in proceed() that needed to be done. I would probably rather take this approach if it can be made to work though. > I agree with Keith - this should really have some tests. > > For example: > > - write a global constructor that sets a flag, and then check > that the flag is still clear when we're still at the entry point. > This can be either a C++ test or a C test using > __attribute__ ((constructor))- > > - After creating the inferior, check that you can manually set > a break on main, and continue to it. > > - Try backtrace, and check that only one frame comes > out. That may expose buggy unwinders that don't stop > unwinding at the entry point currently, but then that > should be fixed anyway, since users will run into that > too. Hmmm, these are a bit more interesting than the very simple test I've added so far. I'm not very fluent in writing tests yet, but I'll see what I can come up with. -- John Baldwin