diff options
| author | Karel Klic <kklic@redhat.com> | 2011-03-01 12:08:36 +0100 |
|---|---|---|
| committer | Karel Klic <kklic@redhat.com> | 2011-03-01 12:08:36 +0100 |
| commit | 85f639b7fe277ba327e5013e5b101b4a67f14e1d (patch) | |
| tree | 7caa3999e8c987e3ddbc26f4bfbbdc73defca73f /src/btparser | |
| parent | fb52104af74bbf6eeda394880666df40b4354aba (diff) | |
| parent | 77468fcdd7cc05db52320c373a24a5490ff32f52 (diff) | |
merge changes from master
Diffstat (limited to 'src/btparser')
| -rw-r--r-- | src/btparser/Makefile.am | 2 | ||||
| -rw-r--r-- | src/btparser/normalize_glibc.c | 19 | ||||
| -rw-r--r-- | src/btparser/thread.c | 71 | ||||
| -rw-r--r-- | src/btparser/thread.h | 11 |
4 files changed, 80 insertions, 23 deletions
diff --git a/src/btparser/Makefile.am b/src/btparser/Makefile.am index 349483a8..9f64f826 100644 --- a/src/btparser/Makefile.am +++ b/src/btparser/Makefile.am @@ -15,7 +15,7 @@ libbtparser_la_SOURCES = \ utils.h utils.c libbtparser_la_CFLAGS = -Wall -Werror -D_GNU_SOURCE -I../lib libbtparser_la_LDFLAGS = -version-info 1:1:0 -libbtparser_la_LIBADD = ../lib/libabrt.la +libbtparser_la_LIBADD = ../lib/libreport.la # From http://www.seul.org/docs/autotut/ # Version consists 3 numbers: CURRENT, REVISION, AGE. diff --git a/src/btparser/normalize_glibc.c b/src/btparser/normalize_glibc.c index ea40ba9d..3d0bca2b 100644 --- a/src/btparser/normalize_glibc.c +++ b/src/btparser/normalize_glibc.c @@ -71,9 +71,12 @@ btp_normalize_glibc_thread(struct btp_thread *thread) /* Normalize frame names. */ #define NORMALIZE_ARCH_SPECIFIC(func) \ - if (btp_frame_calls_func_in_file2(frame, "__" func "_sse2", func ".S", "libc.so") || \ - btp_frame_calls_func_in_file2(frame, "__" func "_ssse3", func ".S", "libc.so") || \ - btp_frame_calls_func_in_file2(frame, "__" func "_ia32", func ".S", "libc.so")) \ + if (btp_frame_calls_func_in_file3(frame, "__" func "_sse2", func, "/sysdeps/", "libc.so") || \ + btp_frame_calls_func_in_file3(frame, "__" func "_sse2_bsf", func, "/sysdeps/", "libc.so") || \ + btp_frame_calls_func_in_file3(frame, "__" func "_ssse3", func, "/sysdeps/", "libc.so") /* ssse3, not sse3! */ || \ + btp_frame_calls_func_in_file3(frame, "__" func "_ssse3_rep", func, "/sysdeps/", "libc.so") || \ + btp_frame_calls_func_in_file3(frame, "__" func "_sse42", func, "/sysdeps/", "libc.so") || \ + btp_frame_calls_func_in_file3(frame, "__" func "_ia32", func, "/sysdeps", "libc.so")) \ { \ strcpy(frame->function_name, func); \ } @@ -81,8 +84,11 @@ btp_normalize_glibc_thread(struct btp_thread *thread) NORMALIZE_ARCH_SPECIFIC("memchr"); NORMALIZE_ARCH_SPECIFIC("memcmp"); NORMALIZE_ARCH_SPECIFIC("memcpy"); + NORMALIZE_ARCH_SPECIFIC("memmove"); NORMALIZE_ARCH_SPECIFIC("memset"); NORMALIZE_ARCH_SPECIFIC("rawmemchr"); + NORMALIZE_ARCH_SPECIFIC("strcasecmp"); + NORMALIZE_ARCH_SPECIFIC("strcasecmp_l"); NORMALIZE_ARCH_SPECIFIC("strcat"); NORMALIZE_ARCH_SPECIFIC("strchr"); NORMALIZE_ARCH_SPECIFIC("strchrnul"); @@ -91,9 +97,11 @@ btp_normalize_glibc_thread(struct btp_thread *thread) NORMALIZE_ARCH_SPECIFIC("strcspn"); NORMALIZE_ARCH_SPECIFIC("strlen"); NORMALIZE_ARCH_SPECIFIC("strncmp"); + NORMALIZE_ARCH_SPECIFIC("strncpy"); NORMALIZE_ARCH_SPECIFIC("strpbrk"); NORMALIZE_ARCH_SPECIFIC("strrchr"); NORMALIZE_ARCH_SPECIFIC("strspn"); + NORMALIZE_ARCH_SPECIFIC("strstr"); NORMALIZE_ARCH_SPECIFIC("strtok"); /* Remove frames which are not a cause of the crash. */ @@ -106,7 +114,10 @@ btp_normalize_glibc_thread(struct btp_thread *thread) btp_frame_calls_func(frame, "___vsnprintf_chk") || btp_frame_calls_func(frame, "__snprintf_chk") || btp_frame_calls_func(frame, "___snprintf_chk") || - btp_frame_calls_func(frame, "__vasprintf_chk"); + btp_frame_calls_func(frame, "__vasprintf_chk") || + btp_frame_calls_func_in_file(frame, "malloc_consolidate", "malloc.c") || + btp_frame_calls_func_in_file(frame, "_int_malloc", "malloc.c") || + btp_frame_calls_func_in_file(frame, "__libc_calloc", "malloc.c"); if (removable) { bool success = btp_thread_remove_frames_above(thread, frame); diff --git a/src/btparser/thread.c b/src/btparser/thread.c index af480eb3..05f154d6 100644 --- a/src/btparser/thread.c +++ b/src/btparser/thread.c @@ -293,7 +293,7 @@ btp_thread_parse(char **input, return NULL; } - /* Skip spaces after the thread number and before the parenthesis. */ + /* Skip spaces after the thread number and before parentheses. */ spaces = btp_skip_char_sequence(&local_input, ' '); location->column += spaces; if (0 == spaces) @@ -303,31 +303,49 @@ btp_thread_parse(char **input, return NULL; } - /* Read the Thread keyword in parenthesis, which is mandatory. */ + /* Read the LWP section in parentheses, optional. */ + location->column += btp_thread_skip_lwp(&local_input); + + /* Read the Thread keyword in parentheses, optional. */ chars = btp_skip_string(&local_input, "(Thread "); location->column += chars; - if (0 == chars) + if (0 != chars) { - location->message = "Thread keyword in the parenthesis expected in the form '(Thread '."; - btp_thread_free(imthread); - return NULL; - } + /* Read the thread identification number. It can be either in + * decimal or hexadecimal form. + * Examples: + * "Thread 10 (Thread 2476):" + * "Thread 8 (Thread 0xb07fdb70 (LWP 6357)):" + */ + digits = btp_skip_hexadecimal_number(&local_input); + if (0 == digits) + digits = btp_skip_unsigned_integer(&local_input); + location->column += digits; + if (0 == digits) + { + location->message = "The thread identification number expected."; + btp_thread_free(imthread); + return NULL; + } - /* Read the thread identification number. */ - digits = btp_skip_unsigned_integer(&local_input); - location->column += digits; - if (0 == digits) - { - location->message = "The thread identification number expected."; - btp_thread_free(imthread); - return NULL; + /* Handle the optional " (LWP [0-9]+)" section. */ + location->column += btp_skip_char_sequence(&local_input, ' '); + location->column += btp_thread_skip_lwp(&local_input); + + /* Read the end of the parenthesis. */ + if (!btp_skip_char(&local_input, ')')) + { + location->message = "Closing parenthesis for Thread expected."; + btp_thread_free(imthread); + return NULL; + } } - /* Read the end of the parenthesis. */ - chars = btp_skip_string(&local_input, "):\n"); + /* Read the end of the header line. */ + chars = btp_skip_string(&local_input, ":\n"); if (0 == chars) { - location->message = "The end of the parenthesis expected in the form of '):\\n'."; + location->message = "Expected a colon followed by a newline ':\\n'."; btp_thread_free(imthread); return NULL; } @@ -362,3 +380,20 @@ btp_thread_parse(char **input, *input = local_input; return imthread; } + +int +btp_thread_skip_lwp(char **input) +{ + char *local_input = *input; + int count = btp_skip_string(&local_input, "(LWP "); + if (0 == count) + return 0; + int digits = btp_skip_unsigned_integer(&local_input); + if (0 == digits) + return 0; + count += digits; + if (!btp_skip_char(&local_input, ')')) + return 0; + *input = local_input; + return count + 1; +} diff --git a/src/btparser/thread.h b/src/btparser/thread.h index f7287385..47a0211b 100644 --- a/src/btparser/thread.h +++ b/src/btparser/thread.h @@ -197,6 +197,17 @@ struct btp_thread * btp_thread_parse(char **input, struct btp_location *location); +/** + * If the input contains a LWP section in form of "(LWP [0-9]+), move + * the input pointer after this section. Otherwise do not modify + * input. + * @returns + * The number of characters parsed from input. 0 if the input does not + * contain a LWP section. + */ +int +btp_thread_skip_lwp(char **input); + #ifdef __cplusplus } #endif |
