aboutsummaryrefslogtreecommitdiff
path: root/gold/plugin.h
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2008-12-05 21:34:54 +0000
committerCary Coutant <ccoutant@google.com>2008-12-05 21:34:54 +0000
commit4674ecfcf4045b3a3d81a4a979debd59ea1b6b11 (patch)
tree304093024cd1aed1d02654b688a607510c40efc8 /gold/plugin.h
parentfd06b4aa51e5e4b322f4784e3ea248e25aab733a (diff)
downloadgdb-4674ecfcf4045b3a3d81a4a979debd59ea1b6b11.zip
gdb-4674ecfcf4045b3a3d81a4a979debd59ea1b6b11.tar.gz
gdb-4674ecfcf4045b3a3d81a4a979debd59ea1b6b11.tar.bz2
2008-12-05 Rafael Avila de Espindola <espindola@google.com>
* options.cc (General_options::parse_plugin_opt): New. (General_options::add_plugin): The argument now is just the filename. (General_options::add_plugin_option): New. * options.h (plugin_opt): New. (add_plugin): Change argument name. (add_plugin_option): New. * plugin.cc (Plugin::load): Don't parse the plugin option. * plugin.h (Plugin::Plugin): Rename argument. Init filename_. (Plugin::add_option): New. (Plugin::args_): Change type. (Plugin::filename_): New. (Plugin_manager::add_plugin_option): New. * testsuite/Makefile.am (plugin_test_1): Use new syntax. * testsuite/Makefile.in: Regenerate.
Diffstat (limited to 'gold/plugin.h')
-rw-r--r--gold/plugin.h28
1 files changed, 23 insertions, 5 deletions
diff --git a/gold/plugin.h b/gold/plugin.h
index 3f573ce..5b6fa1f 100644
--- a/gold/plugin.h
+++ b/gold/plugin.h
@@ -48,9 +48,10 @@ class Pluginobj;
class Plugin
{
public:
- Plugin(const char* args)
+ Plugin(const char* filename)
: handle_(NULL),
- args_(args),
+ filename_(filename),
+ args_(),
claim_file_handler_(NULL),
all_symbols_read_handler_(NULL),
cleanup_handler_(NULL)
@@ -90,6 +91,13 @@ class Plugin
set_cleanup_handler(ld_plugin_cleanup_handler handler)
{ this->cleanup_handler_ = handler; }
+ // Add an argument
+ void
+ add_option(const char *arg)
+ {
+ this->args_.push_back(arg);
+ }
+
private:
Plugin(const Plugin&);
Plugin& operator=(const Plugin&);
@@ -97,7 +105,9 @@ class Plugin
// The shared library handle returned by dlopen.
void* handle_;
// The argument string given to --plugin.
- const char* args_;
+ std::string filename_;
+ // The list of argument string given to --plugin-opt.
+ std::vector<std::string> args_;
// The plugin's event handlers.
ld_plugin_claim_file_handler claim_file_handler_;
ld_plugin_all_symbols_read_handler all_symbols_read_handler_;
@@ -119,8 +129,16 @@ class Plugin_manager
// Add a plugin library.
void
- add_plugin(const char* args)
- { this->plugins_.push_back(new Plugin(args)); }
+ add_plugin(const char* filename)
+ { this->plugins_.push_back(new Plugin(filename)); }
+
+ // Add an argument to the current plugin.
+ void
+ add_plugin_option(const char* opt)
+ {
+ Plugin* last = this->plugins_.back();
+ last->add_option(opt);
+ }
// Load all plugin libraries.
void