Lines Matching refs:parser

92 static int ParseFrame(NdkCrashParser* parser, const char* frame);
138 NdkCrashParser* parser; in CreateNdkCrashParser() local
140 parser = (NdkCrashParser*)calloc(sizeof(*parser), 1); in CreateNdkCrashParser()
141 if (parser == NULL) in CreateNdkCrashParser()
144 parser->out_handle = out_handle; in CreateNdkCrashParser()
145 parser->state = EXPECTS_CRASH_DUMP; in CreateNdkCrashParser()
147 parser->sym_root = strdup(sym_root); in CreateNdkCrashParser()
148 if (!parser->sym_root) in CreateNdkCrashParser()
151 if (regcomp(&parser->re_pid_header, _pid_header, REG_EXTENDED | REG_NEWLINE) || in CreateNdkCrashParser()
152 regcomp(&parser->re_sig_header, _sig_header, REG_EXTENDED | REG_NEWLINE) || in CreateNdkCrashParser()
153 regcomp(&parser->re_frame_header, _frame_header, REG_EXTENDED | REG_NEWLINE)) in CreateNdkCrashParser()
156 return parser; in CreateNdkCrashParser()
159 DestroyNdkCrashParser(parser); in CreateNdkCrashParser()
164 DestroyNdkCrashParser(NdkCrashParser* parser) in DestroyNdkCrashParser() argument
166 if (parser != NULL) { in DestroyNdkCrashParser()
168 regfree(&parser->re_frame_header); in DestroyNdkCrashParser()
169 regfree(&parser->re_sig_header); in DestroyNdkCrashParser()
170 regfree(&parser->re_pid_header); in DestroyNdkCrashParser()
172 free(parser->sym_root); in DestroyNdkCrashParser()
174 free(parser); in DestroyNdkCrashParser()
179 ParseLine(NdkCrashParser* parser, const char* line) in ParseLine() argument
191 if (parser->state != EXPECTS_CRASH_DUMP) { in ParseLine()
193 fprintf(parser->out_handle, "Crash dump is completed\n\n"); in ParseLine()
197 fprintf(parser->out_handle, "********** Crash dump: **********\n"); in ParseLine()
198 parser->state = EXPECTS_BUILD_FINGREPRINT_OR_PID; in ParseLine()
203 switch (parser->state) { in ParseLine()
206 fprintf(parser->out_handle, "%s\n", in ParseLine()
208 parser->state = EXPECTS_PID; in ParseLine()
214 if (MatchRegex(line, &parser->re_pid_header, &match)) { in ParseLine()
215 fprintf(parser->out_handle, "%s\n", line + match.rm_so); in ParseLine()
216 parser->state = EXPECTS_SIGNAL_OR_FRAME; in ParseLine()
223 if (MatchRegex(line, &parser->re_sig_header, &match)) { in ParseLine()
224 fprintf(parser->out_handle, "%s\n", line + match.rm_so); in ParseLine()
225 parser->state = EXPECTS_FRAME; in ParseLine()
231 if (!MatchRegex(line, &parser->re_frame_header, &match)) in ParseLine()
245 parser->state = EXPECTS_FRAME; in ParseLine()
246 return ParseFrame(parser, line + match.rm_so); in ParseLine()
315 ParseFrame(NdkCrashParser* parser, const char* frame) in ParseFrame() argument
333 fprintf(parser->out_handle, "Stack frame %s", frame); in ParseFrame()
337 fprintf(parser->out_handle, in ParseFrame()
366 snprintf(sym_file, sizeof(sym_file), "%s/%s", parser->sym_root, module_name); in ParseFrame()
396 fprintf(parser->out_handle, "\n"); in ParseFrame()
398 fprintf(parser->out_handle, in ParseFrame()
407 fprintf(parser->out_handle, ": Routine %s in %s/%s:%d\n", in ParseFrame()
411 fprintf(parser->out_handle, ": Routine %s in %s:%d\n", in ParseFrame()
418 fprintf(parser->out_handle, in ParseFrame()