This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

struct gmon_cg_arc_record


Hi

Playing with profiling under Linux/ia64 I noticed that struct
gmon_cg_arc_record looks like this:

struct gmon_cg_arc_record
  {
    char from_pc[sizeof (char *)];      /* address within caller's body */
    char self_pc[sizeof (char *)];      /* address within callee's body */
    char count[4];                      /* number of arc traversals */
  };

And the use of this struct within gmon/gmon.c:write_call_graph() is to
declare it like this:
   struct gmon_cg_arc_record raw_arc[NARCS_PER_WRITEV]
    __attribute__ ((aligned (__alignof__ (char*))));

This means that when write_call_graph() fills the graph entries it
causes misaligned stores on 64 bit architectures such as the ia64 and
Alpha.

I understand that gprof relies on this binary format, but my question is
whether this is ABI specified or just glibc/gcc/gprof convention?  If
not, wouldn't it make sense to change the format for the ia64 and Alpha
to pack data differently? Either by padding the struct or by making it
look something like this:

struct gmon_cg_arc_record
  {
    char from_pc1[sizeof (char *)];     /* address within caller's body */
    char self_pc1[sizeof (char *)];     /* address within callee's body */
    char count1[4];                     /* number of arc traversals */
    char count2[4];                     /* number of arc traversals */
    char from_pc2[sizeof (char *)];     /* address within caller's body */
    char self_pc2[sizeof (char *)];     /* address within callee's body */
  };

Comments, oppinions?

Jes

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]