From: Philippe E. <ph...@us...> - 2001-09-26 02:42:36
|
Update of /cvsroot/oprofile/oprofile/pp In directory usw-pr-cvs1:/tmp/cvs-serv32201/oprofile/pp Modified Files: Makefile.in oprof_convert.c oprofpp.c Log Message: fix bug #464093 and #464482 Index: Makefile.in =================================================================== RCS file: /cvsroot/oprofile/oprofile/pp/Makefile.in,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- Makefile.in 2001/09/24 02:18:28 1.21 +++ Makefile.in 2001/09/26 02:42:30 1.22 @@ -25,8 +25,8 @@ CC=@CC@ CXX=@CXX@ -CFLAGS=@CFLAGS@ -DOP_EVENTS_DESC -CXXFLAGS=@CXXFLAGS@ -DOP_EVENTS_DESC +CFLAGS=@CFLAGS@ -Wall -W -Wstrict-prototypes -Wstrict-prototypes -Wunused -Wshadow -Wmissing-prototypes -Winline -DOP_EVENTS_DESC +CXXFLAGS=@CXXFLAGS@ -Wall -W -Wstrict-prototypes -Wstrict-prototypes -Wunused -Wmissing-prototypes -DOP_EVENTS_DESC LIBS=-lpopt -lbfd -liberty -ldl INCLUDES=@extra_includes@ HEADERS=oprofpp.h ../dae/opd_util.h ../op_user.h Index: oprof_convert.c =================================================================== RCS file: /cvsroot/oprofile/oprofile/pp/oprof_convert.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- oprof_convert.c 2001/09/22 23:05:12 1.12 +++ oprof_convert.c 2001/09/26 02:42:30 1.13 @@ -193,7 +193,6 @@ * me at <ph...@cl...> */ /* create one row file during translate from colum to row format v4 --> v5 */ static void do_mapping_transfer(uint nr_samples, int counter, - const char* filename, const struct opd_footer_v4* footer_v4, const struct old_opd_fentry* old_samples, int session_number) @@ -325,12 +324,12 @@ session_str = strrchr(filename, '-'); if (session_str) { - int read = 0; - if (sscanf(session_str + 1, "%d%n", &session_number, &read) == 1) { + int bytes_read = 0; + if (sscanf(session_str + 1, "%d%n", &session_number, &bytes_read) == 1) { /* Dangerous if the bin filename end with "-%d" I * prefer reject this corner case */ - ok = session_str[read] && !session_str[read + 1]; + ok = session_str[bytes_read] && !session_str[bytes_read + 1]; } } @@ -366,7 +365,7 @@ //strcpy(out_filename, filename); for (counter = 0; counter < 2 ; ++counter) { - do_mapping_transfer(nr_samples, counter, filename, + do_mapping_transfer(nr_samples, counter, &footer_v4, old_samples, session_number); } Index: oprofpp.c =================================================================== RCS file: /cvsroot/oprofile/oprofile/pp/oprofpp.c,v retrieving revision 1.54 retrieving revision 1.55 diff -u -d -r1.54 -r1.55 --- oprofpp.c 2001/09/24 18:14:57 1.54 +++ oprofpp.c 2001/09/26 02:42:30 1.55 @@ -442,12 +442,10 @@ /** * symcomp - comparator * - * FIXME: this is not sufficient because it compare - * incorrectly symbol coming from different section */ static bool symcomp(const asymbol * a, const asymbol * b) { - return a->value <= b->value; + return a->value + a->section->vma <= b->value + b->section->vma; } /* need a better filter, but only this gets rid of _start @@ -553,10 +551,8 @@ * * lookup for for filename::linenr info from a @sym_idx * symbol at offset @offset. - * if the lookup success return 0. in this case filename - * and/or linenr can be set to NULL/0 if debug info are - * not available in the image file. If lookup fail @filename - * and @linenr have undefined value. + * return true if the lookup succeed. In any case @filename + * is never set to NULL. */ bool opp_bfd::get_linenr(uint sym_idx, uint offset, const char** filename, unsigned int* linenr) @@ -574,8 +570,18 @@ if (pc >= bfd_section_size(ibfd, section)) return false; - return bfd_find_nearest_line(ibfd, section, &syms[0], pc, - filename, &functionname, linenr); + bool ret = bfd_find_nearest_line(ibfd, section, &syms[0], pc, + filename, &functionname, linenr); + + if (*filename == NULL) + *filename = ""; + + if (ret == false) { + *filename = ""; + *linenr = 0; + } + + return ret; } /** @@ -648,13 +654,10 @@ exit(EXIT_FAILURE); } - /* FIXME: this do not work */ -#if 0 if (*start > *end) { fprintf(stderr,"oprofpp: start 0x%x overflow or end 0x%x underflow\n", *start, *end); exit(EXIT_FAILURE); } -#endif } /** |