summaryrefslogtreecommitdiff
path: root/src/bin/eina/eina_btlog.c
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>2016-12-03 11:59:48 -0200
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>2016-12-03 13:01:36 -0200
commit2aa247b33439d5bfc73297c9de25a4984df163a4 (patch)
tree4da28c533be30f10054f93ad536e91359e900e9a /src/bin/eina/eina_btlog.c
parent349daa458fda75d5287146dea7721d15a579d586 (diff)
eina_btlog: understand new backtrace format used by eo.
The output of eo backtrace is much more readable than eina's default, but still misses addr2line translation done by eina_btlog, so make eina_btlog understand the new format.
Diffstat (limited to '')
-rw-r--r--src/bin/eina/eina_btlog.c39
1 files changed, 38 insertions, 1 deletions
diff --git a/src/bin/eina/eina_btlog.c b/src/bin/eina/eina_btlog.c
index 3d2441265e..f7d1034836 100644
--- a/src/bin/eina/eina_btlog.c
+++ b/src/bin/eina/eina_btlog.c
@@ -268,6 +268,43 @@ bt_append(Eina_List *btl, const char *btline)
268 return btl; 268 return btl;
269} 269}
270 270
271static const char *
272bt_input_translate(char *line)
273{
274 static char local[PATH_MAX + sizeof(" 0x1234567890123456789 0x1234567890123456789\n")];
275 const char *addrstart, *addrend, *filestart, *fileend, *basestart, *baseend;
276
277 /* new bt format is more human readable, but needs some cleanup before we bt_append()
278 *
279 * Example:
280 * ERR<23314>:eo_lifecycle ../src/lib/eo/efl_object.eo.c:78 efl_del() 0x00000005c7c291: __libc_start_main+0xf1 (in /usr/lib/libc.so.6 0x5c5c000)
281 * ERR<23314>:eo_lifecycle ../src/lib/eo/efl_object.eo.c:78 efl_del() 0x00000004e409aa: libeo_dbg.so+0x99aa (in src/lib/eo/.libs/libeo_dbg.so 0x4e37000)
282 */
283
284 addrstart = strstr(line, "0x");
285 if (!addrstart) return line;
286
287 addrend = strchr(addrstart, ':');
288 if (!addrend) return line;
289
290 filestart = strstr(addrend, "(in ");
291 if (!filestart) return line;
292
293 filestart += strlen("(in ");
294 basestart = strstr(filestart, " 0x");
295 if (!basestart) return line;
296 fileend = basestart;
297 basestart += strlen(" ");
298 baseend = strchr(basestart, ')');
299 if (!baseend) return line;
300
301 snprintf(local, sizeof(local), "%.*s %.*s %.*s\n",
302 (int)(fileend - filestart), filestart,
303 (int)(addrend - addrstart), addrstart,
304 (int)(baseend - basestart), basestart);
305 return local;
306}
307
271static Eina_Bool 308static Eina_Bool
272_translation_function_detect(const Translation_Desc *desc) 309_translation_function_detect(const Translation_Desc *desc)
273{ 310{
@@ -359,7 +396,7 @@ main(int argc, char **argv)
359 396
360 while (fgets(buf, sizeof(buf) - 1, stdin)) 397 while (fgets(buf, sizeof(buf) - 1, stdin))
361 { 398 {
362 btl = bt_append(btl, buf); 399 btl = bt_append(btl, bt_input_translate(buf));
363 } 400 }
364 EINA_LIST_FOREACH(btl, l, bt) 401 EINA_LIST_FOREACH(btl, l, bt)
365 { 402 {