- int number;
-
- /* NULL if this isn't a skiplist entry for an entire file.
- The skiplist entry owns this pointer. */
- char *filename;
-
- /* The name of the marked-for-skip function, if this is a skiplist
- entry for a function. Note that this might be non-null even if
- the pc is 0 if the entry is pending a shared library load.
-
- The skiplist entry owns this pointer. */
- char *function_name;
-
- /* 0 if this is a skiplist entry for an entire file, or if this
- entry will be on a function, pending a shared library load. */
- CORE_ADDR pc;
-
- /* Architecture we used to create the skiplist entry. May be null
- if the entry is pending a shared library load. */
- struct gdbarch *gdbarch;
-
- int enabled;
- int pending;
-
- struct skiplist_entry *next;
+public:
+ /* Create a skiplist_entry object and add it to the chain. */
+ static void add_entry (bool file_is_glob,
+ std::string &&file,
+ bool function_is_regexp,
+ std::string &&function);
+
+ /* Return true if the skip entry has a file or glob-style file
+ pattern that matches FUNCTION_SAL. */
+ bool skip_file_p (const symtab_and_line &function_sal) const;
+
+ /* Return true if the skip entry has a function or function regexp
+ that matches FUNCTION_NAME. */
+ bool skip_function_p (const char *function_name) const;
+
+ /* Getters. */
+ int number () const { return m_number; };
+ bool enabled () const { return m_enabled; };
+ bool file_is_glob () const { return m_file_is_glob; }
+ const std::string &file () const { return m_file; }
+ const std::string &function () const { return m_function; }
+ bool function_is_regexp () const { return m_function_is_regexp; }
+
+ /* Setters. */
+ void enable () { m_enabled = true; };
+ void disable () { m_enabled = false; };
+
+ /* Disable copy. */
+ skiplist_entry (const skiplist_entry &) = delete;
+ void operator= (const skiplist_entry &) = delete;
+
+private:
+ /* Key that grants access to the constructor. */
+ struct private_key {};
+public:
+ /* Public so we can construct with container::emplace_back. Since
+ it requires a private class key, it can't be called from outside.
+ Use the add_entry static factory method to construct instead. */
+ skiplist_entry (bool file_is_glob, std::string &&file,
+ bool function_is_regexp, std::string &&function,
+ private_key);
+
+private:
+ /* Return true if we're stopped at a file to be skipped. */
+ bool do_skip_file_p (const symtab_and_line &function_sal) const;
+
+ /* Return true if we're stopped at a globbed file to be skipped. */
+ bool do_skip_gfile_p (const symtab_and_line &function_sal) const;
+
+private: /* data */
+ int m_number = -1;
+
+ /* True if FILE is a glob-style pattern.
+ Otherwise it is the plain file name (possibly with directories). */
+ bool m_file_is_glob;
+
+ /* The name of the file or empty if no name. */
+ std::string m_file;
+
+ /* True if FUNCTION is a regexp.
+ Otherwise it is a plain function name (possibly with arguments,
+ for C++). */
+ bool m_function_is_regexp;
+
+ /* The name of the function or empty if no name. */
+ std::string m_function;
+
+ /* If this is a function regexp, the compiled form. */
+ gdb::optional<compiled_regex> m_compiled_function_regexp;
+
+ /* Enabled/disabled state. */
+ bool m_enabled = true;