* Pascal and case sensitivity
@ 2011-01-10 20:00 Joost van der Sluis
2011-01-10 20:36 ` Jan Kratochvil
0 siblings, 1 reply; 3+ messages in thread
From: Joost van der Sluis @ 2011-01-10 20:00 UTC (permalink / raw)
To: gdb
[-- Attachment #1: Type: text/plain, Size: 540 bytes --]
Hi all,
Attached is patch to fix case-sensitivity issues with Pascal. It first
searches case-sensitive an if an identifier isn't found, a
case-insensitive search is performed.
But this path is quite messy it can be cleaned up somewhat, but it will
never win the 'most beautiful patch' contest. ;)
Would it be acceptable to make the hash (msymbol_hash_iw or dict_hash)
case insensitive by adding a to_lower, and to change strcmp_iw so that
it does a case-insensitive compare when some case-insensitivity setting
is set?
Regards,
Joost.
[-- Attachment #2: gdb_case_insensitive_patch2.diff --]
[-- Type: text/x-patch, Size: 5232 bytes --]
diff --git a/gdb/dictionary.c b/gdb/dictionary.c
index 9d53ff0..8a04921 100644
--- a/gdb/dictionary.c
+++ b/gdb/dictionary.c
@@ -27,6 +27,7 @@
#include "buildsym.h"
#include "gdb_assert.h"
#include "dictionary.h"
+#include "language.h"
/* This file implements dictionaries, which are tables that associate
symbols to names. They are represented by an opaque type 'struct
@@ -665,11 +666,20 @@ iter_match_first_hashed (const struct dictionary *dict,
sym = sym->hash_next)
{
/* Warning: the order of arguments to compare matters! */
- if (compare (SYMBOL_SEARCH_NAME (sym), name) == 0)
- {
- break;
- }
-
+ if ((current_language->la_language == language_pascal) && (performing_case_sensitive_search == 1) && (original_search_name))
+ {
+ if (compare (SYMBOL_NATURAL_NAME (sym), original_search_name) == 0)
+ {
+ break;
+ }
+ }
+ else
+ {
+ if (compare (SYMBOL_SEARCH_NAME (sym), name) == 0)
+ {
+ break;
+ }
+ }
}
DICT_ITERATOR_CURRENT (iterator) = sym;
diff --git a/gdb/dictionary.h b/gdb/dictionary.h
index f7d3035..3476a41 100644
--- a/gdb/dictionary.h
+++ b/gdb/dictionary.h
@@ -177,3 +177,7 @@ extern int dict_size (const struct dictionary *dict);
(sym) = dict_iterator_next (&(iter)))
#endif /* DICTIONARY_H */
+
+int performing_case_sensitive_search;
+char *original_search_name;
+
diff --git a/gdb/p-exp.y b/gdb/p-exp.y
index 19f5ceb..706205f 100644
--- a/gdb/p-exp.y
+++ b/gdb/p-exp.y
@@ -52,6 +52,7 @@
#include "parser-defs.h"
#include "language.h"
#include "p-lang.h"
+#include "dictionary.h"
#include "bfd.h" /* Required by objfiles.h. */
#include "symfile.h" /* Required by objfiles.h. */
#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
@@ -1445,8 +1446,23 @@ yylex ()
if (is_a_field)
sym = NULL;
else
- sym = lookup_symbol (tmp, expression_context_block,
- VAR_DOMAIN, &is_a_field_of_this);
+ {
+ original_search_name = malloc(100);
+ strcpy (original_search_name,tmp);
+ for (i = 0; i <= namelen; i++)
+ tmp[i] = tolower (tmp[i]);
+
+ performing_case_sensitive_search = 1;
+ sym = lookup_symbol (tmp, expression_context_block,
+ VAR_DOMAIN, &is_a_field_of_this);
+ free(original_search_name);
+ performing_case_sensitive_search = 0;
+ if (!sym)
+ {
+ sym = lookup_symbol (tmp, expression_context_block,
+ VAR_DOMAIN, &is_a_field_of_this);
+ }
+ }
/* second chance uppercased (as Free Pascal does). */
if (!sym && !is_a_field_of_this && !is_a_field)
{
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 9d577b0..135269f 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -372,6 +372,10 @@ symbol_set_demangled_name (struct general_symbol_info *gsymbol,
gsymbol->language_specific.cplus_specific->demangled_name = name;
}
+ else if (gsymbol->language == language_pascal)
+ {
+ gsymbol->language_specific.pascal_specific.lowercase_name = NULL;
+ }
else
gsymbol->language_specific.mangled_lang.demangled_name = name;
}
@@ -594,6 +598,28 @@ symbol_set_names (struct general_symbol_info *gsymbol,
return;
}
+ if (gsymbol->language == language_pascal)
+ {
+ int i;
+ char *lc_name;
+ /* In pascal, we do the symbol lookups using the lowercase name. */
+ if (!copy_name)
+ gsymbol->name = (char *) linkage_name;
+ else
+ {
+ gsymbol->name = obstack_alloc (&objfile->objfile_obstack, len + 1);
+ memcpy (gsymbol->name, linkage_name, len);
+ gsymbol->name[len] = '\0';
+ }
+ lc_name = obstack_alloc (&objfile->objfile_obstack, len + 1);
+ for (i = 0; i < len; i++)
+ lc_name[i] = tolower (linkage_name[i]);
+ lc_name[len] = '\0';
+ gsymbol->language_specific.pascal_specific.lowercase_name = lc_name;
+ return;
+ }
+
+
if (objfile->demangled_names_hash == NULL)
create_demangled_names_hash (objfile);
@@ -752,10 +778,19 @@ symbol_demangled_name (const struct general_symbol_info *gsymbol)
char *
symbol_search_name (const struct general_symbol_info *gsymbol)
{
- if (gsymbol->language == language_ada)
- return gsymbol->name;
- else
- return symbol_natural_name (gsymbol);
+ switch (gsymbol->language)
+ {
+ case language_ada:
+ return gsymbol->name;
+ break;
+ case language_pascal:
+ if (gsymbol->language_specific.pascal_specific.lowercase_name != NULL)
+ return gsymbol->language_specific.pascal_specific.lowercase_name;
+ break;
+ default:
+ break;
+ }
+ return symbol_natural_name (gsymbol);
}
/* Initialize the structure fields to zero values. */
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 944dd33..e371a43 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -138,6 +138,12 @@ struct general_symbol_info
mangled_lang;
struct cplus_specific *cplus_specific;
+ struct pascal_specific
+ {
+ /* This is used for case insensitive searching. */
+ char *lowercase_name;
+ }
+ pascal_specific;
}
language_specific;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Pascal and case sensitivity
2011-01-10 20:00 Pascal and case sensitivity Joost van der Sluis
@ 2011-01-10 20:36 ` Jan Kratochvil
2011-01-11 20:53 ` Joost van der Sluis
0 siblings, 1 reply; 3+ messages in thread
From: Jan Kratochvil @ 2011-01-10 20:36 UTC (permalink / raw)
To: Joost van der Sluis; +Cc: gdb
[-- Attachment #1: Type: text/plain, Size: 870 bytes --]
Hi Joost,
On Mon, 10 Jan 2011 21:00:25 +0100, Joost van der Sluis wrote:
> Attached is patch to fix case-sensitivity issues with Pascal. It first
> searches case-sensitive an if an identifier isn't found, a
> case-insensitive search is performed.
without commenting on your patch I had one with a similar goal here.
Just this stuff depends on full symtabs expansion and I found a regression
already in FSF GDB:
http://sourceware.org/ml/gdb-patches/2010-11/msg00300.html
http://sourceware.org/ml/gdb-patches/2010-11/msg00300.html
which is
http://sourceware.org/bugzilla/show_bug.cgi?id=11734
with the fix currently pending unreviewed:
Re: [RFA] c++/11734 revisited
http://sourceware.org/ml/gdb-patches/2010-12/msg00263.html
Also .gdb_index may need updates for it but before this basic full symtabs
expansion gets resolved it does not make sense.
Regards,
Jan
[-- Attachment #2: caseordered-cxxback.patch --]
[-- Type: text/plain, Size: 17100 bytes --]
--- a/gdb/dictionary.c
+++ b/gdb/dictionary.c
@@ -836,7 +836,7 @@ dict_hash (const char *string0)
}
/* FALL THROUGH */
default:
- hash = hash * 67 + *string - 113;
+ hash = SYMBOL_HASH_NEXT (hash, *string);
string += 1;
break;
}
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -71,6 +71,7 @@
#define MAP_FAILED ((void *) -1)
#endif
#endif
+#include <ctype.h>
typedef struct symbol *symbolp;
DEF_VEC_P (symbolp);
@@ -148,6 +149,8 @@ DEF_VEC_I (offset_type);
a comment by the code that writes the index. */
struct mapped_index
{
+ /* Index data format version. */
+ int version;
/* The total length of the buffer. */
off_t total_size;
/* A pointer to the address table data. */
@@ -1853,21 +1856,26 @@ create_addrmap_from_index (struct objfile *objfile, struct mapped_index *index)
do_cleanups (cleanup);
}
-/* The hash function for strings in the mapped index. This is the
- same as the hashtab.c hash function, but we keep a separate copy to
- maintain control over the implementation. This is necessary
- because the hash function is tied to the format of the mapped index
- file. */
+/* The hash function for strings in the mapped index. This is the same as
+ SYMBOL_HASH_NEXT, but we keep a separate copy to maintain control over the
+ implementation. This is necessary because the hash function is tied to the
+ format of the mapped index file.
+
+ Use INT_MAX for INDEX_VERSION if you generate the current index format. */
static hashval_t
-mapped_index_string_hash (const void *p)
+mapped_index_string_hash (int index_version, const void *p)
{
const unsigned char *str = (const unsigned char *) p;
hashval_t r = 0;
unsigned char c;
while ((c = *str++) != 0)
- r = r * 67 + c - 113;
+ {
+ if (index_version >= 4)
+ c = tolower (c);
+ r = r * 67 + c - 113;
+ }
return r;
}
@@ -1880,7 +1888,7 @@ static int
find_slot_in_mapped_hash (struct mapped_index *index, const char *name,
offset_type **vec_out)
{
- offset_type hash = mapped_index_string_hash (name);
+ offset_type hash = mapped_index_string_hash (index->version, name);
offset_type slot, step;
slot = hash & (index->symbol_table_slots - 1);
@@ -1895,7 +1903,7 @@ find_slot_in_mapped_hash (struct mapped_index *index, const char *name,
return 0;
str = index->constant_pool + MAYBE_SWAP (index->symbol_table[i]);
- if (!strcmp (name, str))
+ if (!strcmp_iw (str, name))
{
*vec_out = (offset_type *) (index->constant_pool
+ MAYBE_SWAP (index->symbol_table[i + 1]));
@@ -1941,8 +1949,13 @@ dwarf2_read_index (struct objfile *objfile)
it seems better to just ignore such indices. */
if (version < 3)
return 0;
+ /* Indexes with higher version than the one supported by GDB may be no
+ longer backward compatible. */
+ if (version > 4)
+ return 0;
map = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct mapped_index);
+ map->version = version;
map->total_size = dwarf2_per_objfile->gdb_index.size;
metadata = (offset_type *) (addr + sizeof (offset_type));
@@ -14800,13 +14813,16 @@ struct strtab_entry
const char *str;
};
-/* Hash function for a strtab_entry. */
+/* Hash function for a strtab_entry.
+
+ Function is used only during write_hash_table so no index format backward
+ compatibility is needed. */
static hashval_t
hash_strtab_entry (const void *e)
{
const struct strtab_entry *entry = e;
- return mapped_index_string_hash (entry->str);
+ return mapped_index_string_hash (INT_MAX, entry->str);
}
/* Equality function for a strtab_entry. */
@@ -14944,12 +14960,15 @@ cleanup_mapped_symtab (void *p)
}
/* Find a slot in SYMTAB for the symbol NAME. Returns a pointer to
- the slot. */
+ the slot.
+
+ Function is used only during write_hash_table so no index format backward
+ compatibility is needed. */
static struct symtab_index_entry **
find_slot (struct mapped_symtab *symtab, const char *name)
{
- offset_type index, step, hash = mapped_index_string_hash (name);
+ offset_type index, step, hash = mapped_index_string_hash (INT_MAX, name);
index = hash & (symtab->size - 1);
step = ((hash * 17) & (symtab->size - 1)) | 1;
@@ -15349,7 +15368,7 @@ write_psymtabs_to_index (struct objfile *objfile, const char *dir)
total_len = size_of_contents;
/* The version number. */
- val = MAYBE_SWAP (3);
+ val = MAYBE_SWAP (4);
obstack_grow (&contents, &val, sizeof (val));
/* The offset of the CU list from the start of the file. */
@@ -15407,8 +15426,8 @@ write_psymtabs_to_index (struct objfile *objfile, const char *dir)
1. The file header. This is a sequence of values, of offset_type
unless otherwise noted:
- [0] The version number, currently 3. Versions 1 and 2 are
- obsolete.
+ [0] The version number, currently 4. Versions 1 and 2 are
+ obsolete. Version 3 differs by its hashing function.
[1] The offset, from the start of the file, of the CU list.
[2] The offset, from the start of the file, of the types CU list.
Note that this section can be empty, in which case this offset will
@@ -15440,7 +15459,8 @@ write_psymtabs_to_index (struct objfile *objfile, const char *dir)
5. The symbol table. This is a hash table. The size of the hash
table is always a power of 2. The initial hash and the step are
- currently defined by the `find_slot' function.
+ currently defined by the `find_slot' function. Index version 3 uses
+ a different hash function than index version 4 and later.
Each slot in the hash table consists of a pair of offset_type
values. The first value is the offset of the symbol's name in the
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -89,7 +89,7 @@ msymbol_hash_iw (const char *string)
++string;
if (*string && *string != '(')
{
- hash = hash * 67 + *string - 113;
+ hash = SYMBOL_HASH_NEXT (hash, *string);
++string;
}
}
@@ -104,7 +104,7 @@ msymbol_hash (const char *string)
unsigned int hash = 0;
for (; *string; ++string)
- hash = hash * 67 + *string - 113;
+ hash = SYMBOL_HASH_NEXT (hash, *string);
return hash;
}
@@ -244,6 +244,9 @@ lookup_minimal_symbol (const char *name, const char *sfile,
{
match = strcmp (SYMBOL_LINKAGE_NAME (msymbol),
modified_name) == 0;
+ if (!match && case_sensitivity == case_sensitive_off)
+ match = strcasecmp (SYMBOL_LINKAGE_NAME (msymbol),
+ modified_name) == 0;
}
else
{
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -577,8 +577,15 @@ lookup_partial_symbol (struct partial_symtab *pst, const char *name,
if (!(top == bottom))
internal_error (__FILE__, __LINE__, _("failed internal consistency check"));
- while (top <= real_top
- && SYMBOL_MATCHES_SEARCH_NAME (*top, name))
+ /* For `case_sensitivity == case_sensitive_off' strcmp_iw_ordered will
+ search more exactly than what matches SYMBOL_MATCHES_SEARCH_NAME. */
+ while (top >= start && SYMBOL_MATCHES_SEARCH_NAME (*top, name))
+ top--;
+
+ /* Fixup to have a symbol which matches SYMBOL_MATCHES_SEARCH_NAME. */
+ top++;
+
+ while (top <= real_top && SYMBOL_MATCHES_SEARCH_NAME (*top, name))
{
if (symbol_matches_domain (SYMBOL_LANGUAGE (*top),
SYMBOL_DOMAIN (*top), domain))
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -1061,19 +1061,6 @@ lookup_symbol_in_language (const char *name, const struct block *block,
}
}
- if (case_sensitivity == case_sensitive_off)
- {
- char *copy;
- int len, i;
-
- len = strlen (name);
- copy = (char *) alloca (len + 1);
- for (i= 0; i < len; i++)
- copy[i] = tolower (name[i]);
- copy[len] = 0;
- modified_name = copy;
- }
-
returnval = lookup_symbol_aux (modified_name, block, domain, lang,
is_a_field_of_this);
do_cleanups (cleanup);
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -1012,6 +1012,13 @@ extern unsigned int msymbol_hash_iw (const char *);
extern unsigned int msymbol_hash (const char *);
+/* This is only an internally computed value with no external files
+ compatibility requirements. Compute next hash value from string
+ character C. */
+
+#define SYMBOL_HASH_NEXT(hash, c) \
+ ((hash) * 67 + tolower ((unsigned char) (c)) - 113)
+
extern struct objfile * msymbol_objfile (struct minimal_symbol *sym);
extern void
--- /dev/null
+++ b/gdb/testsuite/gdb.base/fortran-sym-case.c
@@ -0,0 +1,22 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2010 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+int
+main (int argc, char **aRGv)
+{
+ return 0;
+}
--- /dev/null
+++ b/gdb/testsuite/gdb.base/fortran-sym-case.exp
@@ -0,0 +1,27 @@
+# Copyright (C) 2010 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+set testfile fortran-sym-case
+if { [prepare_for_testing ${testfile}.exp ${testfile}] } {
+ return -1
+}
+
+if ![runto_main] {
+ return -1
+}
+
+gdb_test "set language fortran" {Warning: the current language does not match this frame\.}
+
+gdb_test "frame" "aRGv=0x.*"
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive-debug.S
@@ -0,0 +1,78 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2010 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+ .section .debug_info
+.Lcu1_begin:
+ /* CU header */
+ .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */
+.Lcu1_start:
+ .2byte 2 /* DWARF Version */
+ .4byte .Labbrev1_begin /* Offset into abbrev section */
+ .byte 4 /* Pointer size */
+
+ /* CU die */
+ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */
+ .ascii "file1.txt\0" /* DW_AT_name */
+ .ascii "GNU C 3.3.3\0" /* DW_AT_producer */
+ .byte 8 /* DW_AT_language (DW_LANG_Fortran90) */
+ .4byte FUNC_lang /* DW_AT_low_pc */
+ .4byte main /* DW_AT_high_pc */
+
+ .uleb128 3 /* Abbrev: DW_TAG_subprogram */
+ .byte 1 /* DW_AT_external */
+ .ascii "FUNC_lang\0" /* DW_AT_name */
+ .4byte FUNC_lang /* DW_AT_low_pc */
+ .4byte main /* DW_AT_high_pc */
+
+ .byte 0 /* End of children of CU */
+.Lcu1_end:
+
+/* Abbrev table */
+ .section .debug_abbrev
+.Labbrev1_begin:
+ .uleb128 1 /* Abbrev code */
+ .uleb128 0x11 /* DW_TAG_compile_unit */
+ .byte 1 /* has_children */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0x25 /* DW_AT_producer */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0x13 /* DW_AT_language */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .uleb128 0x11 /* DW_AT_low_pc */
+ .uleb128 0x1 /* DW_FORM_addr */
+ .uleb128 0x12 /* DW_AT_high_pc */
+ .uleb128 0x1 /* DW_FORM_addr */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .uleb128 3 /* Abbrev code */
+ .uleb128 0x2e /* DW_TAG_subprogram */
+ .byte 0 /* has_children */
+ .uleb128 0x3f /* DW_AT_external */
+ .uleb128 0xc /* DW_FORM_flag */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0x11 /* DW_AT_low_pc */
+ .uleb128 0x1 /* DW_FORM_addr */
+ .uleb128 0x12 /* DW_AT_high_pc */
+ .uleb128 0x1 /* DW_FORM_addr */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.c
@@ -0,0 +1,38 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2010 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Use DW_LANG_Fortran90 for case insensitive DWARF. */
+
+void
+FUNC_lang (void)
+{
+}
+
+/* Symbol is present only in ELF .symtab. */
+
+void
+FUNC_symtab (void)
+{
+}
+
+int
+main()
+{
+ FUNC_lang ();
+ FUNC_symtab ();
+ return 0;
+}
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp
@@ -0,0 +1,41 @@
+# Copyright 2010 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+# For now pick a sampling of likely targets.
+if {![istarget *-*-linux*]
+ && ![istarget *-*-gnu*]
+ && ![istarget *-*-elf*]
+ && ![istarget *-*-openbsd*]
+ && ![istarget arm-*-eabi*]
+ && ![istarget powerpc-*-eabi*]} {
+ return 0
+}
+
+set testfile "dw2-case-insensitive"
+
+if { [prepare_for_testing ${testfile}.exp ${testfile} [list ${testfile}.c ${testfile}-debug.S] {nodebug}] } {
+ return -1
+}
+
+gdb_test_no_output "set language fortran"
+
+if {[gdb_breakpoint "fuNC_lang"] == 1} {
+ pass "setting breakpoint at fuNC_lang"
+}
+
+if {[gdb_breakpoint "fuNC_symtab"] == 1} {
+ pass "setting breakpoint at fuNC_symtab"
+}
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -2927,10 +2927,12 @@ strcmp_iw (const char *string1, const char *string2)
{
string2++;
}
- if (*string1 != *string2)
- {
- break;
- }
+ if (case_sensitivity == case_sensitive_on && *string1 != *string2)
+ break;
+ if (case_sensitivity == case_sensitive_off
+ && (tolower ((unsigned char) *string1)
+ != tolower ((unsigned char) *string2)))
+ break;
if (*string1 != '\0')
{
string1++;
@@ -2986,10 +2988,12 @@ strcmp_iw_ordered (const char *string1, const char *string2)
{
string2++;
}
- if (*string1 != *string2)
- {
- break;
- }
+ if (case_sensitivity == case_sensitive_on && *string1 != *string2)
+ break;
+ if (case_sensitivity == case_sensitive_off
+ && (tolower ((unsigned char) *string1)
+ != tolower ((unsigned char) *string2)))
+ break;
if (*string1 != '\0')
{
string1++;
@@ -3015,8 +3019,11 @@ strcmp_iw_ordered (const char *string1, const char *string2)
default:
if (*string2 == '(')
return 1;
- else
+ else if (case_sensitivity == case_sensitive_on)
return *string1 - *string2;
+ else
+ return (tolower ((unsigned char) *string1)
+ - tolower ((unsigned char) *string2));
}
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Pascal and case sensitivity
2011-01-10 20:36 ` Jan Kratochvil
@ 2011-01-11 20:53 ` Joost van der Sluis
0 siblings, 0 replies; 3+ messages in thread
From: Joost van der Sluis @ 2011-01-11 20:53 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: gdb
On Mon, 2011-01-10 at 21:36 +0100, Jan Kratochvil wrote:
> Hi Joost,
>
> On Mon, 10 Jan 2011 21:00:25 +0100, Joost van der Sluis wrote:
> > Attached is patch to fix case-sensitivity issues with Pascal. It first
> > searches case-sensitive an if an identifier isn't found, a
> > case-insensitive search is performed.
>
> without commenting on your patch I had one with a similar goal here.
Your patch is what I had in mind. I'll go testing it. I don't think I
can help with the full symtabs expansions problems.
Joost.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-01-11 20:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-10 20:00 Pascal and case sensitivity Joost van der Sluis
2011-01-10 20:36 ` Jan Kratochvil
2011-01-11 20:53 ` Joost van der Sluis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox