File: utf_kernel.stp

package info (click to toggle)
systemtap 5.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 47,556 kB
  • sloc: cpp: 81,117; ansic: 54,933; xml: 49,795; exp: 43,595; sh: 11,526; python: 5,003; perl: 2,252; tcl: 1,312; makefile: 1,006; javascript: 149; lisp: 105; awk: 101; asm: 91; java: 70; sed: 16
file content (49 lines) | stat: -rw-r--r-- 1,678 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
function utf16_addr:long() %{
    static u16 utf16_string[] = {
        0x73, 0x74, 0x61, 0x70, // "stap" (one-byte UTF-8 each)
        0x7F, 0x80,             // last one-byte, first two-byte
        0x391, 0x3A9,           // "ΑΩ" (two-byte UTF-8 each)
        0x7FF, 0x800,           // last two-byte, first three-byte
        0x263A,                 // "☺" (three-byte UTF-8)
        0xFFFF, 0xD800, 0xDC00, // last three-byte, first four-byte
        0xD83D, 0xDE08,         // U+1F608 "😈" (four-byte UTF-8)
        0xDBFF, 0xDFFF,         // last supported four-byte
        0
    };
    STAP_RETVALUE = (intptr_t)utf16_string;
%}

function utf32_addr:long() %{
    static u32 utf32_string[] = {
        0x73, 0x74, 0x61, 0x70, // "stap" (one-byte UTF-8 each)
        0x7F, 0x80,             // last one-byte, first two-byte
        0x391, 0x3A9,           // "ΑΩ" (two-byte UTF-8 each)
        0x7FF, 0x800,           // last two-byte, first three-byte
        0x263A,                 // "☺" (three-byte UTF-8)
        0xFFFF, 0x10000,        // last three-byte, first four-byte
        0x1F608,                // "😈" (four-byte UTF-8)
        0x10FFFF,               // last supported four-byte
        0
    };
    STAP_RETVALUE = (intptr_t)utf32_string;
%}

probe begin
{
  s = utf16_addr();
  for (p = s; i = kernel_short(p) & 0xffff; p += 2)
    printf("%X ", i)
  println(":")
  println(kernel_string_utf16(s))
  println(kernel_string_quoted_utf16(s))

  s = utf32_addr();
  for (p = s; i = kernel_int(p) & 0xffffffff; p += 4)
    printf("%X ", i)
  println(":")
  println(kernel_string_utf32(s))
  println(kernel_string_quoted_utf32(s))

  exit()
}