aboutsummaryrefslogtreecommitdiff
path: root/gold/debug.h
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2008-03-04 23:10:38 +0000
committerIan Lance Taylor <iant@google.com>2008-03-04 23:10:38 +0000
commitee1fe73e110f7009719b6befefd9fabe94672931 (patch)
tree10b08a9e267cbba7127112fef725dac0dd8f96df /gold/debug.h
parent3954eb47e14c40e07db4ada5069debdc6fd1ae93 (diff)
downloadgdb-ee1fe73e110f7009719b6befefd9fabe94672931.zip
gdb-ee1fe73e110f7009719b6befefd9fabe94672931.tar.gz
gdb-ee1fe73e110f7009719b6befefd9fabe94672931.tar.bz2
From Craig Silverstein: rework option handling to make it easier to
add a new option.
Diffstat (limited to 'gold/debug.h')
-rw-r--r--gold/debug.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/gold/debug.h b/gold/debug.h
index e37e2f1..143c7df 100644
--- a/gold/debug.h
+++ b/gold/debug.h
@@ -36,6 +36,25 @@ const int DEBUG_SCRIPT = 2;
const int DEBUG_ALL = DEBUG_TASK | DEBUG_SCRIPT;
+// Convert a debug string to the appropriate enum.
+inline int
+debug_string_to_enum(const char* arg)
+{
+ static const struct { const char* name; int value; }
+ debug_options[] =
+ {
+ { "task", DEBUG_TASK },
+ { "script", DEBUG_SCRIPT },
+ { "all", DEBUG_ALL }
+ };
+
+ int retval = 0;
+ for (size_t i = 0; i < sizeof(debug_options) / sizeof(*debug_options); ++i)
+ if (strstr(arg, debug_options[i].name))
+ retval |= debug_options[i].value;
+ return retval;
+}
+
// Print a debug message if TYPE is enabled. This is a macro so that
// we only evaluate the arguments if necessary.