diff options
author | Gustavo Sverzut Barbieri <barbieri@profusion.mobi> | 2016-12-03 12:15:06 -0200 |
---|---|---|
committer | Gustavo Sverzut Barbieri <barbieri@profusion.mobi> | 2016-12-03 13:01:36 -0200 |
commit | 683a508c204197a843e13d4c64c94474332eb04d (patch) | |
tree | 035a56b51ba2564acec4da7750c60416708332bc /src/bin/eina | |
parent | 2aa247b33439d5bfc73297c9de25a4984df163a4 (diff) |
eina_btlog: show comments (non-bt lines)
If the user paste the backtrace he may include some non-backtrace
line, such as Eo logs that includes the message saying what's the
backtrace is about.
These lines will be printed as is, unless "-C" is used to discard
them.
Diffstat (limited to 'src/bin/eina')
-rw-r--r-- | src/bin/eina/eina_btlog.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/bin/eina/eina_btlog.c b/src/bin/eina/eina_btlog.c index f7d1034836..b69927efd9 100644 --- a/src/bin/eina/eina_btlog.c +++ b/src/bin/eina/eina_btlog.c | |||
@@ -48,6 +48,7 @@ struct _Bt | |||
48 | char *file_dir; | 48 | char *file_dir; |
49 | char *file_name; | 49 | char *file_name; |
50 | char *func_name; | 50 | char *func_name; |
51 | char *comment; | ||
51 | int line; | 52 | int line; |
52 | }; | 53 | }; |
53 | 54 | ||
@@ -73,6 +74,7 @@ struct _Translation_Desc | |||
73 | static Translate_Func _translate = NULL; | 74 | static Translate_Func _translate = NULL; |
74 | static const char *_prog = NULL; | 75 | static const char *_prog = NULL; |
75 | static Eina_Bool color = EINA_TRUE; | 76 | static Eina_Bool color = EINA_TRUE; |
77 | static Eina_Bool show_comments = EINA_TRUE; | ||
76 | 78 | ||
77 | static void | 79 | static void |
78 | path_split(const char *path, char **dir, char **file) | 80 | path_split(const char *path, char **dir, char **file) |
@@ -263,8 +265,13 @@ bt_append(Eina_List *btl, const char *btline) | |||
263 | } | 265 | } |
264 | btl = eina_list_append(btl, bt); | 266 | btl = eina_list_append(btl, bt); |
265 | } | 267 | } |
266 | else free(bt); | 268 | else |
269 | { | ||
270 | bt->comment = strdup(btline); | ||
271 | btl = eina_list_append(btl, bt); | ||
272 | } | ||
267 | free(bin); | 273 | free(bin); |
274 | |||
268 | return btl; | 275 | return btl; |
269 | } | 276 | } |
270 | 277 | ||
@@ -376,6 +383,7 @@ main(int argc, char **argv) | |||
376 | { | 383 | { |
377 | printf("Usage: eina_btlog [-n]\n" | 384 | printf("Usage: eina_btlog [-n]\n" |
378 | " -n Do not use color escape codes\n" | 385 | " -n Do not use color escape codes\n" |
386 | " -C Do not show comments (non-bt lines)\n" | ||
379 | "\n" | 387 | "\n" |
380 | "Provide addresses logged from EFL applications to stdin.\n" | 388 | "Provide addresses logged from EFL applications to stdin.\n" |
381 | "Example:\n\n" | 389 | "Example:\n\n" |
@@ -385,6 +393,7 @@ main(int argc, char **argv) | |||
385 | return 0; | 393 | return 0; |
386 | } | 394 | } |
387 | else if (!strcmp(argv[i], "-n")) color = EINA_FALSE; | 395 | else if (!strcmp(argv[i], "-n")) color = EINA_FALSE; |
396 | else if (!strcmp(argv[i], "-C")) show_comments = EINA_FALSE; | ||
388 | } | 397 | } |
389 | 398 | ||
390 | if (!_translation_function_detect(desc)) | 399 | if (!_translation_function_detect(desc)) |
@@ -400,6 +409,7 @@ main(int argc, char **argv) | |||
400 | } | 409 | } |
401 | EINA_LIST_FOREACH(btl, l, bt) | 410 | EINA_LIST_FOREACH(btl, l, bt) |
402 | { | 411 | { |
412 | if (!bt->bin_dir) continue; | ||
403 | len = strlen(bt->bin_dir); | 413 | len = strlen(bt->bin_dir); |
404 | if (len > cols[0]) cols[0] = len; | 414 | if (len > cols[0]) cols[0] = len; |
405 | len = strlen(bt->bin_name); | 415 | len = strlen(bt->bin_name); |
@@ -419,6 +429,9 @@ main(int argc, char **argv) | |||
419 | } | 429 | } |
420 | EINA_LIST_FOREACH(btl, l, bt) | 430 | EINA_LIST_FOREACH(btl, l, bt) |
421 | { | 431 | { |
432 | if (bt->comment && show_comments) | ||
433 | fputs(bt->comment, stdout); | ||
434 | if (!bt->bin_dir) continue; | ||
422 | len = strlen(bt->bin_dir); | 435 | len = strlen(bt->bin_dir); |
423 | for (i = 0; i < (cols[0] - len); i++) printf(" "); | 436 | for (i = 0; i < (cols[0] - len); i++) printf(" "); |
424 | if (color) | 437 | if (color) |