binutils-gdb/gdb/testsuite/gdb.fortran
Walfred Tedeschi 4f19a0e6b4 Fix of default lookup for "this" symbol.
Using the default lookup for the symbol "this" might lead to segmentation
fault in GDB.
Some languages, e.g. Fortran, use as default lookup routine the C++
routines.
For those languages "this" can be the instance of a class or even the
definition of a class.
When an instance of a class having the name "this" is evaluated
in GDB a segmentation fault was observed.

As example of the issue take into consideration the Fortran code:
  type foo
    real :: a
    type(bar) :: x
    character*7 :: b
  end type foo
  type(foo) :: this

Issue appears when evaluating the variable "this" in GDB.

Within the language definition structure there is a field that represents
the name of the special symbol used for the C++ "this" for the language
being described.
The fix presented here takes into account the aforementioned field. In the
case the aforementioned field is NULL "this" is not represented in the
language described and the lookup should return a null_block_symbol.

Tests: Performed tests with gfortran and ifort.

Reviewed:
https://sourceware.org/ml/gdb-patches/2016-04/msg00068.html

After the commited patch:
https://sourceware.org/ml/gdb-patches/2016-06/msg00364.html
Patch can be applied.

2016-06-16  Walfred Tedeschi  <walfred.tedeschi@intel.com>

gdb/ChangeLog:

	* cp-namespace.c (cp_lookup_bare_symbol): Use language passed as
	parameter to look for the symbol "this".

gdb/testsuite/ChangeLog:

	* gdb.fortran/derived-types.exp (result_line, result_line_2):
	New variables.
	(print this%a, print this%b, print this): New tests.
	* gdb.fortran/derived-types.f90 (this): New object and
	initialization.
2016-07-07 17:33:05 +02:00
..
array-element.exp
array-element.f
charset.exp
charset.f90
common-block.exp fortran: Testsuite, fix different type naming across compilers. 2016-04-18 14:04:07 +02:00
common-block.f90
complex.exp
complex.f
derived-type-function.exp Improve user experience in printing Fortran derived types. 2016-06-21 15:15:04 +02:00
derived-type-function.f90 Improve user experience in printing Fortran derived types. 2016-06-21 15:15:04 +02:00
derived-type.exp Fix of default lookup for "this" symbol. 2016-07-07 17:33:05 +02:00
derived-type.f90 Fix of default lookup for "this" symbol. 2016-07-07 17:33:05 +02:00
exprs.exp
library-module-lib.f90
library-module-main.f90
library-module.exp Rename gdb_load_shlibs to gdb_load_shlib 2016-04-27 18:09:14 -04:00
logical.exp
logical.f90
module.exp
module.f90
multi-dim.exp fortran: Testsuite, fix different type naming across compilers. 2016-04-18 14:04:07 +02:00
multi-dim.f90
nested-funcs.exp Fortran: Testsuite, non-local references in nested functions. 2016-06-10 11:16:49 +02:00
nested-funcs.f90 Fortran: Testsuite, non-local references in nested functions. 2016-06-10 11:16:49 +02:00
print-formatted.exp
print-formatted.f90
subarray.exp
subarray.f
type.f90 Fortran, typeprint: Forward level of details to be printed for pointers. 2016-05-25 08:47:18 +02:00
types.exp
vla-alloc-assoc.exp
vla-datatypes.exp fortran: Testsuite, fix different type naming across compilers. 2016-04-18 14:04:07 +02:00
vla-datatypes.f90
vla-history.exp testsuite: Remove unnecessary code in fortran vla-history test. 2016-03-02 16:48:06 +01:00
vla-ptr-info.exp
vla-ptype-sub.exp fortran: Testsuite, fix different type naming across compilers. 2016-04-18 14:04:07 +02:00
vla-ptype.exp fortran: Testsuite, fix different type naming across compilers. 2016-04-18 14:04:07 +02:00
vla-sizeof.exp
vla-sub.f90
vla-type.exp Improve user experience in printing Fortran derived types. 2016-06-21 15:15:04 +02:00
vla-type.f90 fort_dyn_array: Support evaluation of dynamic elements inside arrays. 2016-04-26 16:38:19 +02:00
vla-value-sub-arbitrary.exp
vla-value-sub-finish.exp testsuite regression: gdb.fortran/vla-value-sub.exp gdb.fortran/vla-value-sub-finish.exp 2016-02-14 09:10:59 +01:00
vla-value-sub.exp testsuite regression: gdb.fortran/vla-value-sub.exp gdb.fortran/vla-value-sub-finish.exp 2016-02-14 09:10:59 +01:00
vla-value.exp [testsuite] Fix tiemout fail in gdb.fortran/vla-value.exp 2016-01-28 14:27:48 +00:00
vla.f90 testsuite: Fix false Fortran regressions with recent gcc 2016-02-14 09:21:18 +01:00
whatis_type.exp Fortran, typeprint: Forward level of details to be printed for pointers. 2016-05-25 08:47:18 +02:00