|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Windows debug api implementation for IAddressToLine interface. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __CATADDR2LINE_H__ |
|
19 #define __CATADDR2LINE_H__ |
|
20 |
|
21 #include "iaddresstoline.h" |
|
22 #include "../inc/cataddr2lineserver.h" |
|
23 |
|
24 // Allowed characters in output. |
|
25 //const char ADDR2LINEALLOWEDCHARS[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 :/\\_.-"; |
|
26 |
|
27 class CATAddr2line : public IAddressToLine |
|
28 { |
|
29 |
|
30 public: |
|
31 |
|
32 /** |
|
33 * Constructor |
|
34 */ |
|
35 CATAddr2line(); |
|
36 |
|
37 /** |
|
38 * Open binary. |
|
39 * @sString Full filename with path to binary. |
|
40 * @iLong base address of binary. |
|
41 * @return true if successful. |
|
42 */ |
|
43 bool Open( const string& sString, const unsigned long iLong); |
|
44 |
|
45 /** |
|
46 * Get error string. In case of any method failed use this to acquire details on error. |
|
47 * @return error string. |
|
48 */ |
|
49 string GetError( void ); |
|
50 |
|
51 /** |
|
52 * Close binary. |
|
53 * @return true if succesful. |
|
54 */ |
|
55 bool Close( void ); |
|
56 |
|
57 /** |
|
58 * Locate code line and file for given address. |
|
59 * @result |
|
60 * @return true if successful. |
|
61 */ |
|
62 bool AddressToLine( CATMemoryAddress* result ); |
|
63 |
|
64 #ifndef MODULE_TEST |
|
65 private: |
|
66 #endif |
|
67 |
|
68 // Modules map data (symbols). |
|
69 vector<MAP_FUNC_INFO> m_vMapFileFuncList; |
|
70 |
|
71 //Map file name |
|
72 string m_sMapFileName; |
|
73 |
|
74 //Addr2line server class |
|
75 CATAddr2lineServer server; |
|
76 |
|
77 /** |
|
78 * Get function name for given address. |
|
79 * @iAddress Memory address as unsigned long. |
|
80 * @return Function name as string or empty string if not found. |
|
81 */ |
|
82 string GetFunctionNameUsingAddress( unsigned long iAddress ); |
|
83 |
|
84 /** |
|
85 * Read map file (armv5 platform). |
|
86 * @return true if map file read successfully. |
|
87 */ |
|
88 bool ReadMapFileArmv5(); |
|
89 |
|
90 //Note: New filtering functions commented out until they are taken into use. |
|
91 /** |
|
92 * Filter any char not defined in constant |
|
93 * ADDR2LINEALLOWEDCHARS from given string. |
|
94 * @param sString string to be filtered. |
|
95 */ |
|
96 //void FilterString( string &sString ); |
|
97 |
|
98 /** |
|
99 * Find first occurence of LF/CR from string. |
|
100 * @param sString string to find LF/CR. |
|
101 * @return position of first occurence. |
|
102 */ |
|
103 //size_t FindLineFeed( const string& sString ); |
|
104 |
|
105 /** |
|
106 * Erase all LF/CR from start of the string until other |
|
107 * characters are found. |
|
108 * @param sString string to erase LF/CR. |
|
109 */ |
|
110 //void EraseUntilNoLineFeed( string& sString ); |
|
111 |
|
112 /** |
|
113 * Split string containing multiple lines with mixed line feeds to |
|
114 * vector of lines. |
|
115 * @sMultiLineString string containing multiple lines. |
|
116 * @return vector containing one line per cell. |
|
117 */ |
|
118 //vector<string> SplitToStrings( string& sMultiLineString ); |
|
119 |
|
120 //Debugging for addr2line task. |
|
121 //ofstream debug; |
|
122 }; |
|
123 |
|
124 #endif |