summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKarel Klic <kklic@redhat.com>2010-02-04 11:53:47 +0100
committerKarel Klic <kklic@redhat.com>2010-02-04 11:53:47 +0100
commit7c7be9f40f84a685975536f3b8e8bbe620dde398 (patch)
tree5a4688a77382aa59596c7c520bbfa06f9f2c6ffd /src
parent7832c5a66672c63ebda91554bd463b85669755bb (diff)
downloadabrt-7c7be9f40f84a685975536f3b8e8bbe620dde398.tar.gz
abrt-7c7be9f40f84a685975536f3b8e8bbe620dde398.tar.xz
abrt-7c7be9f40f84a685975536f3b8e8bbe620dde398.zip
Remove lines containing only spaces from backtrace.
Diffstat (limited to 'src')
-rw-r--r--src/Backtrace/main.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/Backtrace/main.c b/src/Backtrace/main.c
index f2fe1ba4..6683aa91 100644
--- a/src/Backtrace/main.c
+++ b/src/Backtrace/main.c
@@ -232,7 +232,7 @@ int main(int argc, char **argv)
++thread_fixer;
}
- /* Bug fixing hack for GDB.
+ /* Bug fixing hack for GDB - remove wrongly placed newlines from the backtrace.
* Sometimes there is a newline in the local variable section.
* This is caused by some GDB hooks.
* Example: rhbz#538440
@@ -248,10 +248,26 @@ int main(int argc, char **argv)
* __PRETTY_FUNCTION__ = "sync_deletions"
* #2 0x0000000000423e6b in refresh_folder (stub=0x1b77f10 [MailStubExchange],
* ...
+ *
+ * The code removes every empty line (also those containing only spaces),
+ * which is not followed by a new Thread section.
+ *
+ * rhbz#555251 contains empty lines with spaces
*/
char *empty_line = btnoheader;
-/* TODO SPACES ON LINES AS WELL, rhbz#555251 !!!!!!!!
-/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
+ char *c = btnoheader;
+ while (*c)
+ {
+ if (*c == '\n')
+ {
+ char *cend = c + 1;
+ while (*cend == ' ' || *cend == '\t')
+ ++cend;
+ if (*cend == '\n' && 0 != strncmp(cend, "\nThread", strlen("\nThread")))
+ memmove(c, cend, strlen(cend) + 1);
+ }
+ ++c;
+ }
while ((empty_line = strstr(empty_line, "\n\n")) != NULL)
{
if (0 != strncmp(empty_line, "\n\nThread", strlen("\n\nThread")))