YoushouldhavereceivedacopyoftheGNUGeneralPublicLicense alongwiththisprogram;ifnot,writetotheFreeSoftware
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
/* Resolve numeric stack dump produced by mysqld 3.23.30 and later versionsintosymbolicnames.BySashaPachev<sasha@mysql.com>
*/
staticvoid usage()
{
print_version();
printf("MariaDB Corporation, originally created by Sasha Pachev\n");
printf("This software comes with ABSOLUTELY NO WARRANTY\n\n");
printf("Resolve numeric stack strace dump into symbols.\n\n");
printf("Usage: %s [OPTIONS] symbols-file [numeric-dump-file]\n",
my_progname);
my_print_help(my_long_options);
my_print_variables(my_long_options);
printf("\n\
The symbols-file should include the output from: 'nm --numeric-sort mysqld'.\n\
The numeric-dump-file should contain a numeric stack trace from mysqld.\n\ If the numeric-dump-file is not given, the stack trace is read from stdin.\n");
}
if (dump_fname && !(fp_dump = my_fopen(dump_fname, O_RDONLY, MYF(MY_WME))))
die("Could not open %s", dump_fname); /* if name not given, assume stdin*/
if (!sym_fname)
die("Please run nm --numeric-sort on mariadbd binary that produced stack \
trace dump and specify the path to it with -s or --symbols-file"); if (!(fp_sym = my_fopen(sym_fname, O_RDONLY, MYF(MY_WME))))
die("Could not open %s", sym_fname);
}
static uchar hex_val(char c)
{
uchar l; if (my_isdigit(&my_charset_latin1,c)) return c - '0';
l = my_tolower(&my_charset_latin1,c); if (l < 'a' || l > 'f') return HEX_INVALID; return (uchar)10 + ((uchar)c - (uchar)'a');
}
if (!se->addr) return -1;
buf++; while (my_isspace(&my_charset_latin1,*buf++)) /* empty */;
while (my_isspace(&my_charset_latin1,*buf++)) /* empty - skip more space */;
--buf; /* now we are on the symbol */ for (p = se->symbol, p_end = se->symbol + sizeof(se->symbol) - 1;
*buf != '\n' && *buf && p < p_end; ++buf,++p)
*p = *buf;
*p = 0; if (!strcmp(se->symbol, "gcc2_compiled.")) return -1; return0;
}
staticvoid init_sym_table()
{ char buf[512]; if (my_init_dynamic_array(PSI_NOT_INSTRUMENTED, &sym_table, sizeof(SYM_ENTRY),
INIT_SYM_TABLE, INC_SYM_TABLE, MYF(0)))
die("Failed in my_init_dynamic_array() -- looks like out of memory problem");
while (fgets(buf, sizeof(buf), fp_sym))
{
SYM_ENTRY se; if (init_sym_entry(&se, buf)) continue; if (insert_dynamic(&sym_table, (uchar*)&se))
die("insert_dynamic() failed - looks like we are out of memory");
}
verify_sort();
}
staticvoid clean_up()
{
delete_dynamic(&sym_table); if (fp_dump && fp_dump != stdin)
my_fclose(fp_dump, MYF(0)); if (fp_sym)
my_fclose(fp_sym, MYF(0));
}
staticvoid verify_sort()
{
uint i;
uchar* last = 0;
for (i = 0; i < sym_table.elements; i++)
{
SYM_ENTRY se;
get_dynamic(&sym_table, (uchar*)&se, i); if (se.addr < last)
die("sym table does not appear to be sorted, did you forget \
--numeric-sort arg to nm? trouble addr = %p, last = %p", se.addr, last);
last = se.addr;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.