35
35
36
36
#include < csignal>
37
37
#include < iostream>
38
+ #include < map>
39
+ #include < string>
40
+
38
41
39
42
#include " config.h"
40
43
#include " glog/logging.h"
@@ -133,6 +136,18 @@ TEST(Symbolize, Symbolize) {
133
136
134
137
struct Foo {
135
138
static void func (int x);
139
+ static void longParamFunc (
140
+ std::map<std::map<std::string, std::string>,std::map<std::string, std::string> > p0,
141
+ std::map<std::map<std::string, std::string>,std::map<std::string, std::string> > p1,
142
+ std::map<std::map<std::string, std::string>,std::map<std::string, std::string> > p2,
143
+ std::map<std::map<std::string, std::string>,std::map<std::string, std::string> > p3,
144
+ std::map<std::map<std::string, std::string>,std::map<std::string, std::string> > p4,
145
+ std::map<std::map<std::string, std::string>,std::map<std::string, std::string> > p5,
146
+ std::map<std::map<std::string, std::string>,std::map<std::string, std::string> > p6,
147
+ std::map<std::map<std::string, std::string>,std::map<std::string, std::string> > p7,
148
+ std::map<std::map<std::string, std::string>,std::map<std::string, std::string> > p8,
149
+ std::map<std::map<std::string, std::string>,std::map<std::string, std::string> > p9
150
+ );
136
151
};
137
152
138
153
void ATTRIBUTE_NOINLINE Foo::func (int x) {
@@ -142,6 +157,22 @@ void ATTRIBUTE_NOINLINE Foo::func(int x) {
142
157
a = a + 1 ;
143
158
}
144
159
160
+ void ATTRIBUTE_NOINLINE Foo::longParamFunc (
161
+ std::map<std::map<std::string, std::string>,std::map<std::string, std::string> > p0,
162
+ std::map<std::map<std::string, std::string>,std::map<std::string, std::string> > p1,
163
+ std::map<std::map<std::string, std::string>,std::map<std::string, std::string> > p2,
164
+ std::map<std::map<std::string, std::string>,std::map<std::string, std::string> > p3,
165
+ std::map<std::map<std::string, std::string>,std::map<std::string, std::string> > p4,
166
+ std::map<std::map<std::string, std::string>,std::map<std::string, std::string> > p5,
167
+ std::map<std::map<std::string, std::string>,std::map<std::string, std::string> > p6,
168
+ std::map<std::map<std::string, std::string>,std::map<std::string, std::string> > p7,
169
+ std::map<std::map<std::string, std::string>,std::map<std::string, std::string> > p8,
170
+ std::map<std::map<std::string, std::string>,std::map<std::string, std::string> > p9
171
+ ) {
172
+ volatile auto a = p0.size () + p1.size () + p2.size () + p3.size () + p4.size () + p5.size () + p6.size () + p7.size () + p8.size () + p9.size ();
173
+ a = a + 1 ;
174
+ }
175
+
145
176
// With a modern GCC, Symbolize() should return demangled symbol
146
177
// names. Function parameters should be omitted.
147
178
# ifdef TEST_WITH_MODERN_GCC
@@ -150,6 +181,9 @@ TEST(Symbolize, SymbolizeWithDemangling) {
150
181
# if !defined(_MSC_VER) || !defined(NDEBUG)
151
182
# if defined(HAVE___CXA_DEMANGLE)
152
183
EXPECT_STREQ (" Foo::func(int)" , TrySymbolize ((void *)(&Foo::func)));
184
+ // Very long functions can be truncated, but we should not crash or return null
185
+ // Also the result should start properly.
186
+ EXPECT_TRUE (0 == std::string ( TrySymbolize ( (void *)(&Foo::longParamFunc))).find (" Foo::longParamFunc(" ));
153
187
# else
154
188
EXPECT_STREQ (" Foo::func()" , TrySymbolize ((void *)(&Foo::func)));
155
189
# endif
0 commit comments