summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordsmith <dsmith>2006-05-05 16:21:56 +0000
committerdsmith <dsmith>2006-05-05 16:21:56 +0000
commit4c82f679ba1653c28c22081117a5c4b6cb9e8984 (patch)
treea6fc750a34a533e0424a67b1459dd6a37c1671ba
parentfd64709f63938fcc8e82c0c7663cad2289f09211 (diff)
downloadsystemtap-steved-4c82f679ba1653c28c22081117a5c4b6cb9e8984.tar.gz
systemtap-steved-4c82f679ba1653c28c22081117a5c4b6cb9e8984.tar.xz
systemtap-steved-4c82f679ba1653c28c22081117a5c4b6cb9e8984.zip
2006-05-05 David Smith <dsmith@redhat.com>
* translate.cxx (mapvar::exists): Added code for string array handling. Otherwise, string array elements always exist.
-rw-r--r--ChangeLog5
-rw-r--r--translate.cxx9
2 files changed, 13 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 00cb5e5c..3c077983 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-05-05 David Smith <dsmith@redhat.com>
+
+ * translate.cxx (mapvar::exists): Added code for string array
+ handling. Otherwise, string array elements always exist.
+
2006-05-03 Josh Stone <joshua.i.stone@intel.com>
PR 2506
diff --git a/translate.cxx b/translate.cxx
index ddbeea0d..30601cf2 100644
--- a/translate.cxx
+++ b/translate.cxx
@@ -550,7 +550,14 @@ struct mapvar
string exists (vector<tmpvar> const & indices) const
{
- return "((uintptr_t)" + call_prefix("get", indices) + ") != (uintptr_t) 0)";
+ if (type() == pe_string)
+ return ("({ char *v = " + call_prefix("get", indices)
+ + "); (v != NULL && *v != '\\0');})");
+ else if ((type() == pe_long) || (type() == pe_stats))
+ return ("((uintptr_t)" + call_prefix("get", indices)
+ + ") != (uintptr_t) 0)");
+ else
+ throw semantic_error("checking existence of an unsupported map type");
}
string get (vector<tmpvar> const & indices, bool pre_agg=false) const