From 489e3d510e3ed9bf4e3388084cc4de6e2749576a Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Fri, 19 Feb 2010 17:45:50 -0500 Subject: PR11208: glue adjacent string literals together. * parse.cxx (lexer::scan): Glue adjacent strings together. * testsuite/parseko/twentyseven.stp, semok/thirtyfive.stp: New tests. --- NEWS | 13 +++++++++++-- parse.cxx | 14 ++++++++++++++ testsuite/parseko/twentyseven.stp | 4 ++++ testsuite/semok/thirtyfive.stp | 8 ++++++++ 4 files changed, 37 insertions(+), 2 deletions(-) create mode 100755 testsuite/parseko/twentyseven.stp create mode 100755 testsuite/semok/thirtyfive.stp diff --git a/NEWS b/NEWS index 82aa205f..8d9fe2bf 100644 --- a/NEWS +++ b/NEWS @@ -1,9 +1,18 @@ * What's new + +- Adjacent string literals are glued together, making this + construct valid: + probe process("/usr" @1 "/bin").function("*") { ... } + - In order to limit potential impact from future security problems, the stap-server process does not permit its being launched as root. -- New : systemtap now supports probes for Hardware Breakpoints on x86 - and x86_64. For syntax details, see man page for stapprobes. +- On recent kernels, for some architectures/configurations, hardware + breakpoint probes are supported. The probe point syntax is: + + probe kernel.data(ADDRESS).write + probe kernel.data(ADDRESS).length(LEN).write + probe kernel.data("SYMBOL_NAME").write * What's new in version 1.1 diff --git a/parse.cxx b/parse.cxx index ad4f93f0..f99a440b 100644 --- a/parse.cxx +++ b/parse.cxx @@ -885,6 +885,7 @@ skip: else if (c == '\"') { n->type = tok_string; + another_string: while (1) { c = input_get (); @@ -924,6 +925,19 @@ skip: else n->content.push_back(c); } + // PR11208: check if the next token is also a string literal; auto-concatenate it + // This is complicated to the extent that we need to skip intermediate whitespace. + // XXX: but not comments + unsigned nspace = 0; + do { + c = input_peek(nspace++); + if (c == '\"') // new string literal? + { + // consume all whitespace plus the opening quote + while (nspace-- > 0) input_get(); + goto another_string; // and append the rest to this token + } + } while (isspace(c)); return n; } diff --git a/testsuite/parseko/twentyseven.stp b/testsuite/parseko/twentyseven.stp new file mode 100755 index 00000000..39c9224a --- /dev/null +++ b/testsuite/parseko/twentyseven.stp @@ -0,0 +1,4 @@ +#! stap -p1 + +# PR 11208 +probe kernel.function ("sys_" /* this comment prevents string gluing */ "open") {} diff --git a/testsuite/semok/thirtyfive.stp b/testsuite/semok/thirtyfive.stp new file mode 100755 index 00000000..325c90fb --- /dev/null +++ b/testsuite/semok/thirtyfive.stp @@ -0,0 +1,8 @@ +#! stap -p2 + +// PR11208 +probe kernel.function("sys""_""open") {} +probe kernel.function("sys" "_" "close") {} +probe kernel.function("p" + "a" "n" "i" + "c") {} -- cgit