This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

src/gdb ChangeLog ada-lang.c


CVSROOT:	/cvs/src
Module name:	src
Changes by:	brobecke@sourceware.org	2013-10-08 11:18:58

Modified files:
	gdb            : ChangeLog ada-lang.c 

Log message:
	[Ada] psymbol search failure due to comparison function discrepancy
	
	Upon trying to print the value of a variant record, a user noticed
	the following problem:
	
	(gdb) print rt
	warning: Unknown upper bound, using 1.
	warning: Unknown upper bound, using 1.
	$1 = (a => ((a1 => (4), a2 => (4)), (a1 => (8), a2 => (8))))
	
	The expected output is:
	
	(gdb) print rt
	$1 = (a => ((a1 => (4, 4), a2 => (8, 8)), (a1 => (4, 4),
	a2 => (8, 8))))
	
	The problems comes from the fact that components "a1" and "a2" are
	defined as arrays whose upper bound is dynamic.  To determine the value
	of that upper bound, GDB relies on the GNAT encoding and searches
	for the parallel ___U variable.  Unfortunately, the search fails
	while doing a binary search inside the partial symtab of the unit
	where the array and its bound (and therefore the parallel ___U variable)
	are defined.
	
	It fails because partial symbols are sorted using strcmp_iw_ordered,
	while Ada symbol lookups are performed using a different comparison
	function (ada-lang.c:compare_names). The two functions are supposed
	to be compatible, but a change performed in April 2011 modified
	strcmp_iw_ordered, introducing case-sensitivity issues. As a result,
	the two functions would now disagree when passed the following
	two arguments:
	
	string1="common__inner_arr___SIZE_A_UNIT"
	string2="common__inner_arr__T4s___U"
	
	The difference starts at "_SIZE_A_UNIT" vs "T4s___U". So, it's mostly
	a matter of comparing '_' with 'T'.
	
	On the one hand, strcmp_iw_ordered would return -1, while compare_names
	returned 11. The change that made all the difference is that
	strcmp_iw_ordered now performs a case-insensitive comparison,
	and only resorts to case-sentitive comparison if the first comparison
	finds an equality. This changes everything, because while 'T' (84)
	and 't' (116) are on opposite sides of '_' (95).
	
	This patch aims at restoring the compatibility between the two
	functions, by adding case-sensitivity handling in the Ada comparison
	function.
	
	gdb/ChangeLog:
	
	* ada-lang.c (compare_names_with_case): Renamed from
	compare_names, adding a new parameter "casing" and its handling.
	New function documentation.
	(compare_names): New function, implemented using
	compare_names_with_case.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.16082&r2=1.16083
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ada-lang.c.diff?cvsroot=src&r1=1.410&r2=1.411


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]