[Crash-utility] [Patch] linux-2.6.22 on i386

D. Hugh Redelmeier hugh at mimosa.com
Sat Jul 28 15:29:19 UTC 2007


| From: Dave Anderson <anderson at redhat.com>

| Ken'ichi Ohmichi wrote:

| > On linux-2.6.22, the external declaration of i386's __per_cpu_offset[]
| > is in include/asm-i386/percpu.h, and the definition of __per_cpu_offset[]
| > is in init/main.c:
| > 
| >   unsigned long __per_cpu_offset[NR_CPUS] __read_mostly;
| > 
| > 
| > There are their debugging information in the dwarf section, and the
| > definition's one includes the array length.
| > I explain by following output of the dwarfdump command.
| > 
| > * The debugging information of "extern unsigned long __per_cpu_offset[];"
| >   There is not the attribute DW_AT_upper_bound and the crash utility cannot
| >   get the array number.
| > 	<1><32685>      DW_TAG_variable
| > 	                DW_AT_name                  __per_cpu_offset
| > 	                DW_AT_decl_file             83 include/asm/percpu.h
| > 	                DW_AT_decl_line             48
| > 	                DW_AT_type                  <32674>
| > 	                DW_AT_external              yes(1)
| > 	                DW_AT_declaration           yes(1)
| > 	<1><32674>      DW_TAG_array_type
| > 	                DW_AT_sibling               <32685>
| > 	                DW_AT_type                  <83>
| > 	<2><32683>      DW_TAG_subrange_type
| > 
| > * The debugging information of "unsigned long __per_cpu_offset[NR_CPUS] __read_mostly;"
| >   There is the attribute DW_AT_upper_bound and the crash utility can do it.
| > 	<1><58437>      DW_TAG_variable
| > 	[a1][a1][a1][a1]            DW_AT_name                  __per_cpu_offset
| > 	                DW_AT_decl_file             1 init/main.c
| > 	                DW_AT_decl_line             363
| > 	                DW_AT_type                  <33>
| > 	                DW_AT_external              yes(1)
| > 	                DW_AT_location              DW_OP_addr 0xc03fd400
| > 	<1><   33>      DW_TAG_array_type
| > 	                DW_AT_sibling               <49>
| > 	                DW_AT_type                  <56>
| > 	<2><   42>      DW_TAG_subrange_type
| > 	                DW_AT_type                  <49>
| > 	                DW_AT_upper_bound           31  <--- Here!
| > 
| > 
| > I thought get_array_length() should retry to get the array length from
| > the next if it could not get it. But I prefer your following idea because
| > it is simple and does not make other effects.
| 
| I see.  But as it stands now, the crash utility has no dwarfdump-like
| functions to pull out such data, but rather relies on gdb to do the
| dirty work. There's probably something in the gdb innards that could
| access it, but I'm not aware of it.
| 
| But it's not that important...

This makes me quite suspicious.  I assume that you are correct that
the problem is in gdb.  It still feels like there is a serious problem
here: that the most complete definition is not being made available.

You have an effective work-around for __per_cpu_offset, but I wonder
how many other ways this same problem will come up.




More information about the Crash-utility mailing list