mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-12-18 00:37:28 +08:00
Make global_symbol_searcher::filenames private
This patch renames global_symbol_searcher::filenames and makes it private, adding a new method to append a filename to the vector. This also cleans up memory management here, removing an alloca from rbreak, and removing a somewhat ugly SCOPE_EXIT from the Python code, in favor of having global_symbol_searcher manage the memory itself. Regression tested on x86-64 Fedora 38.
This commit is contained in:
@@ -804,10 +804,6 @@ gdbpy_rbreak (PyObject *self, PyObject *args, PyObject *kw)
|
||||
}
|
||||
|
||||
global_symbol_searcher spec (SEARCH_FUNCTION_DOMAIN, regex);
|
||||
SCOPE_EXIT {
|
||||
for (const char *elem : spec.filenames)
|
||||
xfree ((void *) elem);
|
||||
};
|
||||
|
||||
/* The "symtabs" keyword is any Python iterable object that returns
|
||||
a gdb.Symtab on each iteration. If specified, iterate through
|
||||
@@ -852,10 +848,7 @@ gdbpy_rbreak (PyObject *self, PyObject *args, PyObject *kw)
|
||||
if (filename == NULL)
|
||||
return NULL;
|
||||
|
||||
/* Make sure there is a definite place to store the value of
|
||||
filename before it is released. */
|
||||
spec.filenames.push_back (nullptr);
|
||||
spec.filenames.back () = filename.release ();
|
||||
spec.add_filename (std::move (filename));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user