This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v3 4/9] Explicit locations: introduce address locations
- From: Keith Seitz <keiths at redhat dot com>
- To: Doug Evans <xdje42 at gmail dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 07 May 2015 10:05:13 -0700
- Subject: Re: [PATCH v3 4/9] Explicit locations: introduce address locations
- Authentication-results: sourceware.org; auth=none
- References: <20150217220619 dot 1312 dot 39861 dot stgit at valrhona dot uglyboxes dot com> <20150217220646 dot 1312 dot 56251 dot stgit at valrhona dot uglyboxes dot com> <m3zj7wjusq dot fsf at sspiff dot org>
On 03/01/2015 01:02 PM, Doug Evans wrote:
> Keith Seitz <keiths@redhat.com> writes:
>> +/* Convert the given ADDRESS into SaLs. */
>> +
>> +static struct symtabs_and_lines
>> +convert_address_location_to_sals (struct linespec_state *self,
>> + CORE_ADDR address)
>> +{
>> + struct symtab_and_line sal;
>> + struct symtabs_and_lines sals = {NULL, 0};
>> +
>> + sal = find_pc_line (address, 0);
>> + sal.pc = address;
>> + sal.section = find_pc_overlay (address);
>> + sal.explicit_pc = 1;
>> + add_sal_to_sals (self, &sals, &sal, core_addr_to_string (address), 1);
>> +
>> + if (self->canonical != NULL)
>> + self->canonical->location = new_address_location (address);
>
> ====
> Modifying self->canonical->location is an undocumented side-effect.
> Can you augment the function comment to document and explain this?
In general, all of the convert_*_location_to_sals functions will
canonicalize the location into linespec_state.canonical.
Address locations are, though, completely specified, unlike some
linespecs/explicit locations, where we might have to "fill-in" some
missing bits, e.g., "b 30" -> "30" -> "sourcefile.c:30".
In that vein, I am simply going to remove this. It is not needed anymore.
Keith