diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | doc/langref.tex | 14 | ||||
-rw-r--r-- | elaborate.cxx | 6 | ||||
-rw-r--r-- | runtime/vsprintf.c | 46 | ||||
-rw-r--r-- | stap.1.in | 9 | ||||
-rw-r--r-- | staptree.cxx | 8 | ||||
-rw-r--r-- | staptree.h | 3 | ||||
-rw-r--r-- | translate.cxx | 4 |
8 files changed, 24 insertions, 73 deletions
@@ -1,3 +1,10 @@ +2008-12-05 Kent Sebastian <ksebasti@redhat.com> + + PR7051 + * doc/langref.tex, elaborate.cxx, runtime/vsprintf.c, + stap.1.in, staptree.cxx, staptree.h, translate.cxx: + Remove printf %n directive and references to it in documentation. + 2008-12-03 Frank Ch. Eigler <fche@elastic.org> PR6925 diff --git a/doc/langref.tex b/doc/langref.tex index 5db82550..3af2bd15 100644 --- a/doc/langref.tex +++ b/doc/langref.tex @@ -1858,16 +1858,10 @@ p& Pointer address& 0x0000000000bc614e\tabularnewline \hline -n& -Writes a binary value that is the total length of the string written by printf. -The field width specifies the number of bytes to write. Valid specifications -are \%n, \%1n, \%2n and \%4n. The default is 2.& -See below\tabularnewline -\hline b& Writes a binary value as text. The field width specifies the number of bytes to write. Valid specifications are \%b, \%1b, \%2b, \%4b and \%8b. The default -width is 4 (32-bits).& +width is 8 (64-bits).& See below\tabularnewline \hline \%& @@ -1987,7 +1981,7 @@ Another example: \begin{vindent} \begin{verbatim} -stap -e 'probe begin{printf("%1n%b%b", 0xc0dedbad, \ +stap -e 'probe begin{printf("%b%b", 0xc0dedbad, \ 0x12345678);exit()}' | hexdump -C \end{verbatim} @@ -1996,8 +1990,8 @@ This prints: \begin{vindent} \begin{verbatim} -00000000 08 ad db de c0 78 56 34 12 |.....xV4.| -00000009 +00000000 ad db de c0 00 00 00 00 78 56 34 12 00 00 00 00 |........xV4.....| +00000010 \end{verbatim} \end{vindent} Another example: diff --git a/elaborate.cxx b/elaborate.cxx index edd4668d..ba1cb79c 100644 --- a/elaborate.cxx +++ b/elaborate.cxx @@ -1167,7 +1167,7 @@ void add_global_var_display (systemtap_session& s) || vut.written.find (l) == vut.written.end()) continue; - // Don't generate synthetic end probes for unread globals + // Don't generate synthetic end probes for unread globals // declared only within tapsets. (RHBZ 468139), but rather // only within the end-user script. @@ -3902,8 +3902,7 @@ typeresolution_info::visit_print_format (print_format* e) if (e->components[i].type == print_format::conv_unspecified) throw semantic_error ("Unspecified conversion in print operator format string", e->tok); - else if (e->components[i].type == print_format::conv_literal - || e->components[i].type == print_format::conv_size) + else if (e->components[i].type == print_format::conv_literal) continue; components.push_back(e->components[i]); ++expected_num_args; @@ -3945,7 +3944,6 @@ typeresolution_info::visit_print_format (print_format* e) { case print_format::conv_unspecified: case print_format::conv_literal: - case print_format::conv_size: assert (false); break; diff --git a/runtime/vsprintf.c b/runtime/vsprintf.c index 4ffcf72e..408e140d 100644 --- a/runtime/vsprintf.c +++ b/runtime/vsprintf.c @@ -136,20 +136,19 @@ int _stp_vsnprintf(char *buf, size_t size, const char *fmt, va_list args) int len; uint64_t num; int i, base; - char *str, *end, c; + char *start, *str, *end, c; const char *s; enum print_flag flags; /* flags to number() */ int field_width; /* width of output field */ int precision; /* min. # of digits for integers; max number of chars for from string */ int qualifier; /* 'h', 'l', or 'L' for integer fields */ - char *write_len_ptr = NULL; - int write_len_width = 0; /* Reject out-of-range values early */ if (unlikely((int) size < 0)) return 0; + start = buf; str = buf; end = buf + size - 1; @@ -172,7 +171,7 @@ int _stp_vsnprintf(char *buf, size_t size, const char *fmt, va_list args) case '#': flags |= STP_SPECIAL; goto repeat; case '0': flags |= STP_ZEROPAD; goto repeat; } - + /* get field width */ field_width = -1; if (isdigit(*fmt)) @@ -190,7 +189,7 @@ int _stp_vsnprintf(char *buf, size_t size, const char *fmt, va_list args) /* get the precision */ precision = -1; if (*fmt == '.') { - ++fmt; + ++fmt; if (isdigit(*fmt)) precision = skip_atoi(&fmt); else if (*fmt == '*') { @@ -283,7 +282,7 @@ int _stp_vsnprintf(char *buf, size_t size, const char *fmt, va_list args) ++str; } continue; - + case 's': case 'm': s = va_arg(args, char *); @@ -332,7 +331,7 @@ int _stp_vsnprintf(char *buf, size_t size, const char *fmt, va_list args) flags |= STP_SIGN; case 'u': break; - + case 'p': /* Note that %p takes an int64_t argument. */ len = 2*sizeof(void *) + 2; @@ -363,16 +362,6 @@ int _stp_vsnprintf(char *buf, size_t size, const char *fmt, va_list args) 16, field_width, field_width, flags); continue; - case 'n': - write_len_ptr = str; - write_len_width = 2; - if (field_width == 1) - write_len_width = 1; - else if (field_width == 4) - write_len_width = 4; - str += write_len_width; - continue; - case '%': if (str <= end) *str = '%'; @@ -436,29 +425,6 @@ int _stp_vsnprintf(char *buf, size_t size, const char *fmt, va_list args) field_width, precision, flags); } - if (write_len_ptr) { - int written; - if (likely(str <= end)) - written = str - write_len_ptr - write_len_width; - else - written = end - write_len_ptr - write_len_width; - - if (likely(write_len_ptr + write_len_width < end)) { - switch (write_len_width) { - case 1: - *(uint8_t *)write_len_ptr = (uint8_t)written; - break; - case 2: - *(uint16_t *)write_len_ptr = (uint16_t)written; - break; - - case 4: - *(uint32_t *)write_len_ptr = (uint32_t)written; - break; - } - } - } - if (likely(str <= end)) *str = '\0'; else if (size > 0) @@ -654,9 +654,6 @@ Signed decimal. %m Safely reads kernel memory at the given address, outputs its content. The width specifier determines the number of bytes to read. Default is 1 byte. .TP -%n -Parameterless. Used in conjunction with %b. Writes a binary value which is the total remaning size of the binary blob being written. The width specifier determines the number of bytes this 'length value' will written as; valid specifiers are %n %1n %2n %4n. Default (%n) is 2 bytes. See example below. -.TP %o Unsigned octal. .TP @@ -694,10 +691,8 @@ Examples: Prints: a is alice; 1234abcd or 1234ABCD or 0x1234abcd; -1 or 18446744073709551615\\n printf("2 bytes of kernel buffer at address %p: %2m", p, p) Prints: 2 byte of kernel buffer at address 0x1234abcd: <binary data> - printf("%1n%4b", p) - Prints (these values as binary data): 0x4 0x1234abcd - * the first byte (due to the 1 on %n) is the remaning number of bytes written by printf - * the subsequent 4 bytes is the value due to %b + printf("%4b", p) + Prints (these values as binary data): 0x1234abcd .ESAMPLE .SS STATISTICS diff --git a/staptree.cxx b/staptree.cxx index 38166c54..51992d7a 100644 --- a/staptree.cxx +++ b/staptree.cxx @@ -494,10 +494,6 @@ print_format::components_to_string(vector<format_component> const & components) oss << 'm'; break; - case conv_size: - oss << 'n'; - break; - default: break; } @@ -684,10 +680,6 @@ print_format::string_to_components(string const & str) curr.type = conv_unsigned_lowercase_hex; break; - case 'n': - curr.type = conv_size; - break; - default: break; } @@ -290,8 +290,7 @@ struct print_format: public expression conv_char, conv_memory, conv_literal, - conv_binary, - conv_size + conv_binary }; enum width_type diff --git a/translate.cxx b/translate.cxx index 12d50617..976bae10 100644 --- a/translate.cxx +++ b/translate.cxx @@ -4736,9 +4736,9 @@ emit_symbol_data (systemtap_session& s) if (s.kernel_build_tree == string("/lib/modules/" + s.kernel_release + "/build")) elfutils_kernel_path = s.kernel_release; else - elfutils_kernel_path = s.kernel_build_tree; + elfutils_kernel_path = s.kernel_build_tree; - int rc = dwfl_linux_kernel_report_offline (dwfl, + int rc = dwfl_linux_kernel_report_offline (dwfl, elfutils_kernel_path.c_str(), NULL /* XXX: filtering callback */); dwfl_report_end (dwfl, NULL, NULL); |