summaryrefslogtreecommitdiffstats
path: root/dwarf_wrappers.cxx
diff options
context:
space:
mode:
authorTim Moore <moore@blackbox.bricoworks.com>2008-06-11 11:08:22 +0200
committerTim Moore <moore@blackbox.bricoworks.com>2008-06-11 11:11:54 +0200
commit86bf665eac22efa78936a3059e7bc90ee10dcf4b (patch)
tree3492e0f5b84f66c25bf5d2d33190dcba479ed8f4 /dwarf_wrappers.cxx
parent335972be354a791757e475417c955efd9a45f03d (diff)
downloadsystemtap-steved-86bf665eac22efa78936a3059e7bc90ee10dcf4b.tar.gz
systemtap-steved-86bf665eac22efa78936a3059e7bc90ee10dcf4b.tar.xz
systemtap-steved-86bf665eac22efa78936a3059e7bc90ee10dcf4b.zip
PR 2608 plus some refactoring in tapsets.cxx
New dwarf_wrappers.h, dwarf_wrappers.cxx for for idiomatic access to libdwarf and refactoring somethings out of the giant classes in tapsets.cxx.
Diffstat (limited to 'dwarf_wrappers.cxx')
-rw-r--r--dwarf_wrappers.cxx40
1 files changed, 40 insertions, 0 deletions
diff --git a/dwarf_wrappers.cxx b/dwarf_wrappers.cxx
new file mode 100644
index 00000000..ad690d78
--- /dev/null
+++ b/dwarf_wrappers.cxx
@@ -0,0 +1,40 @@
+// -*- C++ -*-
+// Copyright (C) 2008 Red Hat Inc.
+//
+// This file is part of systemtap, and is free software. You can
+// redistribute it and/or modify it under the terms of the GNU General
+// Public License (GPL); either version 2, or (at your option) any
+// later version.
+
+#include "dwarf_wrappers.h"
+#include "staptree.h"
+
+#include <cstring>
+#include <string>
+#include <elfutils/libdwfl.h>
+
+using std::string;
+
+void dwfl_assert(const string& desc, int rc)
+{
+ if (rc == 0)
+ return;
+ string msg = "libdwfl failure (" + desc + "): ";
+ if (rc < 0)
+ msg += dwfl_errmsg (rc);
+ else
+ msg += std::strerror (rc);
+ throw semantic_error (msg);
+}
+
+void dwarf_assert(const string& desc, int rc)
+{
+ if (rc == 0)
+ return;
+ string msg = "libdw failure (" + desc + "): ";
+ if (rc < 0)
+ msg += dwarf_errmsg (rc);
+ else
+ msg += std::strerror (rc);
+ throw semantic_error (msg);
+}