| Line | Source | Count |
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | extern int interrupt_immediately, running_trap; | - |
| 7 | extern int signal_is_trapped (int); | - |
| 8 | | - |
| 9 | | - |
| 10 | extern int malloc_register; | - |
| 11 | | - |
| 12 | | - |
| 13 | | - |
| 14 | extern FILE *_imalloc_fopen (char *, char *, char *, char *, size_t); | - |
| 15 | | - |
| 16 | | - |
| 17 | | - |
| 18 | | - |
| 19 | static int table_count = 0; | - |
| 20 | static int table_allocated = 0; | - |
| 21 | static int table_bucket_index = 8192 -1; | - |
| 22 | static mr_table_t mem_table[8192]; | - |
| 23 | static mr_table_t mem_overflow; | - |
| 24 | | - |
| 25 | | - |
| 26 | | - |
| 27 | | - |
| 28 | | - |
| 29 | static int location_table_index = 0; | - |
| 30 | static int location_table_count = 0; | - |
| 31 | static ma_table_t mlocation_table[8192]; | - |
| 32 | | - |
| 33 | | - |
| 34 | | - |
| 35 | | - |
| 36 | static unsigned int | - |
| 37 | mt_hash (key) | - |
| 38 | const void * key; | - |
| 39 | { | - |
| 40 | unsigned int a, b, c; | - |
| 41 | unsigned long x; | - |
| 42 | | - |
| 43 | | - |
| 44 | a = 0x9e3779b9; | - |
| 45 | x = (unsigned long)key; | - |
| 46 | b = x >> 8; | - |
| 47 | c = x >> 3; | - |
| 48 | | - |
| 49 | do { a -= b; a -= c; a ^= (c >> 13); b -= c; b -= a; b ^= (a << 8); c -= a; c -= b; c ^= (b >> 13); a -= b; a -= c; a ^= (c >> 12); b -= c; b -= a; b ^= (a << 16); c -= a; c -= b; c ^= (b >> 5); a -= b; a -= c; a ^= (c >> 3); b -= c; b -= a; b ^= (a << 10); c -= a; c -= b; c ^= (b >> 15); } while(0); | - |
| 50 | return never executed: return c; c;never executed: return c; | 0 |
| 51 | } | - |
| 52 | static mr_table_t * | - |
| 53 | find_entry (mem, flags) | - |
| 54 | void * mem; | - |
| 55 | int flags; | - |
| 56 | { | - |
| 57 | unsigned int bucket; | - |
| 58 | register mr_table_t *tp; | - |
| 59 | mr_table_t *endp; | - |
| 60 | | - |
| 61 | if (mem_overflow.mem == mem| TRUE | never evaluated | | FALSE | evaluated 2147483647 times by 1 test |
) | 0-Inf |
| 62 | return never executed: return (&mem_overflow); (&mem_overflow);never executed: return (&mem_overflow); | 0 |
| 63 | | - |
| 64 | | - |
| 65 | if (flags & 0x01| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 2147483647 times by 1 test |
) | Inf |
| 66 | { | - |
| 67 | table_bucket_index = ((table_bucket_index + 1) & (8192 -1)); | - |
| 68 | table_count++; | - |
| 69 | tp = mem_table + table_bucket_index; | - |
| 70 | memset(tp, 0, sizeof (mr_table_t)); | - |
| 71 | returnexecuted 2147483647 times by 1 test: return tp; tp;executed 2147483647 times by 1 test: return tp; | Inf |
| 72 | } | - |
| 73 | | - |
| 74 | tp = endp = mem_table + table_bucket_index; | - |
| 75 | | - |
| 76 | | - |
| 77 | while (1) | - |
| 78 | { | - |
| 79 | if (tp->mem == mem| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 2147483647 times by 1 test |
) | Inf |
| 80 | returnexecuted 2147483647 times by 1 test: return (tp); (tp);executed 2147483647 times by 1 test: return (tp); | Inf |
| 81 | | - |
| 82 | tp = ((| TRUE | evaluated 140382971 times by 1 test | | FALSE | evaluated 2147483647 times by 1 test |
tp == mem_table)| TRUE | evaluated 140382971 times by 1 test | | FALSE | evaluated 2147483647 times by 1 test |
? mem_table + 8192 - 1 : tp - 1); | 140382971-Inf |
| 83 | | - |
| 84 | | - |
| 85 | if (tp == endp| TRUE | evaluated 14615973 times by 1 test | | FALSE | evaluated 2147483647 times by 1 test |
) | 14615973-Inf |
| 86 | returnexecuted 14615973 times by 1 test: return ((mr_table_t *) ((void *)0) ); ((mr_table_t *)executed 14615973 times by 1 test: return ((mr_table_t *) ((void *)0) ); | 14615973 |
| 87 | ((void *)0)executed 14615973 times by 1 test: return ((mr_table_t *) ((void *)0) ); | 14615973 |
| 88 | );executed 14615973 times by 1 test: return ((mr_table_t *) ((void *)0) ); | 14615973 |
| 89 | }executed 2147483647 times by 1 test: end of block | Inf |
| 90 | | - |
| 91 | return never executed: return (mr_table_t *) ((void *)0) ; (mr_table_t *)never executed: return (mr_table_t *) ((void *)0) ; | 0 |
| 92 | ((void *)0) never executed: return (mr_table_t *) ((void *)0) ; | 0 |
| 93 | ; never executed: return (mr_table_t *) ((void *)0) ; | 0 |
| 94 | } | - |
| 95 | | - |
| 96 | mr_table_t * | - |
| 97 | mr_table_entry (mem) | - |
| 98 | void * mem; | - |
| 99 | { | - |
| 100 | return never executed: return (find_entry (mem, 0x02)); (find_entry (mem, 0x02));never executed: return (find_entry (mem, 0x02)); | 0 |
| 101 | } | - |
| 102 | | - |
| 103 | void | - |
| 104 | mregister_describe_mem (mem, fp) | - |
| 105 | void * mem; | - |
| 106 | FILE *fp; | - |
| 107 | { | - |
| 108 | mr_table_t *entry; | - |
| 109 | | - |
| 110 | entry = find_entry (mem, 0x02); | - |
| 111 | if (entry == 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 112 | return; never executed: return; | 0 |
| 113 | fprintf (fp, "malloc: %p: %s: last %s from %s:%d\n", | - |
| 114 | mem, | - |
| 115 | (entry->flags & 0x01) ? "allocated" : "free", | - |
| 116 | (entry->flags & 0x01) ? "allocated" : "freed", | - |
| 117 | entry->file ? entry->file : "unknown", | - |
| 118 | entry->line); | - |
| 119 | } never executed: end of block | 0 |
| 120 | | - |
| 121 | void | - |
| 122 | mregister_alloc (tag, mem, size, file, line) | - |
| 123 | const char *tag; | - |
| 124 | void * mem; | - |
| 125 | size_t size; | - |
| 126 | const char *file; | - |
| 127 | int line; | - |
| 128 | { | - |
| 129 | mr_table_t *tentry; | - |
| 130 | sigset_t set, oset; | - |
| 131 | int blocked_sigs; | - |
| 132 | | - |
| 133 | | - |
| 134 | blocked_sigs = 0; | - |
| 135 | | - |
| 136 | if (interrupt_immediately| TRUE | never evaluated | | FALSE | evaluated 2147483647 times by 1 test |
|| running_trap| TRUE | evaluated 308689 times by 1 test | | FALSE | evaluated 2147483647 times by 1 test |
|| signal_is_trapped (| TRUE | evaluated 10184 times by 1 test | | FALSE | evaluated 2147483647 times by 1 test |
| 0-Inf |
| 137 | 2| TRUE | evaluated 10184 times by 1 test | | FALSE | evaluated 2147483647 times by 1 test |
| 10184-Inf |
| 138 | )| TRUE | evaluated 10184 times by 1 test | | FALSE | evaluated 2147483647 times by 1 test |
|| signal_is_trapped (| TRUE | evaluated 53 times by 1 test | | FALSE | evaluated 2147483647 times by 1 test |
| 53-Inf |
| 139 | 17| TRUE | evaluated 53 times by 1 test | | FALSE | evaluated 2147483647 times by 1 test |
| 53-Inf |
| 140 | )| TRUE | evaluated 53 times by 1 test | | FALSE | evaluated 2147483647 times by 1 test |
) | 53-Inf |
| 141 | | - |
| 142 | { | - |
| 143 | _malloc_block_signals (&set, &oset); | - |
| 144 | blocked_sigs = 1; | - |
| 145 | }executed 318926 times by 1 test: end of block | 318926 |
| 146 | | - |
| 147 | mlocation_register_alloc (file, line); | - |
| 148 | | - |
| 149 | tentry = find_entry (mem, 0x01); | - |
| 150 | | - |
| 151 | if (tentry == 0| TRUE | never evaluated | | FALSE | evaluated 2147483647 times by 1 test |
) | 0-Inf |
| 152 | { | - |
| 153 | | - |
| 154 | fprintf ( | - |
| 155 | stderr | - |
| 156 | , | - |
| 157 | dcgettext (((void *)0), | - |
| 158 | "register_alloc: alloc table is full with FIND_ALLOC?\n" | - |
| 159 | , 5) | - |
| 160 | ); | - |
| 161 | if (blocked_sigs| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 162 | _malloc_unblock_signals (&set, &oset); never executed: _malloc_unblock_signals (&set, &oset); | 0 |
| 163 | return; never executed: return; | 0 |
| 164 | } | - |
| 165 | | - |
| 166 | if (tentry->flags & 0x01| TRUE | never evaluated | | FALSE | evaluated 2147483647 times by 1 test |
) | 0-Inf |
| 167 | { | - |
| 168 | | - |
| 169 | fprintf ( | - |
| 170 | stderr | - |
| 171 | , | - |
| 172 | dcgettext (((void *)0), | - |
| 173 | "register_alloc: %p already in table as allocated?\n" | - |
| 174 | , 5) | - |
| 175 | , mem); | - |
| 176 | } never executed: end of block | 0 |
| 177 | | - |
| 178 | tentry->mem = mem; | - |
| 179 | tentry->size = size; | - |
| 180 | tentry->func = tag; | - |
| 181 | tentry->flags = 0x01; | - |
| 182 | tentry->file = file; | - |
| 183 | tentry->line = line; | - |
| 184 | tentry->nalloc++; | - |
| 185 | | - |
| 186 | if (tentry != &mem_overflow| TRUE | evaluated 2147483647 times by 1 test | | FALSE | never evaluated |
) | 0-Inf |
| 187 | table_allocated++;executed 2147483647 times by 1 test: table_allocated++; | Inf |
| 188 | | - |
| 189 | if (blocked_sigs| TRUE | evaluated 318926 times by 1 test | | FALSE | evaluated 2147483647 times by 1 test |
) | 318926-Inf |
| 190 | _malloc_unblock_signals (&set, &oset);executed 318926 times by 1 test: _malloc_unblock_signals (&set, &oset); | 318926 |
| 191 | }executed 2147483647 times by 1 test: end of block | Inf |
| 192 | | - |
| 193 | void | - |
| 194 | mregister_free (mem, size, file, line) | - |
| 195 | void * mem; | - |
| 196 | int size; | - |
| 197 | const char *file; | - |
| 198 | int line; | - |
| 199 | { | - |
| 200 | mr_table_t *tentry; | - |
| 201 | sigset_t set, oset; | - |
| 202 | int blocked_sigs; | - |
| 203 | | - |
| 204 | | - |
| 205 | blocked_sigs = 0; | - |
| 206 | | - |
| 207 | if (interrupt_immediately| TRUE | never evaluated | | FALSE | evaluated 2147483647 times by 1 test |
|| running_trap| TRUE | evaluated 292347 times by 1 test | | FALSE | evaluated 2147483647 times by 1 test |
|| signal_is_trapped (| TRUE | evaluated 10902 times by 1 test | | FALSE | evaluated 2147483647 times by 1 test |
| 0-Inf |
| 208 | 2| TRUE | evaluated 10902 times by 1 test | | FALSE | evaluated 2147483647 times by 1 test |
| 10902-Inf |
| 209 | )| TRUE | evaluated 10902 times by 1 test | | FALSE | evaluated 2147483647 times by 1 test |
|| signal_is_trapped (| TRUE | evaluated 60 times by 1 test | | FALSE | evaluated 2147483647 times by 1 test |
| 60-Inf |
| 210 | 17| TRUE | evaluated 60 times by 1 test | | FALSE | evaluated 2147483647 times by 1 test |
| 60-Inf |
| 211 | )| TRUE | evaluated 60 times by 1 test | | FALSE | evaluated 2147483647 times by 1 test |
) | 60-Inf |
| 212 | | - |
| 213 | { | - |
| 214 | _malloc_block_signals (&set, &oset); | - |
| 215 | blocked_sigs = 1; | - |
| 216 | }executed 303309 times by 1 test: end of block | 303309 |
| 217 | | - |
| 218 | tentry = find_entry (mem, 0x02); | - |
| 219 | if (tentry == 0| TRUE | evaluated 14615973 times by 1 test | | FALSE | evaluated 2147483647 times by 1 test |
) | 14615973-Inf |
| 220 | { | - |
| 221 | | - |
| 222 | | - |
| 223 | | - |
| 224 | | - |
| 225 | if (blocked_sigs| TRUE | evaluated 72 times by 1 test | | FALSE | evaluated 14615901 times by 1 test |
) | 72-14615901 |
| 226 | _malloc_unblock_signals (&set, &oset);executed 72 times by 1 test: _malloc_unblock_signals (&set, &oset); | 72 |
| 227 | return;executed 14615973 times by 1 test: return; | 14615973 |
| 228 | } | - |
| 229 | if (tentry->flags & 0x02| TRUE | never evaluated | | FALSE | evaluated 2147483647 times by 1 test |
) | 0-Inf |
| 230 | { | - |
| 231 | | - |
| 232 | fprintf ( | - |
| 233 | stderr | - |
| 234 | , | - |
| 235 | dcgettext (((void *)0), | - |
| 236 | "register_free: %p already in table as free?\n" | - |
| 237 | , 5) | - |
| 238 | , mem); | - |
| 239 | } never executed: end of block | 0 |
| 240 | | - |
| 241 | tentry->flags = 0x02; | - |
| 242 | tentry->func = "free"; | - |
| 243 | tentry->file = file; | - |
| 244 | tentry->line = line; | - |
| 245 | tentry->nfree++; | - |
| 246 | | - |
| 247 | if (tentry != &mem_overflow| TRUE | evaluated 2147483647 times by 1 test | | FALSE | never evaluated |
) | 0-Inf |
| 248 | table_allocated--;executed 2147483647 times by 1 test: table_allocated--; | Inf |
| 249 | | - |
| 250 | if (blocked_sigs| TRUE | evaluated 303237 times by 1 test | | FALSE | evaluated 2147483647 times by 1 test |
) | 303237-Inf |
| 251 | _malloc_unblock_signals (&set, &oset);executed 303237 times by 1 test: _malloc_unblock_signals (&set, &oset); | 303237 |
| 252 | }executed 2147483647 times by 1 test: end of block | Inf |
| 253 | | - |
| 254 | | - |
| 255 | static char * | - |
| 256 | _entry_flags(x) | - |
| 257 | int x; | - |
| 258 | { | - |
| 259 | if (x & 0x02| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 260 | return never executed: return "free"; "free";never executed: return "free"; | 0 |
| 261 | else if (x & 0x01| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 262 | return never executed: return "allocated"; "allocated";never executed: return "allocated"; | 0 |
| 263 | else | - |
| 264 | return never executed: return "undetermined?"; "undetermined?";never executed: return "undetermined?"; | 0 |
| 265 | } | - |
| 266 | | - |
| 267 | static void | - |
| 268 | _register_dump_table(fp) | - |
| 269 | FILE *fp; | - |
| 270 | { | - |
| 271 | register int i; | - |
| 272 | mr_table_t entry; | - |
| 273 | | - |
| 274 | for (i = 0; i < 8192| TRUE | never evaluated | | FALSE | never evaluated |
; i++) | 0 |
| 275 | { | - |
| 276 | entry = mem_table[i]; | - |
| 277 | if (entry.mem| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 278 | fprintf (fp, "%s[%d] %p:%zu:%s:%s:%s:%d:%d:%d\n", never executed: fprintf (fp, "%s[%d] %p:%zu:%s:%s:%s:%d:%d:%d\n", (i == table_bucket_index) ? "*" : "", i, entry.mem, entry.size, _entry_flags(entry.flags), entry.func ? entry.func : "unknown", entry.file ? entry.file : "unknown", entry.line, entry.nalloc, entry.nfree); | 0 |
| 279 | (i == table_bucket_index) ? "*" : "", never executed: fprintf (fp, "%s[%d] %p:%zu:%s:%s:%s:%d:%d:%d\n", (i == table_bucket_index) ? "*" : "", i, entry.mem, entry.size, _entry_flags(entry.flags), entry.func ? entry.func : "unknown", entry.file ? entry.file : "unknown", entry.line, entry.nalloc, entry.nfree); | 0 |
| 280 | i, never executed: fprintf (fp, "%s[%d] %p:%zu:%s:%s:%s:%d:%d:%d\n", (i == table_bucket_index) ? "*" : "", i, entry.mem, entry.size, _entry_flags(entry.flags), entry.func ? entry.func : "unknown", entry.file ? entry.file : "unknown", entry.line, entry.nalloc, entry.nfree); | 0 |
| 281 | entry.mem, entry.size, never executed: fprintf (fp, "%s[%d] %p:%zu:%s:%s:%s:%d:%d:%d\n", (i == table_bucket_index) ? "*" : "", i, entry.mem, entry.size, _entry_flags(entry.flags), entry.func ? entry.func : "unknown", entry.file ? entry.file : "unknown", entry.line, entry.nalloc, entry.nfree); | 0 |
| 282 | _entry_flags(entry.flags), never executed: fprintf (fp, "%s[%d] %p:%zu:%s:%s:%s:%d:%d:%d\n", (i == table_bucket_index) ? "*" : "", i, entry.mem, entry.size, _entry_flags(entry.flags), entry.func ? entry.func : "unknown", entry.file ? entry.file : "unknown", entry.line, entry.nalloc, entry.nfree); | 0 |
| 283 | entry.func ? entry.func : "unknown", never executed: fprintf (fp, "%s[%d] %p:%zu:%s:%s:%s:%d:%d:%d\n", (i == table_bucket_index) ? "*" : "", i, entry.mem, entry.size, _entry_flags(entry.flags), entry.func ? entry.func : "unknown", entry.file ? entry.file : "unknown", entry.line, entry.nalloc, entry.nfree); | 0 |
| 284 | entry.file ? entry.file : "unknown", never executed: fprintf (fp, "%s[%d] %p:%zu:%s:%s:%s:%d:%d:%d\n", (i == table_bucket_index) ? "*" : "", i, entry.mem, entry.size, _entry_flags(entry.flags), entry.func ? entry.func : "unknown", entry.file ? entry.file : "unknown", entry.line, entry.nalloc, entry.nfree); | 0 |
| 285 | entry.line, never executed: fprintf (fp, "%s[%d] %p:%zu:%s:%s:%s:%d:%d:%d\n", (i == table_bucket_index) ? "*" : "", i, entry.mem, entry.size, _entry_flags(entry.flags), entry.func ? entry.func : "unknown", entry.file ? entry.file : "unknown", entry.line, entry.nalloc, entry.nfree); | 0 |
| 286 | entry.nalloc, entry.nfree); never executed: fprintf (fp, "%s[%d] %p:%zu:%s:%s:%s:%d:%d:%d\n", (i == table_bucket_index) ? "*" : "", i, entry.mem, entry.size, _entry_flags(entry.flags), entry.func ? entry.func : "unknown", entry.file ? entry.file : "unknown", entry.line, entry.nalloc, entry.nfree); | 0 |
| 287 | } never executed: end of block | 0 |
| 288 | } never executed: end of block | 0 |
| 289 | | - |
| 290 | void | - |
| 291 | mregister_dump_table() | - |
| 292 | { | - |
| 293 | _register_dump_table ( | - |
| 294 | stderr | - |
| 295 | ); | - |
| 296 | } never executed: end of block | 0 |
| 297 | | - |
| 298 | void | - |
| 299 | mregister_table_init () | - |
| 300 | { | - |
| 301 | memset (mem_table, 0, sizeof(mr_table_t) * 8192); | - |
| 302 | memset (&mem_overflow, 0, sizeof (mr_table_t)); | - |
| 303 | table_count = 0; | - |
| 304 | } never executed: end of block | 0 |
| 305 | | - |
| 306 | | - |
| 307 | | - |
| 308 | static ma_table_t * | - |
| 309 | find_location_entry (file, line) | - |
| 310 | const char *file; | - |
| 311 | int line; | - |
| 312 | { | - |
| 313 | register ma_table_t *tp, *endp; | - |
| 314 | | - |
| 315 | endp = mlocation_table + location_table_count; | - |
| 316 | for (tp = mlocation_table; tp <= endp| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 660636 times by 1 test |
; tp++) | 660636-Inf |
| 317 | { | - |
| 318 | if (tp->line == line| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 2147483647 times by 1 test |
&& ((| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 1687675 times by 1 test |
file)[0] == (tp->file)[0]| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 1687675 times by 1 test |
&& | 1687675-Inf |
| 319 | __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 320 | file| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 321 | ) && __builtin_constant_p (| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 322 | tp->file| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 323 | ) && (__s1_len = __builtin_strlen (| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 324 | file| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 325 | ), __s2_len = __builtin_strlen (| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 326 | tp->file| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 327 | ), (!((size_t)(const void *)((| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 328 | file| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 329 | ) + 1) - (size_t)(const void *)(| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 330 | file| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 331 | ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 332 | tp->file| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 333 | ) + 1) - (size_t)(const void *)(| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 334 | tp->file| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 335 | ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 336 | file| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 337 | , | TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 338 | tp->file| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 339 | ) : (__builtin_constant_p (| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 340 | file| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 341 | ) && ((size_t)(const void *)((| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 342 | file| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 343 | ) + 1) - (size_t)(const void *)(| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 344 | file| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 345 | ) == 1) && (__s1_len = __builtin_strlen (| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 346 | file| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 347 | ), __s1_len < 4) ? (__builtin_constant_p (| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 348 | tp->file| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 349 | ) && ((size_t)(const void *)((| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 350 | tp->file| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 351 | ) + 1) - (size_t)(const void *)(| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 352 | tp->file| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 353 | ) == 1) ? __builtin_strcmp (| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 354 | file| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 355 | , | TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 356 | tp->file| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 357 | ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 358 | tp->file| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 359 | ); int __result = (((const unsigned char *) (const char *) (| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 360 | file| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 361 | ))[0] - __s2[0]); if (__s1_len > 0| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | never evaluated | | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 0-Inf |
| 362 | file| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 363 | ))[1] - __s2[1]); if (__s1_len > 1| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | never evaluated | | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 0-Inf |
| 364 | file| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 365 | ))[2] - __s2[2]); if (__s1_len > 2| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | never evaluated | | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( file ))[3] - __s2[3]); | TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 0-Inf |
| 366 | file| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
never executed: __result = (((const unsigned char *) (const char *) ( file ))[3] - __s2[3]); | 0-Inf |
| 367 | ))[3] - __s2[3]);| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
never executed: __result = (((const unsigned char *) (const char *) ( file ))[3] - __s2[3]); }never executed: end of block }never executed: end of block __result; }))) : (__builtin_constant_p (| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 0-Inf |
| 368 | tp->file| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 369 | ) && ((size_t)(const void *)((| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 370 | tp->file| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 371 | ) + 1) - (size_t)(const void *)(| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 372 | tp->file| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 373 | ) == 1) && (__s2_len = __builtin_strlen (| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 374 | tp->file| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 375 | ), __s2_len < 4) ? (__builtin_constant_p (| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 376 | file| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 377 | ) && ((size_t)(const void *)((| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 378 | file| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 379 | ) + 1) - (size_t)(const void *)(| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 380 | file| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 381 | ) == 1) ? __builtin_strcmp (| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 382 | file| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 383 | , | TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 384 | tp->file| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 385 | ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 386 | file| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 387 | ); int __result = (((const unsigned char *) (const char *) (| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 388 | tp->file| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 389 | ))[0] - __s2[0]); if (__s2_len > 0| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | never evaluated | | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 0-Inf |
| 390 | tp->file| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 391 | ))[1] - __s2[1]); if (__s2_len > 1| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | never evaluated | | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 0-Inf |
| 392 | tp->file| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 393 | ))[2] - __s2[2]); if (__s2_len > 2| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | never evaluated | | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( tp->file ))[3] - __s2[3]); | TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 0-Inf |
| 394 | tp->file| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
never executed: __result = (((const unsigned char *) (const char *) ( tp->file ))[3] - __s2[3]); | 0-Inf |
| 395 | ))[3] - __s2[3]);| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
never executed: __result = (((const unsigned char *) (const char *) ( tp->file ))[3] - __s2[3]); }never executed: end of block }never executed: end of block __result; }))) : __builtin_strcmp (| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 0-Inf |
| 396 | file| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 397 | , | TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 398 | tp->file| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 399 | )))); }) | TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
| 591-Inf |
| 400 | == 0| TRUE | evaluated 2147483647 times by 1 test | | FALSE | evaluated 591 times by 1 test |
)) | 591-Inf |
| 401 | returnexecuted 2147483647 times by 1 test: return tp; tp;executed 2147483647 times by 1 test: return tp; | Inf |
| 402 | }executed 2147483647 times by 1 test: end of block | Inf |
| 403 | returnexecuted 660636 times by 1 test: return (ma_table_t *) ((void *)0) ; (ma_table_t *)executed 660636 times by 1 test: return (ma_table_t *) ((void *)0) ; | 660636 |
| 404 | ((void *)0)executed 660636 times by 1 test: return (ma_table_t *) ((void *)0) ; | 660636 |
| 405 | ;executed 660636 times by 1 test: return (ma_table_t *) ((void *)0) ; | 660636 |
| 406 | } | - |
| 407 | | - |
| 408 | void | - |
| 409 | mlocation_register_alloc (file, line) | - |
| 410 | const char *file; | - |
| 411 | int line; | - |
| 412 | { | - |
| 413 | ma_table_t *lentry; | - |
| 414 | const char *nfile; | - |
| 415 | | - |
| 416 | if (file == 0| TRUE | evaluated 121534248 times by 1 test | | FALSE | evaluated 2147483647 times by 1 test |
) | 121534248-Inf |
| 417 | { | - |
| 418 | mlocation_table[0].nalloc++; | - |
| 419 | return;executed 121534248 times by 1 test: return; | 121534248 |
| 420 | } | - |
| 421 | | - |
| 422 | nfile = strrchr (file, '/'); | - |
| 423 | if (nfile| TRUE | evaluated 8798396 times by 1 test | | FALSE | evaluated 2147483647 times by 1 test |
) | 8798396-Inf |
| 424 | nfile++;executed 8798396 times by 1 test: nfile++; | 8798396 |
| 425 | else | - |
| 426 | nfile = file;executed 2147483647 times by 1 test: nfile = file; | Inf |
| 427 | | - |
| 428 | lentry = find_location_entry (nfile, line); | - |
| 429 | if (lentry == 0| TRUE | evaluated 660636 times by 1 test | | FALSE | evaluated 2147483647 times by 1 test |
) | 660636-Inf |
| 430 | { | - |
| 431 | location_table_index++; | - |
| 432 | if (location_table_index == 8192| TRUE | never evaluated | | FALSE | evaluated 660636 times by 1 test |
) | 0-660636 |
| 433 | location_table_index = 1; never executed: location_table_index = 1; | 0 |
| 434 | lentry = mlocation_table + location_table_index; | - |
| 435 | lentry->file = nfile; | - |
| 436 | lentry->line = line; | - |
| 437 | lentry->nalloc = 1; | - |
| 438 | if (location_table_count < 8192| TRUE | evaluated 660636 times by 1 test | | FALSE | never evaluated |
) | 0-660636 |
| 439 | location_table_count++;executed 660636 times by 1 test: location_table_count++; | 660636 |
| 440 | }executed 660636 times by 1 test: end of block | 660636 |
| 441 | else | - |
| 442 | lentry->nalloc++;executed 2147483647 times by 1 test: lentry->nalloc++; | Inf |
| 443 | } | - |
| 444 | | - |
| 445 | static void | - |
| 446 | _location_dump_table (fp) | - |
| 447 | FILE *fp; | - |
| 448 | { | - |
| 449 | register ma_table_t *tp, *endp; | - |
| 450 | | - |
| 451 | endp = mlocation_table + location_table_count; | - |
| 452 | for (tp = mlocation_table; tp < endp| TRUE | never evaluated | | FALSE | never evaluated |
; tp++) | 0 |
| 453 | fprintf (fp, "%s:%d\t%d\n", tp->file ? tp->file : "unknown", never executed: fprintf (fp, "%s:%d\t%d\n", tp->file ? tp->file : "unknown", tp->line ? tp->line : 0, tp->nalloc); | 0 |
| 454 | tp->line ? tp->line : 0, never executed: fprintf (fp, "%s:%d\t%d\n", tp->file ? tp->file : "unknown", tp->line ? tp->line : 0, tp->nalloc); | 0 |
| 455 | tp->nalloc); never executed: fprintf (fp, "%s:%d\t%d\n", tp->file ? tp->file : "unknown", tp->line ? tp->line : 0, tp->nalloc); | 0 |
| 456 | } never executed: end of block | 0 |
| 457 | | - |
| 458 | void | - |
| 459 | mlocation_dump_table () | - |
| 460 | { | - |
| 461 | _location_dump_table ( | - |
| 462 | stderr | - |
| 463 | ); | - |
| 464 | } never executed: end of block | 0 |
| 465 | | - |
| 466 | | - |
| 467 | | - |
| 468 | void | - |
| 469 | mlocation_write_table () | - |
| 470 | { | - |
| 471 | FILE *fp; | - |
| 472 | char defname[sizeof ("/var/tmp/maltrace/locations.") + 64]; | - |
| 473 | | - |
| 474 | fp = _imalloc_fopen ((char *) | - |
| 475 | ((void *)0) | - |
| 476 | , (char *) | - |
| 477 | ((void *)0) | - |
| 478 | , "/var/tmp/maltrace/locations.", defname, sizeof (defname)); | - |
| 479 | if (fp == 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 480 | return; never executed: return; | 0 |
| 481 | _location_dump_table (fp); | - |
| 482 | fclose (fp); | - |
| 483 | } never executed: end of block | 0 |
| 484 | | - |
| 485 | void | - |
| 486 | mlocation_table_init () | - |
| 487 | { | - |
| 488 | memset (mlocation_table, 0, sizeof (ma_table_t) * 8192); | - |
| 489 | mlocation_table[0].file = ""; | - |
| 490 | mlocation_table[0].line = 0; | - |
| 491 | mlocation_table[0].nalloc = 0; | - |
| 492 | location_table_count = 1; | - |
| 493 | } never executed: end of block | 0 |
| 494 | | - |
| 495 | | - |
| 496 | | - |
| 497 | int | - |
| 498 | malloc_set_register(n) | - |
| 499 | int n; | - |
| 500 | { | - |
| 501 | int old; | - |
| 502 | | - |
| 503 | old = malloc_register; | - |
| 504 | malloc_register = n; | - |
| 505 | returnexecuted 5432 times by 1 test: return old; old;executed 5432 times by 1 test: return old; | 5432 |
| 506 | } | - |
| | |