[PATCH] perf: avoid structure size confusion by using a fixed size



From f9edcb31f1d4935fa0a8fc0891c90d6e0174fcae Mon Sep 17 00:00:00 2001
From: Arjan van de Ven <arjan@xxxxxxxxxxxxxxx>
Date: Mon, 20 Jul 2009 22:54:26 -0700
Subject: [PATCH] perf: avoid structure size confusion by using a fixed size

for some reason, this structure gets compiled as 36 bytes in some files
(the ones that alloacte it) but 40 bytes in others (the ones that use it).
The cause is an off_t type that gets a different size in different
compilation units for some yet-to-be-explained reason.

But the effect is disasterous; the size/offset members of the struct
are at different offsets, and result in mostly complete garbage.
The parser in perf is so robust that this all gets hidden, and after
skipping an certain amount of samples, it recovers.... so this bug
is not normally noticed.

... except when you want every sample to be exact.

Fix this by just using an explicitly sized type.

Signed-off-by: Arjan van de Ven <arjan@xxxxxxxxxxxxxxx>
---
tools/perf/util/header.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/header.h b/tools/perf/util/header.h
index b5ef53a..bf28044 100644
--- a/tools/perf/util/header.h
+++ b/tools/perf/util/header.h
@@ -16,7 +16,7 @@ struct perf_header {
int frozen;
int attrs, size;
struct perf_header_attr **attr;
- off_t attr_offset;
+ s64 attr_offset;
u64 data_offset;
u64 data_size;
};
--
1.6.0.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: HLA, Flex, and Bison
    ... >>Is there a reason the file can't be made smaller? ... The inability to support separate compilation is ... I don't know what you meant about the inability to support separate ... getting the library code consistent between ...
    (alt.lang.asm)
  • Re: [PATCH] perf tools: support static build
    ... [perf]$ ldd perf ... packagers are strongly encouraged not to ship static libs ... I can copy around linux systems qualify as a compelling reason? ...
    (Linux-Kernel)
  • Re: tecomp 0.6 released
    ... The idiots of Visual Eiffel didn't like this and so the ... I'm also 90% sure that tecomp can't do it because they all suffer ... Compilation time with a stupid simple command line ... I do not yet know the reason. ...
    (comp.lang.eiffel)
  • Re: Trying to resolve "Internal Compiler Error" Conflict
    ... > I have eventually found out the reason why some "Internal Compiler errors" ... > std", so collapsed during compilation. ... The "using namespace std" statement makes it possible to use objects like ...
    (microsoft.public.vc.language)
  • Re: Java and .NET (no Flames Pls)
    ... >> Well, incremental compilation never mattered much to me, for whatever ... In Eclipse, by default it compiles the code every time you ... For some reason, I thought you were talking about background compilation ... I find things like Extract Interface are pretty rarely useful since I tend ...
    (microsoft.public.dotnet.framework)

Loading