1#include <string>
2#include <map>
3
4#define intint_map std::multimap<int, int>
5#define strint_map std::multimap<std::string, int>
6#define intstr_map std::multimap<int, std::string>
7#define strstr_map std::multimap<std::string, std::string>
8
9int g_the_foo = 0;
10
11int thefoo_rw(int arg = 1)
12{
13 if (arg < 0)
14 arg = 0;
15 if (!arg)
16 arg = 1;
17 g_the_foo += arg;
18 return g_the_foo;
19}
20
21int main()
22{
23 char buffer[sizeof(intint_map)] = {0};
24 intint_map &corrupt_map = *(intint_map *)buffer;
25
26 intint_map ii; // Set break point at this line.
27
28 ii.emplace(args: 0,args: 0); // Set break point at this line.
29 ii.emplace(args: 1,args: 1);
30 thefoo_rw(arg: 1); // Set break point at this line.
31 ii.emplace(args: 2,args: 0);
32 ii.emplace(args: 3,args: 1);
33 thefoo_rw(arg: 1); // Set break point at this line.
34 ii.emplace(args: 4,args: 0);
35 ii.emplace(args: 5,args: 1);
36 ii.emplace(args: 6,args: 0);
37 ii.emplace(args: 7,args: 1);
38 thefoo_rw(arg: 1); // Set break point at this line.
39 ii.emplace(args: 85,args: 1234567);
40
41 ii.clear();
42
43 strint_map si;
44 thefoo_rw(arg: 1); // Set break point at this line.
45
46 si.emplace(args: "zero",args: 0);
47 thefoo_rw(arg: 1); // Set break point at this line.
48 si.emplace(args: "one",args: 1);
49 si.emplace(args: "two",args: 2);
50 si.emplace(args: "three",args: 3);
51 thefoo_rw(arg: 1); // Set break point at this line.
52 si.emplace(args: "four",args: 4);
53
54 si.clear();
55 thefoo_rw(arg: 1); // Set break point at this line.
56
57 intstr_map is;
58 thefoo_rw(arg: 1); // Set break point at this line.
59 is.emplace(args: 85,args: "goofy");
60 is.emplace(args: 1,args: "is");
61 is.emplace(args: 2,args: "smart");
62 is.emplace(args: 3,args: "!!!");
63 thefoo_rw(arg: 1); // Set break point at this line.
64
65 is.clear();
66 thefoo_rw(arg: 1); // Set break point at this line.
67
68 strstr_map ss;
69 thefoo_rw(arg: 1); // Set break point at this line.
70
71 ss.emplace(args: "ciao",args: "hello");
72 ss.emplace(args: "casa",args: "house");
73 ss.emplace(args: "gatto",args: "cat");
74 thefoo_rw(arg: 1); // Set break point at this line.
75 ss.emplace(args: "a Mac..",args: "..is always a Mac!");
76
77 ss.clear();
78 thefoo_rw(arg: 1); // Set break point at this line.
79 return 0;
80}
81

source code of lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/multimap/main.cpp