<commit_before>Index: tapset/uconversions.stp
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- tapset/uconversions.stp	(revision df8ae714d682904f8f7aaaeca32b96ba3a602a47)
+++ tapset/uconversions.stp	(revision )
@@ -95,7 +95,7 @@
  * returned as a string, without double quotes.
  */
 function user_string_quoted:string (addr:long) {
-  try { return string_quoted(user_string(addr)) } catch { return sprintf("0x%x", addr) }
+  try { return cuckoo_escape_delimiters(string_quoted(user_string(addr))) } catch { return sprintf("0x%x", addr) }
 }


@@ -359,7 +359,7 @@
  * and UTF-32 decoding as per @user_string_utf32.
  */
 function user_string_quoted_utf32:string (addr:long) {
-  try { return string_quoted(user_string_utf32(addr)) } catch { return sprintf("0x%x", addr) }
+  try { return cuckoo_escape_delimiters(string_quoted(user_string_utf32(addr))) } catch { return sprintf("0x%x", addr) }
 }


@@ -439,7 +439,7 @@
  * and UTF-16 decoding as per @user_string_utf16.
  */
 function user_string_quoted_utf16:string (addr:long) {
-  try { return string_quoted(user_string_utf16(addr)) } catch { return sprintf("0x%x", addr) }
+  try { return cuckoo_escape_delimiters(string_quoted(user_string_utf16(addr))) } catch { return sprintf("0x%x", addr) }
 }


@@ -967,7 +967,11 @@
  * the given address, the address itself is returned as a string, without
  * double quotes.
  */
-function user_buffer_quoted:string (addr:long, inlen:long, outlen:long)
+function user_buffer_quoted:string (addr:long, inlen:long, outlen:long) {
+  return cuckoo_escape_delimiters(user_buffer_quoted_wrapped(addr, inlen, outlen))
+}
+
+function user_buffer_quoted_wrapped:string (addr:long, inlen:long, outlen:long)
 %{
   size_t outlen = (size_t)clamp_t(int, STAP_ARG_outlen, 0, MAXSTRINGLEN);
   if (outlen == 0)
@@ -1002,3 +1006,11 @@
     STAP_ERROR("Unable to access user space data at 0x%lx",
 	       (unsigned long)(void *)(uintptr_t)STAP_ARG_addr);
 %}
+
+function cuckoo_escape_delimiters:string (str:string) {
+  str = str_replace(str, "[", "\\x5b")
+  str = str_replace(str, "]", "\\x5d")
+  str = str_replace(str, "\\\"", "\\x22")
+  str = str_replace(str, ",", "\\x2c")
+  return str
+}<commit_msg>escape struct delimiters<commit_after>Index: tapset/uconversions.stp
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- tapset/uconversions.stp	(revision df8ae714d682904f8f7aaaeca32b96ba3a602a47)
+++ tapset/uconversions.stp	(revision )
@@ -95,7 +95,7 @@
  * returned as a string, without double quotes.
  */
 function user_string_quoted:string (addr:long) {
-  try { return string_quoted(user_string(addr)) } catch { return sprintf("0x%x", addr) }
+  try { return cuckoo_escape_delimiters(string_quoted(user_string(addr))) } catch { return sprintf("0x%x", addr) }
 }


@@ -359,7 +359,7 @@
  * and UTF-32 decoding as per @user_string_utf32.
  */
 function user_string_quoted_utf32:string (addr:long) {
-  try { return string_quoted(user_string_utf32(addr)) } catch { return sprintf("0x%x", addr) }
+  try { return cuckoo_escape_delimiters(string_quoted(user_string_utf32(addr))) } catch { return sprintf("0x%x", addr) }
 }


@@ -439,7 +439,7 @@
  * and UTF-16 decoding as per @user_string_utf16.
  */
 function user_string_quoted_utf16:string (addr:long) {
-  try { return string_quoted(user_string_utf16(addr)) } catch { return sprintf("0x%x", addr) }
+  try { return cuckoo_escape_delimiters(string_quoted(user_string_utf16(addr))) } catch { return sprintf("0x%x", addr) }
 }


@@ -967,7 +967,11 @@
  * the given address, the address itself is returned as a string, without
  * double quotes.
  */
-function user_buffer_quoted:string (addr:long, inlen:long, outlen:long)
+function user_buffer_quoted:string (addr:long, inlen:long, outlen:long) {
+  return cuckoo_escape_delimiters(user_buffer_quoted_wrapped(addr, inlen, outlen))
+}
+
+function user_buffer_quoted_wrapped:string (addr:long, inlen:long, outlen:long)
 %{
   size_t outlen = (size_t)clamp_t(int, STAP_ARG_outlen, 0, MAXSTRINGLEN);
   if (outlen == 0)
@@ -1002,3 +1006,11 @@
     STAP_ERROR("Unable to access user space data at 0x%lx",
 	       (unsigned long)(void *)(uintptr_t)STAP_ARG_addr);
 %}
+
+function cuckoo_escape_delimiters:string (str:string) {
+  str = str_replace(str, "[", "\\x5b")
+  str = str_replace(str, "]", "\\x5d")
+  str = str_replace(str, "{", "\\x7b")
+  str = str_replace(str, "}", "\\x7d")
+  str = str_replace(str, "\\\"", "\\x22")
+  str = str_replace(str, ",", "\\x2c")
+  return str
+}
{'fraction_non_alphanumeric': 0.1807716904711149, 'fraction_numerical': 0.042634832658281815, 'mean_word_length': 5.4186046511627906, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4612699', 'n_tokens_mistral': 1887, 'n_tokens_neox': 1750, 'n_words': 334}