Prev: Add an AT_NO_AUTOMOUNT flag to suppress terminal automount
Next: firewire: nosy: note ioctls in ioctl-number.txt
From: Gleb Natapov on 22 Jul 2010 14:10 On Thu, Jul 22, 2010 at 02:05:42PM -0300, Arnaldo Carvalho de Melo wrote: > Em Thu, Jul 22, 2010 at 01:52:22PM -0300, Arnaldo Carvalho de Melo escreveu: > > Em Thu, Jul 22, 2010 at 01:47:11PM -0300, Arnaldo Carvalho de Melo escreveu: > > > Em Thu, Jul 22, 2010 at 07:38:51PM +0300, Gleb Natapov escreveu: > > > > On Thu, Jul 22, 2010 at 11:33:45AM -0300, Arnaldo Carvalho de Melo wrote: > > > > > Can you try the attached patch? > > > > > > > > > I can, only later. But if I underhand your patch correctly perf will > > > > still crash if there is a comment after the label on the same line. > > > > > > Possibly, will try that now. > > > > It could be a comment of play code, like: > > > > [root(a)emilia ~]# cat test.c > > int main(int argc, char **argv) > > { > > int i; > > > > while(1) { > > i++; > > if (i == 10000000) > > goto add; > > } > > add: return 0; > > } > > [root(a)emilia ~]# > > > > back to the drawing board :-\ > > What about this one? > > diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c > index 699cf81..96e9044 100644 > --- a/tools/perf/util/hist.c > +++ b/tools/perf/util/hist.c > @@ -976,13 +976,15 @@ static int hist_entry__parse_objdump_line(struct hist_entry *self, FILE *file, > * Parse hexa addresses followed by ':' > */ > line_ip = strtoull(tmp, &tmp2, 16); > - if (*tmp2 != ':' || tmp == tmp2) > + if (*tmp2 != ':' || tmp == tmp2 || tmp2[1] == '\0') > line_ip = -1; > } > > if (line_ip != -1) { > u64 start = map__rip_2objdump(self->ms.map, sym->start); > offset = line_ip - start; > + if (offset < 0 || (u64)line_ip > sym->end) > + offset = -1; > } > This part is good idea anyway. Even if label will be interpreted as ip perf at least will not crash. It may miss-report something if check will accidentally succeed though. > objdump_line = objdump_line__new(offset, line); -- Gleb. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Gleb Natapov on 22 Jul 2010 15:20
On Thu, Jul 22, 2010 at 04:11:32PM -0300, Arnaldo Carvalho de Melo wrote: > Em Thu, Jul 22, 2010 at 09:05:38PM +0300, Gleb Natapov escreveu: > > On Thu, Jul 22, 2010 at 02:05:42PM -0300, Arnaldo Carvalho de Melo wrote: > > > Em Thu, Jul 22, 2010 at 01:52:22PM -0300, Arnaldo Carvalho de Melo escreveu: > > > > Em Thu, Jul 22, 2010 at 01:47:11PM -0300, Arnaldo Carvalho de Melo escreveu: > > > > It could be a comment of play code, like: > > > > > while(1) { > > > > if (++i == 10000000) > > > > goto add; > > > > } > > > > add: return 0; > > > > What about this one? > > > > diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c > > > @@ -976,13 +976,15 @@ static int hist_entry__parse_objdump_line(struct hist_entry *self, FILE *file, > > > if (line_ip != -1) { > > > u64 start = map__rip_2objdump(self->ms.map, sym->start); > > > offset = line_ip - start; > > > + if (offset < 0 || (u64)line_ip > sym->end) > > > + offset = -1; > > > This part is good idea anyway. Even if label will be interpreted as ip > > perf at least will not crash. It may miss-report something if check will > > accidentally succeed though. > > Yeah, we can possibly find a label which is a valid hex number and that > falls inside the address range, but with what we have in objdump this > seems to be the best we can have, I'll commit this. > Agree. Definitely better that what we have now. Thanks. -- Gleb. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ |