summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2012-01-17 20:30:14 +0000
committerDoug Evans <dje@google.com>2012-01-17 20:30:14 +0000
commit0c1532ed20dd75284f60957468dcad7f8e7b4bb9 (patch)
treeb8da94c3cb7ea1b429688765fa16538c126e9e96
parentd7111a16aaa26fec7df3b9c300e1b4e5dfb7c45e (diff)
downloadgdb-0c1532ed20dd75284f60957468dcad7f8e7b4bb9.tar.gz
* linespec.c (decode_line_internal): Don't call symtabs_from_filename
if we know we don't have a file name to look for.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/linespec.c50
2 files changed, 36 insertions, 19 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5ee25dd83ea..5108a3ce23f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2012-01-17 Doug Evans <dje@google.com>
+
+ * linespec.c (decode_line_internal): Don't call symtabs_from_filename
+ if we know we don't have a file name to look for.
+
2012-01-17 Pedro Alves <palves@redhat.com>
* dwarf2-frame.c (dwarf2_frame_cfa): Throw NOT_AVAILABLE_ERROR, if
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 55cfec3ca2a..0782c546fda 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -894,32 +894,44 @@ decode_line_internal (struct linespec_state *self, char **argptr)
first_half = p = locate_first_half (argptr, &is_quote_enclosed);
/* First things first: if ARGPTR starts with a filename, get its
- symtab and strip the filename from ARGPTR. */
- TRY_CATCH (file_exception, RETURN_MASK_ERROR)
+ symtab and strip the filename from ARGPTR.
+ Avoid calling symtab_from_filename if we know can,
+ it can be expensive. */
+
+ if (*p != '\0')
{
- self->file_symtabs = symtabs_from_filename (argptr, p, is_quote_enclosed,
- &self->user_filename);
- }
+ TRY_CATCH (file_exception, RETURN_MASK_ERROR)
+ {
+ self->file_symtabs = symtabs_from_filename (argptr, p,
+ is_quote_enclosed,
+ &self->user_filename);
+ }
- if (VEC_empty (symtab_p, self->file_symtabs))
+ if (file_exception.reason >= 0)
+ {
+ /* Check for single quotes on the non-filename part. */
+ is_quoted = (**argptr
+ && strchr (get_gdb_completer_quote_characters (),
+ **argptr) != NULL);
+ if (is_quoted)
+ end_quote = skip_quoted (*argptr);
+
+ /* Locate the next "half" of the linespec. */
+ first_half = p = locate_first_half (argptr, &is_quote_enclosed);
+ }
+
+ if (VEC_empty (symtab_p, self->file_symtabs))
+ {
+ /* A NULL entry means to use GLOBAL_DEFAULT_SYMTAB. */
+ VEC_safe_push (symtab_p, self->file_symtabs, NULL);
+ }
+ }
+ else
{
/* A NULL entry means to use GLOBAL_DEFAULT_SYMTAB. */
VEC_safe_push (symtab_p, self->file_symtabs, NULL);
}
- if (file_exception.reason >= 0)
- {
- /* Check for single quotes on the non-filename part. */
- is_quoted = (**argptr
- && strchr (get_gdb_completer_quote_characters (),
- **argptr) != NULL);
- if (is_quoted)
- end_quote = skip_quoted (*argptr);
-
- /* Locate the next "half" of the linespec. */
- first_half = p = locate_first_half (argptr, &is_quote_enclosed);
- }
-
/* Check if this is an Objective-C method (anything that starts with
a '+' or '-' and a '['). */
if (is_objc_method_format (p))