1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204
|
Description: Fix FTBFS with gcc 7
Make some functions static.
.
"inline" without "extern" was not correct,
and there is anyway no reason for them to be global.
Author: Adrian Bunk <bunk@debian.org>
Bug-Debian: https://bugs.debian.org/853693
--- undertaker-1.6.1.orig/tailor/src/traceutil-boost.cc
+++ undertaker-1.6.1/tailor/src/traceutil-boost.cc
@@ -43,7 +43,7 @@ int ignoreFileReopenCounter = 0;
* inside a certain module's address range.
*/
-void readModules() {
+static void readModules() {
string moduleLine;
ifstream moduleFile;
loadedModules.clear();
@@ -69,7 +69,7 @@ void readModules() {
* currently present.
*/
-bool addModuleAddr(unsigned long long addr) {
+static bool addModuleAddr(unsigned long long addr) {
for (map<unsigned long long,module>::iterator it=loadedModules.begin() ;
it != loadedModules.end(); it++ ) {
unsigned long long lowAddr = (*it).first;
@@ -89,7 +89,7 @@ bool addModuleAddr(unsigned long long ad
* didn't scan the module table yet, a call to addModuleAddr(addr) is triggered.
*/
-bool addAddr(unsigned long long addr) {
+static bool addAddr(unsigned long long addr) {
// address new?
if (calledAddr.insert(addr).second) {
// module address (if modules enabled)?
@@ -119,7 +119,7 @@ bool addAddr(unsigned long long addr) {
* functions are being encountered.
*/
-void ignoreFunc(string name) {
+static void ignoreFunc(string name) {
// Otherwise, we add the function's name to the ignore list.
if (ignoreFile == NULL
|| ++ignoreFileReopenCounter >= ignoreFileReopenUpperBound) {
--- undertaker-1.6.1.orig/tailor/src/traceutil-native.c
+++ undertaker-1.6.1/tailor/src/traceutil-native.c
@@ -56,7 +56,7 @@ int numberSize=0;
* later test whether a given address is inside a certain module's address range
*/
-void readModules() {
+static void readModules() {
int size = 0;
int parsingMode = 0;
// Open module file
@@ -168,7 +168,7 @@ void readModules() {
* currently present.
*/
-inline bool addModuleAddr(unsigned long long addr) {
+static inline bool addModuleAddr(unsigned long long addr) {
for (j=0; j<loadedModules; j++) {
unsigned long long lowAddr = loadedModule[j].base;
unsigned long long highAddr = lowAddr + loadedModule[j].length;
@@ -215,7 +215,7 @@ inline bool addModuleAddr(unsigned long
* table yet, a call to addModuleAddr(addr) is triggered.
*/
-inline bool addAddr(unsigned long long addr) {
+static inline bool addAddr(unsigned long long addr) {
if (hashadd(addr)) {
// Check if module
if (modulePath != NULL && addr >= moduleBaseAddr) {
@@ -264,7 +264,7 @@ inline bool addAddr(unsigned long long a
* functions are being encountered.
*/
-inline void ignoreFunc(char * callerBuffer, int callerSize) {
+static inline void ignoreFunc(char * callerBuffer, int callerSize) {
// Flushing does not work on debugfs, so we close and reopen the ignore file
if (ignoreFile == -1
|| ++ignorePathReopenCounter >= ignorePathReopenUpperBound) {
--- undertaker-1.6.1.orig/tailor/src/traceutil-native.h
+++ undertaker-1.6.1/tailor/src/traceutil-native.h
@@ -74,10 +74,4 @@ typedef struct module {
int hexCharToDec[256];
char decToHexChar[16];
-//function declarations
-void readModules();
-inline bool addModuleAddr(unsigned long long addr);
-inline bool addAddr(unsigned long long addr);
-inline void ignoreFunc(char * funcbuf, int funcbufp);
-
#endif
--- undertaker-1.6.1.orig/tailor/src/traceutil-stdio.c
+++ undertaker-1.6.1/tailor/src/traceutil-stdio.c
@@ -41,7 +41,7 @@ int ignoreFileReopenCounter = 0;
* later test whether a given address is inside a certain module's address range
*/
-inline void readModules() {
+static inline void readModules() {
FILE * moduleFile;
moduleFile = fopen (modulePath,"r");
// On error, use old version of procmodules
@@ -65,13 +65,39 @@ inline void readModules() {
fclose(moduleFile);
}
+/* This function adds an address from an LKM to the output. Therefore we iterate
+ * the table of modules, and check if the address is between the lower and the
+ * upper bound of any module. If we find the module, we return *true* to signal
+ * success. If we don't find any module matching, we return *false*; this will
+ * tell the caller to call readModules() and therefore rescan the module table
+ * currently present.
+ */
+
+static inline bool addModuleAddr(unsigned long long addr) {
+ int currentModule = 0;
+ // Look in every module
+ while (currentModule < MODULESIZE) {
+ module m = loadedModule[currentModule++];
+ unsigned long long lowAddr = m.base;
+ unsigned long long highAddr = lowAddr + m.length;
+ // If the address is inside the range of a module
+ if (addr>=lowAddr && addr<=highAddr) {
+ unsigned long long relativeAddr = addr-lowAddr;
+ // output the offset and the module's name
+ fprintf(outputFile,"%llx %s\n",relativeAddr, m.name);
+ return true;
+ }
+ }
+ return false;
+}
+
/* This function adds a found address to the output. It also adds the address to
* the internal hash map, so that we can filter out already found addresses. If
* the given address was located inside an LKM or we didn't scan the module
* table yet, a call to addModuleAddr(addr) is triggered.
*/
-inline bool addAddr(unsigned long long addr) {
+static inline bool addAddr(unsigned long long addr) {
// address new?
if (hashadd(addr)) {
// module address (if modules enabled)?
@@ -93,32 +119,6 @@ inline bool addAddr(unsigned long long a
return false;
}
-/* This function adds an address from an LKM to the output. Therefore we iterate
- * the table of modules, and check if the address is between the lower and the
- * upper bound of any module. If we find the module, we return *true* to signal
- * success. If we don't find any module matching, we return *false*; this will
- * tell the caller to call readModules() and therefore rescan the module table
- * currently present.
- */
-
-inline bool addModuleAddr(unsigned long long addr) {
- int currentModule = 0;
- // Look in every module
- while (currentModule < MODULESIZE) {
- module m = loadedModule[currentModule++];
- unsigned long long lowAddr = m.base;
- unsigned long long highAddr = lowAddr + m.length;
- // If the address is inside the range of a module
- if (addr>=lowAddr && addr<=highAddr) {
- unsigned long long relativeAddr = addr-lowAddr;
- // output the offset and the module's name
- fprintf(outputFile,"%llx %s\n",relativeAddr, m.name);
- return true;
- }
- }
- return false;
-}
-
/* This function adds a function to ftraces ignore list and flushes it. We found
* that calling flush() on a file in the debugfs had no effect, so we close and
* reopen the file at given intervals. As there is a lot written to the file in
@@ -127,7 +127,7 @@ inline bool addModuleAddr(unsigned long
* functions are being encountered.
*/
-inline void ignoreFunc(char *name) {
+static inline void ignoreFunc(char *name) {
// Otherwise, we add the function's name to the ignore list.
if (ignoreFile == NULL
|| ++ignoreFileReopenCounter >= ignoreFileReopenUpperBound) {
--- undertaker-1.6.1.orig/tailor/src/traceutil-stdio.h
+++ undertaker-1.6.1/tailor/src/traceutil-stdio.h
@@ -40,10 +40,4 @@ typedef struct module {
char name[MODULENAMELENGTH+3];
} module;
-//function declarations
-inline void readModules();
-inline bool addAddr(unsigned long long addr);
-inline bool addModuleAddr(unsigned long long addr);
-inline void ignoreFunc(char *name);
-
#endif
|