1 /*
2  * Copyright (C) 2011 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 /*
18  * Handling of method debug info in a .dex file.
19  */
20 
21 #ifndef LIBDEX_DEXDEBUGINFO_H_
22 #define LIBDEX_DEXDEBUGINFO_H_
23 
24 #include "DexFile.h"
25 
26 /*
27  * Callback for "new position table entry".
28  * Returning non-0 causes the decoder to stop early.
29  */
30 typedef int (*DexDebugNewPositionCb)(void *cnxt, u4 address, u4 lineNum);
31 
32 /*
33  * Callback for "new locals table entry". "signature" is an empty string
34  * if no signature is available for an entry.
35  */
36 typedef void (*DexDebugNewLocalCb)(void *cnxt, u2 reg, u4 startAddress,
37         u4 endAddress, const char *name, const char *descriptor,
38         const char *signature);
39 
40 /*
41  * Decode debug info for method.
42  *
43  * posCb is called in ascending address order.
44  * localCb is called in order of ascending end address.
45  */
46 void dexDecodeDebugInfo(
47             const DexFile* pDexFile,
48             const DexCode* pDexCode,
49             const char* classDescriptor,
50             u4 protoIdx,
51             u4 accessFlags,
52             DexDebugNewPositionCb posCb, DexDebugNewLocalCb localCb,
53             void* cnxt);
54 
55 #endif  // LIBDEX_DEXDEBUGINFO_H_
56