diff options
author | Mark Wielaard <mjw@redhat.com> | 2009-07-30 00:06:59 +0200 |
---|---|---|
committer | Mark Wielaard <mjw@redhat.com> | 2009-07-30 00:17:09 +0200 |
commit | 83ca3872dadc89c5a8155150bf76d5c09890dcc9 (patch) | |
tree | 5778940a299b310ac862cb4b6e1f7675c99b8b79 | |
parent | 8823ee6a3fcf47adbb7314c6fd560e6c952c4705 (diff) | |
download | systemtap-steved-83ca3872dadc89c5a8155150bf76d5c09890dcc9.tar.gz systemtap-steved-83ca3872dadc89c5a8155150bf76d5c09890dcc9.tar.xz systemtap-steved-83ca3872dadc89c5a8155150bf76d5c09890dcc9.zip |
PR10459. Disable all warning messages on -w.
* stap.1.in: Document that -w disables all warning messages.
* dwflpp.cxx (get_module_dwarf): Only output warning when session
suppress_warnings is not set.
* translate.cxx (dump_unwindsyms): Likewise.
(emit_symbol_data_done): Likewise.
* tapsets.cxx (query_module_symtab): Likewise.
(read_from_elf_file): Take systemtap_session, check suppress_warnings
before emitting warning.
(read_from_text_file): Likewise.
(get_symtab): Call read_from_elf_file and read_from_text_file with session.
-rw-r--r-- | dwflpp.cxx | 2 | ||||
-rw-r--r-- | stap.1.in | 2 | ||||
-rw-r--r-- | tapsets.cxx | 44 | ||||
-rw-r--r-- | translate.cxx | 14 |
4 files changed, 35 insertions, 27 deletions
@@ -124,7 +124,7 @@ dwflpp::get_module_dwarf(bool required, bool report) if (required) throw semantic_error (msg); - else + else if (! sess.suppress_warnings) cerr << "WARNING: " << msg << "\n"; } } @@ -132,7 +132,7 @@ debugging information for $target variables. Unoptimized mode. Disable unused code elision during elaboration. .TP .B \-w -Suppressed warnings mode. Disable warning messages for elided code in user script. +Suppressed warnings mode. Disables all warning messages. .TP .BI \-b Use bulk mode (percpu files) for kernel-to-user data transfer. diff --git a/tapsets.cxx b/tapsets.cxx index 81fe3d0c..2d68ddd4 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -290,8 +290,10 @@ symbol_table void add_symbol(const char *name, bool weak, Dwarf_Addr addr, Dwarf_Addr *high_addr); enum info_status read_symbols(FILE *f, const string& path); - enum info_status read_from_elf_file(const string& path); - enum info_status read_from_text_file(const string& path); + enum info_status read_from_elf_file(const string& path, + const systemtap_session &sess); + enum info_status read_from_text_file(const string& path, + const systemtap_session &sess); enum info_status get_from_elf(); void prepare_section_rejection(Dwfl_Module *mod); bool reject_section(GElf_Word section); @@ -816,10 +818,11 @@ dwarf_query::query_module_symtab() fi = sym_table->get_func_containing_address(addr); if (!fi) { - cerr << "Warning: address " - << hex << addr << dec - << " out of range for module " - << dw.module_name; + if (! sess.suppress_warnings) + cerr << "Warning: address " + << hex << addr << dec + << " out of range for module " + << dw.module_name; return; } if (!null_die(&fi->die)) @@ -828,10 +831,11 @@ dwarf_query::query_module_symtab() // the indicated function, but query_module_dwarf() didn't // match addr to any compilation unit, so addr must be // above that cu's address range. - cerr << "Warning: address " - << hex << addr << dec - << " maps to no known compilation unit in module " - << dw.module_name; + if (! sess.suppress_warnings) + cerr << "Warning: address " + << hex << addr << dec + << " maps to no known compilation unit in module " + << dw.module_name; return; } query_func_info(fi->addr, *fi, this); @@ -3779,7 +3783,8 @@ symbol_table::read_symbols(FILE *f, const string& path) // that gives us raw addresses -- which we need for modules -- whereas // nm provides the address relative to the beginning of the section. enum info_status -symbol_table::read_from_elf_file(const string &path) +symbol_table::read_from_elf_file(const string &path, + const systemtap_session &sess) { FILE *f; string cmd = string("/usr/bin/nm -n --defined-only ") + path; @@ -3794,7 +3799,7 @@ symbol_table::read_from_elf_file(const string &path) enum info_status status = read_symbols(f, path); if (pclose(f) != 0) { - if (status == info_present) + if (status == info_present && ! sess.suppress_warnings) cerr << "Warning: nm cannot read symbol table from " << path; return info_absent; } @@ -3802,13 +3807,15 @@ symbol_table::read_from_elf_file(const string &path) } enum info_status -symbol_table::read_from_text_file(const string& path) +symbol_table::read_from_text_file(const string& path, + const systemtap_session &sess) { FILE *f = fopen(path.c_str(), "r"); if (!f) { - cerr << "Warning: cannot read symbol table from " - << path << " -- " << strerror (errno); + if (! sess.suppress_warnings) + cerr << "Warning: cannot read symbol table from " + << path << " -- " << strerror (errno); return info_absent; } enum info_status status = read_symbols(f, path); @@ -3956,12 +3963,13 @@ module_info::get_symtab(dwarf_query *q) sym_table = new symbol_table(this); if (!elf_path.empty()) { - if (name == TOK_KERNEL && !sess.kernel_symtab_path.empty()) + if (name == TOK_KERNEL && !sess.kernel_symtab_path.empty() + && ! sess.suppress_warnings) cerr << "Warning: reading symbol table from " << elf_path << " -- ignoring " << sess.kernel_symtab_path - << endl ;; + << endl; symtab_status = sym_table->get_from_elf(); } else @@ -3977,7 +3985,7 @@ module_info::get_symtab(dwarf_query *q) else { symtab_status = - sym_table->read_from_text_file(sess.kernel_symtab_path); + sym_table->read_from_text_file(sess.kernel_symtab_path, sess); if (symtab_status == info_present) { sess.sym_kprobes_text_start = diff --git a/translate.cxx b/translate.cxx index 9c901065..f2e04d7d 100644 --- a/translate.cxx +++ b/translate.cxx @@ -4779,7 +4779,7 @@ dump_unwindsyms (Dwfl_Module *m, // likely can't do anything about this; backtraces for the // affected module would just get all icky heuristicy. // So only report in verbose mode. - if (c->session.verbose > 2) + if (c->session.verbose > 2 && ! c->session.suppress_warnings) c->session.print_warning ("No unwind data for " + modname + ", " + dwfl_errmsg (-1)); } @@ -5080,12 +5080,12 @@ emit_symbol_data_done (unwindsym_dump_context *ctx, systemtap_session& s) << ";\n"; // Some nonexistent modules may have been identified with "-d". Note them. - for (set<string>::iterator it = ctx->undone_unwindsym_modules.begin(); - it != ctx->undone_unwindsym_modules.end(); - it ++) - { - s.print_warning ("missing unwind/symbol data for module '" + (*it) + "'"); - } + if (! s.suppress_warnings) + for (set<string>::iterator it = ctx->undone_unwindsym_modules.begin(); + it != ctx->undone_unwindsym_modules.end(); + it ++) + s.print_warning ("missing unwind/symbol data for module '" + + (*it) + "'"); } |