summaryrefslogtreecommitdiffstats
path: root/staptree.cxx
diff options
context:
space:
mode:
authorhunt <hunt>2006-04-10 04:53:03 +0000
committerhunt <hunt>2006-04-10 04:53:03 +0000
commitdc0b623a28b4185e155f16a9cf63a8f22c528b5f (patch)
tree335e23bf57e912c02660c7b185d6688fc8058bcb /staptree.cxx
parente06d0f85845165d3d9333fe9e98deade672cd4c8 (diff)
downloadsystemtap-steved-dc0b623a28b4185e155f16a9cf63a8f22c528b5f.tar.gz
systemtap-steved-dc0b623a28b4185e155f16a9cf63a8f22c528b5f.tar.xz
systemtap-steved-dc0b623a28b4185e155f16a9cf63a8f22c528b5f.zip
2006-04-09 Martin Hunt <hunt@redhat.com>
Add binary printf support. * elaborate.cxx (visit_print_format): Don't include conv_literal or conv_size in components vector. Add conv_binary to switch statement. * translate.cxx (visit_print_format): Eliminate special cast to (long long) for pe_long because new vsnprintf uses int64_t. * staptree.h (struct print_format): Add conv_binary and conv_size. * staptree.cxx (components_to_string): Add conv_binary case. Add conv_size case. (string_to_components): Add cases for 'b' and 'n'
Diffstat (limited to 'staptree.cxx')
-rw-r--r--staptree.cxx26
1 files changed, 21 insertions, 5 deletions
diff --git a/staptree.cxx b/staptree.cxx
index 708d7b87..2f62198f 100644
--- a/staptree.cxx
+++ b/staptree.cxx
@@ -1,5 +1,5 @@
// parse tree functions
-// Copyright (C) 2005 Red Hat Inc.
+// Copyright (C) 2005, 2006 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
@@ -388,7 +388,11 @@ print_format::components_to_string(vector<format_component> const & components)
oss << '.' << i->precision;
switch (i->type)
- {
+ {
+ case conv_binary:
+ oss << "b";
+ break;
+
case conv_signed_decimal:
oss << "lld";
break;
@@ -417,6 +421,10 @@ print_format::components_to_string(vector<format_component> const & components)
oss << 's';
break;
+ case conv_size:
+ oss << 'n';
+ break;
+
default:
break;
}
@@ -441,7 +449,7 @@ print_format::string_to_components(string const & str)
{
assert (curr.type == conv_unspecified || curr.type == conv_literal);
curr.type = conv_literal;
- curr.literal_string += *i;
+ curr.literal_string += *i;
++i;
continue;
}
@@ -500,7 +508,7 @@ print_format::string_to_components(string const & str)
curr.flags |= static_cast<unsigned long>(fmt_flag_special);
++i;
break;
-
+
default:
break;
}
@@ -538,6 +546,10 @@ print_format::string_to_components(string const & str)
switch (*i)
{
// Valid conversion types
+ case 'b':
+ curr.type = conv_binary;
+ break;
+
case 's':
curr.type = conv_string;
break;
@@ -566,6 +578,10 @@ print_format::string_to_components(string const & str)
case 'x':
curr.type = conv_unsigned_lowercase_hex;
break;
+
+ case 'n':
+ curr.type = conv_size;
+ break;
default:
break;
@@ -575,7 +591,7 @@ print_format::string_to_components(string const & str)
throw parse_error("invalid or missing conversion specifier");
++i;
- res.push_back(curr);
+ res.push_back(curr);
curr.clear();
}