This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Add a 'starti' command.
- From: Pedro Alves <palves at redhat dot com>
- To: John Baldwin <jhb at FreeBSD dot org>, gdb-patches at sourceware dot org
- Date: Thu, 31 Aug 2017 23:51:33 +0200
- Subject: Re: [PATCH] Add a 'starti' command.
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=palves at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C3CD081DE8
- References: <20170829225457.66096-1-jhb@FreeBSD.org>
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 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.
Thanks,
Pedro Alves