This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Add proper handling for non-local references in nested functions
- From: Doug Evans <xdje42 at gmail dot com>
- To: Joel Brobecker <brobecker at adacore dot com>
- Cc: Pierre-Marie de Rodat <derodat at adacore dot com>, Kevin Buettner <kevinb at redhat dot com>, gdb-patches at sourceware dot org
- Date: Wed, 16 Sep 2015 09:15:06 -0700
- Subject: Re: [PATCH] Add proper handling for non-local references in nested functions
- Authentication-results: sourceware.org; auth=none
- References: <550C1170 dot 9070208 at adacore dot com> <55685B60 dot 3000004 at redhat dot com> <55775EB0 dot 4080701 at adacore dot com> <55AF5F7E dot 5000600 at adacore dot com> <20150722173957 dot 7ed51f18 at pinnacle dot lan> <55B0C583 dot 6050601 at adacore dot com> <m3380azmij dot fsf at sspiff dot org> <55BB538B dot 7090104 at adacore dot com> <m3mvxt5eb5 dot fsf at sspiff dot org> <55D1E2B5 dot 4000200 at adacore dot com> <20150902234947 dot GA575 at adacore dot com>
Joel Brobecker <brobecker@adacore.com> writes:
> Hi Pierre-Marie,
>
>> >From f8cb12e93bc4b317bf03dd31fc158cc05fc60367 Mon Sep 17 00:00:00 2001
>> From: Pierre-Marie de Rodat <derodat@adacore.com>
>> Date: Thu, 5 Feb 2015 17:00:06 +0100
>> Subject: [PATCH] DWARF: handle non-local references in nested functions
>>
>> GDB's current behavior when dealing with non-local references in the
>> context of nested fuctions is approximative:
>>
>> - code using valops.c:value_of_variable read the first available stack
>> frame that holds the corresponding variable (whereas there can be
>> multiple candidates for this);
>>
>> - code directly relying on read_var_value will instead read non-local
>> variables in frames where they are not even defined.
>>
>> This change adds the necessary context to symbol reads (to get the block
>> they belong to) and to blocks (the static link property, if any) so that
>> GDB can make the proper decisions when dealing with non-local varibale
>> references.
>>
>> gdb/ChangeLog:
>>
>> * ada-lang.c (ada_read_var_value): Add a var_block argument
>> and pass it to default_read_var_value.
>> * block.c (block_static_link): New accessor.
>> * block.h (block_static_link): Declare it.
>> * buildsym.c (finish_block_internal): Add a static_link
>> [...]
>
> This patch is causing a crash on some platforms, as explained by
> the revision log of the attached patch.
>
> gdb/ChangeLog:
>
> * dwarf2loc.c (locexpr_get_frame_base): Renames
> block_op_get_frame_base.
> (dwarf2_block_frame_base_locexpr_funcs): Replace reference to
> block_op_get_frame_base by reference to locexpr_get_frame_base.
> (loclist_get_frame_base): New function, near identical copy of
> locexpr_get_frame_base.
> (dwarf2_block_frame_base_loclist_funcs): Replace reference to
> block_op_get_frame_base by reference to loclist_get_frame_base.
LGTM.