aboutsummaryrefslogtreecommitdiff
path: root/gold/plugin.h
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@gmail.com>2018-03-23 10:05:38 -0700
committerCary Coutant <ccoutant@gmail.com>2018-03-23 10:05:38 -0700
commit291158a341260e97125db5638cd47c1e9aea5e8f (patch)
tree4479a33446992b8e56cc9f08d77ae0a79b06ca7e /gold/plugin.h
parent2cc9b3048bcbb827e69059fb6beacb9bccbc5d7c (diff)
downloadgdb-291158a341260e97125db5638cd47c1e9aea5e8f.zip
gdb-291158a341260e97125db5638cd47c1e9aea5e8f.tar.gz
gdb-291158a341260e97125db5638cd47c1e9aea5e8f.tar.bz2
Add --debug=plugin option to record plugin actions.
With --debug=plugin, gold will log all plugin actions to a log file, and make copies of plugin-supplied replacement files in a temporary directory created under the current working directory. gold/ * debug.h (DEBUG_PLUGIN): New constant. (DEBUG_ALL): Add DEBUG_PLUGIN. (debug_string_to_enum): Likewise. * plugin.cc (make_sized_plugin_object): Add filename parameter. (Plugin_recorder): New class. (Plugin_manager::~Plugin_manager): Delete recorder_. (Plugin_manager::load_plugins): Create and initialize recorder_. (Plugin_manager::claim_file): Record claimed and unclaimed files. (Plugin_manager::make_plugin_object): Use object name as name for plugin object, if available. (Plugin_manager::add_input_file): Record replacement files. (Sized_pluginobj::do_add_symbols): Record plugin symbols. (Plugin_finish::run): Call Plugin_recorder::finish(). (make_sized_plugin_object): Add filename parameter and pass to Sized_pluginobj constructor. * plugin.h (Plugin::filename): New method. (Plugin::recorder): New method. (Plugin::recorder_): New data member.
Diffstat (limited to 'gold/plugin.h')
-rw-r--r--gold/plugin.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/gold/plugin.h b/gold/plugin.h
index e64ee07..c12bdc0 100644
--- a/gold/plugin.h
+++ b/gold/plugin.h
@@ -47,6 +47,7 @@ class Task;
class Task_token;
class Pluginobj;
class Plugin_rescan;
+class Plugin_recorder;
// This class represents a single plugin library.
@@ -114,6 +115,10 @@ class Plugin
this->args_.push_back(arg);
}
+ const std::string&
+ filename() const
+ { return this->filename_; }
+
private:
Plugin(const Plugin&);
Plugin& operator=(const Plugin&);
@@ -146,7 +151,8 @@ class Plugin_manager
options_(options), workqueue_(NULL), task_(NULL), input_objects_(NULL),
symtab_(NULL), layout_(NULL), dirpath_(NULL), mapfile_(NULL),
this_blocker_(NULL), extra_search_path_(), lock_(NULL),
- initialize_lock_(&lock_), defsym_defines_set_()
+ initialize_lock_(&lock_), defsym_defines_set_(),
+ recorder_(NULL)
{ this->current_ = plugins_.end(); }
~Plugin_manager();
@@ -316,6 +322,10 @@ class Plugin_manager
layout()
{ return this->layout_; }
+ Plugin_recorder*
+ recorder() const
+ { return this->recorder_; }
+
private:
Plugin_manager(const Plugin_manager&);
Plugin_manager& operator=(const Plugin_manager&);
@@ -413,6 +423,9 @@ class Plugin_manager
// Keep track of all symbols defined by defsym.
typedef Unordered_set<std::string> Defsym_defines_set;
Defsym_defines_set defsym_defines_set_;
+
+ // Class to record plugin actions.
+ Plugin_recorder* recorder_;
};