forked from Imagelibrary/binutils-gdb
Extend "skip" command to support -file, -gfile, -function, -rfunction.
gdb/ChangeLog: Extend "skip" command to support -file, -gfile, -function, -rfunction. * NEWS: Document new features. * skip.c: #include "fnmatch.h", "gdb_regex.h". (skiplist_entry) <file>: Renamed from filename. <function>: Renamed from function_name. <file_is_glob, function_is_regexp>: New members. <compiled_function_regexp, compiled_function_regexp_is_valid>: New members. (make_skip_entry): New function. (free_skiplist_entry, free_skiplist_entry_cleanup): New functions. (make_free_skiplist_entry_cleanup): New function. (skip_file_command): Update. (skip_function, skip_function_command): Update. (compile_skip_regexp): New functions. (skip_command): Add support for new options. (skip_info): Update. (skip_file_p, skip_gfile_p): New functions. (skip_function_p, skip_rfunction_p): New functions. (function_name_is_marked_for_skip): Update and simplify. (_initialize_step_skip): Update. * symtab.c: #include "fnmatch.h". (compare_glob_filenames_for_search): New function. * symtab.h (compare_glob_filenames_for_search): Declare. * utils.c (count_path_elements): New function. (strip_leading_path_elements): New function. * utils.h (count_path_elements): Declare. (strip_leading_path_elements): Declare. gdb/doc/ChangeLog: * gdb.texinfo (Skipping Over Functions and Files): Document new options to "skip" command. Update docs of output of "info skip". gdb/testsuite/ChangeLog: * gdb.base/skip.c (test_skip): New function. (end_test_skip_file_and_function): New function. (test_skip_file_and_function): New function. * gdb.base/skip1.c (test_skip): New function. (skip1_test_skip_file_and_function): New function. * gdb.base/skip.exp: Add tests for new skip options. * gdb.base/skip-solib.exp: Update expected output. * gdb.perf/skip-command.cc: New file. * gdb.perf/skip-command.exp: New file. * gdb.perf/skip-command.py: New file.
This commit is contained in:
36
gdb/symtab.c
36
gdb/symtab.c
@@ -41,7 +41,7 @@
|
||||
#include "p-lang.h"
|
||||
#include "addrmap.h"
|
||||
#include "cli/cli-utils.h"
|
||||
|
||||
#include "fnmatch.h"
|
||||
#include "hashtab.h"
|
||||
|
||||
#include "gdb_obstack.h"
|
||||
@@ -342,6 +342,40 @@ compare_filenames_for_search (const char *filename, const char *search_name)
|
||||
&& STRIP_DRIVE_SPEC (filename) == &filename[len - search_len]));
|
||||
}
|
||||
|
||||
/* Same as compare_filenames_for_search, but for glob-style patterns.
|
||||
Heads up on the order of the arguments. They match the order of
|
||||
compare_filenames_for_search, but it's the opposite of the order of
|
||||
arguments to gdb_filename_fnmatch. */
|
||||
|
||||
int
|
||||
compare_glob_filenames_for_search (const char *filename,
|
||||
const char *search_name)
|
||||
{
|
||||
/* We rely on the property of glob-style patterns with FNM_FILE_NAME that
|
||||
all /s have to be explicitly specified. */
|
||||
int file_path_elements = count_path_elements (filename);
|
||||
int search_path_elements = count_path_elements (search_name);
|
||||
|
||||
if (search_path_elements > file_path_elements)
|
||||
return 0;
|
||||
|
||||
if (IS_ABSOLUTE_PATH (search_name))
|
||||
{
|
||||
return (search_path_elements == file_path_elements
|
||||
&& gdb_filename_fnmatch (search_name, filename,
|
||||
FNM_FILE_NAME | FNM_NOESCAPE) == 0);
|
||||
}
|
||||
|
||||
{
|
||||
const char *file_to_compare
|
||||
= strip_leading_path_elements (filename,
|
||||
file_path_elements - search_path_elements);
|
||||
|
||||
return gdb_filename_fnmatch (search_name, file_to_compare,
|
||||
FNM_FILE_NAME | FNM_NOESCAPE) == 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check for a symtab of a specific name by searching some symtabs.
|
||||
This is a helper function for callbacks of iterate_over_symtabs.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user