diff -Nur ksymoops-2.4.3/Changelog ksymoops-2.4.4/Changelog --- ksymoops-2.4.3/Changelog Fri Sep 21 18:48:33 2001 +++ ksymoops-2.4.4/Changelog Fri Mar 1 13:00:46 2002 @@ -1,3 +1,15 @@ +2002-03-01 Keith Owens + + ksymoops 2.4.4 + + * Defeat stupid gcc warning about ignored trigraphs. + * Fix truncate mask. Hugh Dickens. + * Ignore syslog-ng prefix. + * Handle GPLONLY prefix in ksyms. + * Differentiate between i370/cris and arm register lines. + * Handle arm lr (last return). + * Handle alpha ra (return address). + 2001-09-21 Keith Owens ksymoops 2.4.3 diff -Nur ksymoops-2.4.3/ksymoops.c ksymoops-2.4.4/ksymoops.c --- ksymoops-2.4.3/ksymoops.c Sat Sep 22 11:43:09 2001 +++ ksymoops-2.4.4/ksymoops.c Sat Jan 26 12:44:46 2002 @@ -9,7 +9,7 @@ Released under the GNU Public Licence, Version 2. */ -#define VERSION "2.4.3" +#define VERSION "2.4.4" #include "ksymoops.h" #include @@ -28,7 +28,7 @@ int debug = 0; int errors = 0; int warnings = 0; -addr_t truncate_mask = ~(addr_t)1; +addr_t truncate_mask = ~(addr_t)0; SYMBOL_SET ss_vmlinux; SYMBOL_SET ss_ksyms_base; @@ -418,10 +418,10 @@ options->truncate = atoi(optarg); if (options->truncate >= 8*sizeof(addr_t) || options->truncate <= 0) { options->truncate = 0; - truncate_mask = ~(addr_t)1; + truncate_mask = ~(addr_t)0; } else { - truncate_mask = (~(addr_t)1) >> (8*sizeof(addr_t)-options->truncate); + truncate_mask = (~(addr_t)0) >> (8*sizeof(addr_t)-options->truncate); } break; case 'h': diff -Nur ksymoops-2.4.3/ksymoops.spec ksymoops-2.4.4/ksymoops.spec --- ksymoops-2.4.3/ksymoops.spec Sat Sep 22 11:45:20 2001 +++ ksymoops-2.4.4/ksymoops.spec Sat Sep 22 12:00:40 2001 @@ -1,7 +1,7 @@ Summary: Kernel oops and error message decoder Name: ksymoops -Version: 2.4.3 -Release: 2 +Version: 2.4.4 +Release: 1 Copyright: GPL Group: Utilities/System Source: ksymoops-%{version}.tar.gz diff -Nur ksymoops-2.4.3/ksyms.c ksymoops-2.4.4/ksyms.c --- ksymoops-2.4.3/ksyms.c Tue Jul 31 01:58:35 2001 +++ ksymoops-2.4.4/ksyms.c Fri Mar 1 11:50:26 2002 @@ -158,6 +158,8 @@ return; re_strings(&re_ksyms, line, re_ksyms_pmatch, &string); + if (strncmp(string[2], "GPLONLY_", 8) == 0) + strcpy(string[2], string[2]+8); add_ksyms(string[1], ' ', string[2], string[4], options); re_strings_free(&re_ksyms, &string); } diff -Nur ksymoops-2.4.3/oops.c ksymoops-2.4.4/oops.c --- ksymoops-2.4.3/oops.c Fri Sep 21 18:48:33 2001 +++ ksymoops-2.4.4/oops.c Fri Mar 1 13:00:46 2002 @@ -786,9 +786,9 @@ /* Oops 'EIP:' line for other architectures */ RE_COMPILE(&re_Oops_eip_other, "^(" - /* i386 */ "EIP: +.*" - /* m68k */ "|PC *= *" - /* arm */ "|pc *: *" + "EIP: +.*" /* i386 */ + "|PC *= *" /* m68k, alpha */ + "|pc *: *" /* arm */ ")" BRACKETED_ADDRESS , @@ -808,6 +808,86 @@ return(NULL); } +/* Look for the arm lr line, returns start of the relevant hex value */ +static char *Oops_arm_lr(const char *line, char ***string, int string_max) +{ + int i; + static regex_t re_Oops_arm_lr; + static regmatch_t *re_Oops_arm_lr_pmatch; + static const char procname[] = "Oops_arm_lr"; + + RE_COMPILE(&re_Oops_arm_lr, + "pc *: *" BRACKETED_ADDRESS /* 1 */ + " *lr *: *" BRACKETED_ADDRESS, /* 2 */ + REG_NEWLINE|REG_EXTENDED|REG_ICASE, + &re_Oops_arm_lr_pmatch); + + i = regexec(&re_Oops_arm_lr, line, re_Oops_arm_lr.re_nsub+1, + re_Oops_arm_lr_pmatch, 0); + DEBUG(4, "regexec %d", i); + if (i == 0) { + re_string_check(re_Oops_arm_lr.re_nsub+1, string_max, procname); + re_strings(&re_Oops_arm_lr, line, re_Oops_arm_lr_pmatch, + string); + return((*string)[re_Oops_arm_lr.re_nsub]); + } + return(NULL); +} + +/* Set the arm lr from the lr line */ +static void Oops_set_arm_lr(const char *value, SYMBOL_SET *ss) +{ + static const char procname[] = "Oops_set_arm_lr"; + addr_t ra; + ra = hexstring(value); + if (errno) { + ERROR(" Invalid hex value in ra line, ignored - '%s'", value); + perror(prefix); + ra = 0; + } + add_symbol_n(ss, ra, 'R', 1, ">>LR; "); +} + +/* Look for the alpha ra line, returns start of the relevant hex value */ +static char *Oops_alpha_ra(const char *line, char ***string, int string_max) +{ + int i; + static regex_t re_Oops_alpha_ra; + static regmatch_t *re_Oops_alpha_ra_pmatch; + static const char procname[] = "Oops_alpha_ra"; + + RE_COMPILE(&re_Oops_alpha_ra, + "pc *= *" BRACKETED_ADDRESS /* 1 */ + " *ra *= *" BRACKETED_ADDRESS, /* 2 */ + REG_NEWLINE|REG_EXTENDED|REG_ICASE, + &re_Oops_alpha_ra_pmatch); + + i = regexec(&re_Oops_alpha_ra, line, re_Oops_alpha_ra.re_nsub+1, + re_Oops_alpha_ra_pmatch, 0); + DEBUG(4, "regexec %d", i); + if (i == 0) { + re_string_check(re_Oops_alpha_ra.re_nsub+1, string_max, procname); + re_strings(&re_Oops_alpha_ra, line, re_Oops_alpha_ra_pmatch, + string); + return((*string)[re_Oops_alpha_ra.re_nsub]); + } + return(NULL); +} + +/* Set the alpha ra from the ra line */ +static void Oops_set_alpha_ra(const char *value, SYMBOL_SET *ss) +{ + static const char procname[] = "Oops_set_alpha_ra"; + addr_t ra; + ra = hexstring(value); + if (errno) { + ERROR(" Invalid hex value in ra line, ignored - '%s'", value); + perror(prefix); + ra = 0; + } + add_symbol_n(ss, ra, 'R', 1, ">>RA; "); +} + /* Look for the alpha spinlock stuck line, returns TRUE with string[1] * containing the PC, string[2] containing the previous PC. */ @@ -1332,16 +1412,21 @@ /* Matching "oR10: unbracketed address" enables us to also match a CRIS register dump for the lines that overlap with the i370 - register dump format. */ + register dump format. This can match arm lines by mistake, check + for a second register after the address. Only if the second register + is missing is this i370/cris. */ RE_COMPILE(&re_Oops_i370_regs, - "^(o?r[0-9]{1,2}): *" UNBRACKETED_ADDRESS, /* 1, 2 */ + "^(o?r[0-9]{1,2}): *" /* 1 */ + UNBRACKETED_ADDRESS /* 2 */ + "( *r[0-9]{1,2})?" /* 3 */ + , REG_NEWLINE|REG_EXTENDED|REG_ICASE, &re_Oops_i370_regs_pmatch); i = regexec(&re_Oops_i370_regs, line, re_Oops_i370_regs.re_nsub+1, re_Oops_i370_regs_pmatch, 0); DEBUG(4, "regexec %d", i); - if (i == 0) + if (i == 0 && re_Oops_i370_regs_pmatch[3].rm_so == -1) return(line + re_Oops_i370_regs_pmatch[0].rm_so); return(NULL); } @@ -1548,6 +1633,7 @@ "|[^ ]{3} [ 0-9][0-9] [0-9]{2}:[0-9]{2}:[0-9]{2} " "[^ ]+ kernel: +" /* syslogd */ "|<[0-9]+>" /* kmsg */ + "|[0-9]+\\|[^|]+\\|[^|]+\\|[^|]+\\|" /* syslog-ng */ ")", REG_NEWLINE|REG_EXTENDED|REG_ICASE, &re_Oops_prefix_pmatch); @@ -2134,8 +2220,14 @@ puts(line); lastprint = lineno; if ((start = Oops_eip(text, &string, MAX_STRINGS, ibfd, - options))) + options))) { + const char *ret_addr; + if ((ret_addr = Oops_arm_lr(text, &string, MAX_STRINGS))) + Oops_set_arm_lr(ret_addr, &ss_format); + if ((ret_addr = Oops_alpha_ra(text, &string, MAX_STRINGS))) + Oops_set_alpha_ra(ret_addr, &ss_format); Oops_set_eip(start, &eip, &ss_format, me, ibfd, options); + } if (Oops_eip_alpha_spinlock(text, &string, MAX_STRINGS, options)) { /* Set the eip and previous user from the alpha spinlock diff -Nur ksymoops-2.4.3/symbol.c ksymoops-2.4.4/symbol.c --- ksymoops-2.4.3/symbol.c Wed Aug 29 16:27:43 2001 +++ ksymoops-2.4.4/symbol.c Sat Sep 22 18:49:11 2001 @@ -213,17 +213,18 @@ else if ((i+1) >= ss->used) { /* Somewhere past last symbol. Length of last section of code * is unknown, arbitrary cutoff at 32K. + * Stupid gcc warns about trigraph ? ? > so split the strings. */ addr_t offset = address - s->address; if (offset > 32768) snprintf(map, size, - options->hex ? "" - : "", + options->hex ? "" + : "", offset); else snprintf(map, size, - options->hex ? "<%s+%llx/????>" - : "<%s+%lld/????>", + options->hex ? "<%s+%llx/???" "?>" + : "<%s+%lld/???" "?>", s->name, offset); } else {