Lines Matching refs:parser

91 static int ParseFrame(NdkCrashParser* parser, const char* frame);
137 NdkCrashParser* parser; in CreateNdkCrashParser() local
139 parser = (NdkCrashParser*)calloc(sizeof(*parser), 1); in CreateNdkCrashParser()
140 if (parser == NULL) in CreateNdkCrashParser()
143 parser->out_handle = out_handle; in CreateNdkCrashParser()
144 parser->state = EXPECTS_CRASH_DUMP; in CreateNdkCrashParser()
146 parser->sym_root = strdup(sym_root); in CreateNdkCrashParser()
147 if (!parser->sym_root) in CreateNdkCrashParser()
150 if (regcomp(&parser->re_pid_header, _pid_header, REG_EXTENDED | REG_NEWLINE) || in CreateNdkCrashParser()
151 regcomp(&parser->re_sig_header, _sig_header, REG_EXTENDED | REG_NEWLINE) || in CreateNdkCrashParser()
152 regcomp(&parser->re_frame_header, _frame_header, REG_EXTENDED | REG_NEWLINE)) in CreateNdkCrashParser()
155 return parser; in CreateNdkCrashParser()
158 DestroyNdkCrashParser(parser); in CreateNdkCrashParser()
163 DestroyNdkCrashParser(NdkCrashParser* parser) in DestroyNdkCrashParser() argument
165 if (parser != NULL) { in DestroyNdkCrashParser()
167 regfree(&parser->re_frame_header); in DestroyNdkCrashParser()
168 regfree(&parser->re_sig_header); in DestroyNdkCrashParser()
169 regfree(&parser->re_pid_header); in DestroyNdkCrashParser()
171 free(parser->sym_root); in DestroyNdkCrashParser()
173 free(parser); in DestroyNdkCrashParser()
178 ParseLine(NdkCrashParser* parser, const char* line) in ParseLine() argument
190 if (parser->state != EXPECTS_CRASH_DUMP) { in ParseLine()
192 fprintf(parser->out_handle, "Crash dump is completed\n\n"); in ParseLine()
196 fprintf(parser->out_handle, "********** Crash dump: **********\n"); in ParseLine()
197 parser->state = EXPECTS_BUILD_FINGREPRINT_OR_PID; in ParseLine()
202 switch (parser->state) { in ParseLine()
205 fprintf(parser->out_handle, "%s\n", in ParseLine()
207 parser->state = EXPECTS_PID; in ParseLine()
213 if (MatchRegex(line, &parser->re_pid_header, &match)) { in ParseLine()
214 fprintf(parser->out_handle, "%s\n", line + match.rm_so); in ParseLine()
215 parser->state = EXPECTS_SIGNAL_OR_FRAME; in ParseLine()
222 if (MatchRegex(line, &parser->re_sig_header, &match)) { in ParseLine()
223 fprintf(parser->out_handle, "%s\n", line + match.rm_so); in ParseLine()
224 parser->state = EXPECTS_FRAME; in ParseLine()
230 if (!MatchRegex(line, &parser->re_frame_header, &match)) in ParseLine()
244 parser->state = EXPECTS_FRAME; in ParseLine()
245 return ParseFrame(parser, line + match.rm_so); in ParseLine()
314 ParseFrame(NdkCrashParser* parser, const char* frame) in ParseFrame() argument
327 fprintf(parser->out_handle, "Stack frame %s", frame); in ParseFrame()
331 fprintf(parser->out_handle, in ParseFrame()
360 snprintf(sym_file, sizeof(sym_file), "%s/%s", parser->sym_root, module_name); in ParseFrame()