Home | History | Annotate | Download | only in ndk-stack
      1 /* Copyright (C) 2007-2011 The Android Open Source Project
      2 **
      3 ** This software is licensed under the terms of the GNU General Public
      4 ** License version 2, as published by the Free Software Foundation, and
      5 ** may be copied, distributed, and modified under those terms.
      6 **
      7 ** This program is distributed in the hope that it will be useful,
      8 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
      9 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     10 ** GNU General Public License for more details.
     11 */
     12 
     13 #ifndef NDK_CRASH_PARSER_H_
     14 #define NDK_CRASH_PARSER_H_
     15 
     16 /*
     17  * Contains declaration of structures and routines that are used to parse ADB
     18  * log output, filtering out and printing references related to the crash dump.
     19  */
     20 
     21 /* Crash parser descriptor. */
     22 typedef struct NdkCrashParser NdkCrashParser;
     23 
     24 /* Creates and initializes NdkCrashParser descriptor.
     25  * Param:
     26  *  out_handle - Handle to the stream where to print the parser's output.
     27  *    Typically, the handle is is stdout.
     28  *  sym_root - Path to the root directory where symbols are stored. Note that
     29  *    symbol tree starting with that root must match the tree of execuatable
     30  *    modules in the device. I.e. symbols for /path/to/module must be located in
     31  *    <sym_root>/path/to/module
     32  * Return:
     33  *  Pointer to the initialized NdkCrashParser descriptor on success, or NULL on
     34  *  failure.
     35  */
     36 NdkCrashParser* CreateNdkCrashParser(FILE* out_handle, const char* sym_root);
     37 
     38 /* Destroys an NdkCrashParser descriptor.
     39  * Param:
     40  *  parser - NdkCrashParser descriptor, created and initialized with a call to
     41  *    NdkCrashParser routine.
     42  */
     43 void DestroyNdkCrashParser(NdkCrashParser* parser);
     44 
     45 /* Parses a line from the ADB log output.
     46  * Param:
     47  *  parser - NdkCrashParser descriptor, created and initialized with a call to
     48  *    NdkCrashParser routine.
     49  *  line - ADB log output line to parse. The line must be zero-terminated, and
     50  *    must not contain \r, or \n in it.
     51  * Return:
     52  *  0 If the line has been part of the crash dump.
     53  *  1 If the line has not been part of the crash dump.
     54  *  -1 If there was an error when parsing the line.
     55  *
     56 */
     57 int ParseLine(NdkCrashParser* parser, const char* line);
     58 
     59 #endif  // NDK_CRASH_PARSER_H_
     60