From: John L. <mov...@us...> - 2003-09-18 15:41:55
|
Update of /cvsroot/oprofile/oprofile/pp In directory sc8-pr-cvs1:/tmp/cvs-serv18837/pp Modified Files: image_errors.cpp opgprof.cpp populate.cpp Log Message: mage error flags cleanup Index: image_errors.cpp =================================================================== RCS file: /cvsroot/oprofile/oprofile/pp/image_errors.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -p -d -r1.1 -r1.2 --- image_errors.cpp 18 Sep 2003 14:06:51 -0000 1.1 +++ image_errors.cpp 18 Sep 2003 15:39:49 -0000 1.2 @@ -14,15 +14,16 @@ using namespace std; + void report_image_error(inverted_profile const & profile, bool fatal) { - if (profile.flags == image_ok) + if (profile.error == image_ok) return; cerr << (fatal ? "error: " : "warning: "); cerr << profile.image << ' '; - switch (profile.flags) { + switch (profile.error) { case image_not_found: cerr << "could not be found.\n"; break; @@ -40,10 +41,7 @@ void report_image_error(inverted_profile cerr << "is not in a usable binary format.\n"; break; - default: - cerr << "report_image_error: impossible flags " - << profile.flags << endl; - abort(); + case image_ok: break; } } Index: opgprof.cpp =================================================================== RCS file: /cvsroot/oprofile/oprofile/pp/opgprof.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -p -d -r1.13 -r1.14 --- opgprof.cpp 18 Sep 2003 14:06:51 -0000 1.13 +++ opgprof.cpp 18 Sep 2003 15:39:50 -0000 1.14 @@ -213,10 +213,13 @@ int opgprof(vector<string> const & non_o profile_container samples(false, true); + bool ok = image_profile.error == image_ok; // FIXME: symbol_filter would be allowed through option - op_bfd abfd(image_profile.image, string_filter(), image_profile.flags); + op_bfd abfd(image_profile.image, string_filter(), ok); + if (!ok && image_profile.error == image_ok) + image_profile.error = image_format_failure; - if (image_profile.flags != image_ok) { + if (image_profile.error != image_ok) { report_image_error(image_profile, true); exit(EXIT_FAILURE); } Index: populate.cpp =================================================================== RCS file: /cvsroot/oprofile/oprofile/pp/populate.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -p -d -r1.5 -r1.6 --- populate.cpp 18 Sep 2003 14:10:21 -0000 1.5 +++ populate.cpp 18 Sep 2003 15:39:51 -0000 1.6 @@ -44,9 +44,12 @@ populate_from_files(profile_t & profile, void populate_for_image(profile_container & samples, inverted_profile & ip) { - op_bfd abfd(ip.image, options::symbol_filter, ip.flags); + bool ok = ip.error == image_ok; + op_bfd abfd(ip.image, options::symbol_filter, ok); + if (!ok && ip.error == image_ok) + ip.error = image_format_failure; - if (ip.flags & image_format_failure) + if (ip.error == image_format_failure) report_image_error(ip, false); u32 offset = abfd.get_start_offset(); @@ -71,6 +74,6 @@ populate_for_image(profile_container & s } } - if (ip.flags == image_ok) + if (ip.error == image_ok) check_mtime(abfd.get_filename(), header); } |