<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>strings ./vmlinux | grep "Linux version"<br>Linux version 3.0.15+ (oza@lc-blr-291) (gcc version 4.4.3 (GCC) ) #4 PREEMPT Mon Aug 13 12:02:58 IST 2012<br></span></div><div><br><span></span></div><div><span>cat /proc/version<br>Linux version 3.0.15+ (oza@lc-blr-291) (gcc version 4.4.3 (GCC) ) #4 PREEMPT Mon Aug 13 12:02:58 IST 2012</span></div><div><br></div><div>crash> ptype struct kmem_cache<br>type = struct kmem_cache {<br>    struct array_cache *array[1];<br>    unsigned int batchcount;<br>    unsigned int limit;<br>    unsigned int shared;<br>    unsigned int buffer_size;<br>    u32 reciprocal_buffer_size;<br>    unsigned int flags;<br>    unsigned int num;<br>    unsigned int
 gfporder;<br>    gfp_t gfpflags;<br>    size_t colour;<br>    unsigned int colour_off;<br>    struct kmem_cache *slabp_cache;<br>    unsigned int slab_size;<br>    unsigned int dflags;<br>    void (*ctor)(void *);<br>    const char *name;<br>    struct list_head next;<br>    struct kmem_list3 *nodelists[1];<br>}</div><div><br></div><div>Regards,</div><div>Oza.<br></div>  <div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"> <div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"> <div dir="ltr"> <font face="Arial" size="2"> <hr size="1">  <b><span style="font-weight: bold;">From:</span></b> Dave Anderson <anderson@redhat.com><br> <b><span style="font-weight: bold;">To:</span></b> paawan oza <paawan1982@yahoo.com> <br><b><span
 style="font-weight: bold;">Cc:</span></b> "Discussion list for crash utility usage, maintenance and development" <crash-utility@redhat.com> <br> <b><span style="font-weight: bold;">Sent:</span></b> Monday, 13 August 2012 11:25 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [Crash-utility] using crash for ARM<br> </font> </div> <br><br><br>----- Original Message -----<br>> <br>> <br>> Hi,<br>> <br>> <br>> I just thought it might be file creation issue and permission issue.<br>> with change as following: I am able to get to crash prompt.<br>> <br>> <br>> void<br>> open_tmpfile2(void)<br>> {<br>> if (pc->tmpfile2)<br>> error(FATAL, "recursive secondary temporary file usage\n");<br>> <br>> // pc->flags |= DROP_CORE;<br>> // if ((pc->tmpfile2 = tmpfile()) == NULL)<br>> // error(FATAL, "cannot open secondary temporary file\n");<br>> <br>> pc->tmpfile2 = fopen
 ("/system/tmp", "w" );<br>> if (pc->tmpfile2 == NULL) {<br>> printf("error no is %d",errno);<br>> perror("tmpfile");<br>> <br>> error(FATAL, "cannot open secondary temporary file\n");<br>> }<br>> // pc->flags &= ~DROP_CORE;<br>> rewind(pc->tmpfile2);<br>> }<br>> <br>> <br>> <br>> /system is mounted as read-write filesystem, I thought read-only<br>> file-system might be the issue.<br><br>You will need to do the same kind of thing for the open_tmpfile() function<br>as well.<br><br>I thought that setting a TMPDIR environment variable might allow you to use<br>an alternate directory from "/tmp", but that doesn't seem to apply to tmpfile()<br>usage.<br> <br>> <br>> <br>> still I get some warnings<br>> <br>> <br>> shell@android:/system # ./crash ./vmlinux ./System.map<br>> <br>> crash 6.0.8<br>> Copyright (C) 2002-2012 Red Hat, Inc.<br>> Copyright (C) 2004, 2005, 2006, 2010
 IBM Corporation<br>> Copyright (C) 1999-2006 Hewlett-Packard Co<br>> Copyright (C) 2005, 2006, 2011, 2012 Fujitsu Limited<br>> Copyright (C) 2006, 2007 VA Linux Systems Japan K.K.<br>> Copyright (C) 2005, 2011 NEC Corporation<br>> Copyright (C) 1999, 2002, 2007 Silicon Graphics, Inc.<br>> Copyright (C) 1999, 2000, 2001, 2002 Mission Critical Linux, Inc.<br>> This program is free software, covered by the GNU General Public License,<br>> and you are welcome to change it and/or distribute copies of it under<br>> certain conditions. Enter "help copying" to see the conditions.<br>> This program has absolutely no warranty. Enter "help warranty" for<br>> details.<br>> <br>> GNU gdb (GDB)jj 7.3.1<br>> Copyright (C) 2011 Free Software Foundation, Inc.<br>> License GPLv3+: GNU GPL version 3 or later<br>> <<a href="http://gnu.org/licenses/gpl.html" target="_blank">http://gnu.org/licenses/gpl.html</a>><br>>
 This is free software: you are free to change and redistribute it.<br>> There is NO WARRANTY, to the extent permitted by law. Type "show copying"<br>> and "show warranty" for details.<br>> This GDB was configured as "arm-none-linux-gnueabi"...<br>> <br>> WARNING: kernels compiled by different gcc versions:<br>> ./vmlinux: (unknown)<br>> live system kernel: 4.4.3<br><br>I asked this before, but did you ever show the output of:<br><br>  $ strings ./vmlinux | grep "Linux version"<br><br>It should match the output of /proc/version w/respect to the<br>gcc version embedded in the linux_banner string that was <br>used to compile the kernel.<br><br>> crash: invalid size request: 0 type: "array cache array"<br>> crash: unable to initialize kmem slab cache subsystem<br><br>For some reason, the call in vm_init() here is failing to initialize<br>the array length of the kmem_cache.array[] array:<br><br>       
                 }<br>                        MEMBER_OFFSET_INIT(kmem_cache_s_array, "kmem_cache", "array");<br>   ====>                ARRAY_LENGTH_INIT(len, NULL, "kmem_cache.array", NULL, 0);<br>                }<br>                MEMBER_OFFSET_INIT(slab_list, "slab", "list");<br>                MEMBER_OFFSET_INIT(slab_s_mem, "slab", "s_mem");<br>                MEMBER_OFFSET_INIT(slab_inuse, "slab", "inuse");<br><br>The ARRAY_LENGTH_INIT() macro ends up calling get_array_length(),<br>passing "kmem_cache.array" as the first argument.  It should end up<br>using the open_tmpfile2() function to parse the output of the gdb<br>command "ptype struct
 kmem_cache".<br><br>After you get a crash> prompt, what do you see when you enter this?:<br><br>  crash> ptype struct kmem_cache<br><br>For example, I see this on a RHEL5 kernel:<br><br>  crash> ptype struct kmem_cache<br>  type = struct kmem_cache {<br>      struct array_cache *array[255];<br>      unsigned int batchcount;<br>      unsigned int limit;<br>      unsigned int shared;<br>      unsigned int buffer_size;<br>      struct kmem_list3 *nodelists[64];<br>      unsigned int flags;<br>      unsigned int num;<br>      unsigned int gfporder;<br>      gfp_t gfpflags;<br>      size_t colour;<br>      unsigned int colour_off;<br>      struct kmem_cache *slabp_cache;<br>      unsigned int slab_size;<br>     
 unsigned int dflags;<br>      void (*ctor)(void *, struct kmem_cache *, long unsigned int);<br>      void (*dtor)(void *, struct kmem_cache *, long unsigned int);<br>      const char *name;<br>      struct list_head next;<br>  }<br>  crash><br><br>Dave<br><br><br>> <br>> SYSTEM MAP: ./System.map<br>> DEBUG KERNEL: ./vmlinux<br>> DUMPFILE: /dev/mem<br>> CPUS: 1<br>> DATE: Sat Jan 1 04:19:18 2000<br>> UPTIME: 01:02:54<br>> LOAD AVERAGE: 1.28, 0.98, 0.76<br>> TASKS: 505<br>> NODENAME: localhost<br>> RELEASE: 3.0.15+<br>> VERSION: #4 PREEMPT Mon Aug 13 12:02:58 IST 2012<br>> MACHINE: armv7l (unknown Mhz)<br>> MEMORY: 462 MB<br>> PID: 2559<br>> COMMAND: "crash"<br>> TASK: d2b2b140 [THREAD_INFO: d170c000]<br>> CPU: 0<br>> STATE: TASK_RUNNING (ACTIVE)<br>> <br>> crash><br>> <br>> <br>> <br>> <br>>
 Regards,<br>> Oza.<br>> <br>> <br>> <br>> <br>> <br>> <br>> <br>> From: Dave Anderson <<a ymailto="mailto:anderson@redhat.com" href="mailto:anderson@redhat.com">anderson@redhat.com</a>><br>> To: paawan oza <<a ymailto="mailto:paawan1982@yahoo.com" href="mailto:paawan1982@yahoo.com">paawan1982@yahoo.com</a>><br>> Cc: "Discussion list for crash utility usage, maintenance and<br>> development" <<a ymailto="mailto:crash-utility@redhat.com" href="mailto:crash-utility@redhat.com">crash-utility@redhat.com</a>><br>> Sent: Friday, 10 August 2012 10:01 PM<br>> Subject: Re: [Crash-utility] using crash for ARM<br>> <br>> <br>> <br>> ----- Original Message -----<br>> > <br>> > Hi,<br>> > <br>> > please find the logs attached for crash -d8 vmlinux System.map.<br>> > <br>> > crash -d8 vmlinux doesnt work. it gives<br>> > <br>> > crash 6.0.8<br>>
 > Copyright (C) 2002-2012 Red Hat, Inc.<br>> > Copyright (C) 2004, 2005, 2006, 2010 IBM Corporation<br>> > Copyright (C) 1999-2006 Hewlett-Packard Co<br>> > Copyright (C) 2005, 2006, 2011, 2012 Fujitsu Limited<br>> > Copyright (C) 2006, 2007 VA Linux Systems Japan K.K.<br>> > Copyright (C) 2005, 2011 NEC Corporation<br>> > Copyright (C) 1999, 2002, 2007 Silicon Graphics, Inc.<br>> > Copyright (C) 1999, 2000, 2001, 2002 Mission Critical Linux, Inc.<br>> > This program is free software, covered by the GNU General Public<br>> > License,<br>> > and you are welcome to change it and/or distribute copies of it<br>> > under<br>> > certain conditions. Enter "help copying" to see the conditions.<br>> > This program has absolutely no warranty. Enter "help warranty" for<br>> > details.<br>> > <br>> > get_live_memory_source: /dev/mem<br>> > WARNING: ./vmlinux and
 /proc/version do not match!<br>> > <br>> > WARNING: /proc/version indicates kernel version: 3.0.15+<br>> > <br>> > crash: please use the vmlinux file for that kernel version, or try<br>> > using<br>> > the System.map for that kernel version as an additional argument.<br>> > <br>> > Regards,<br>> > Oza.<br>> <br>> For starters, as Mika suggested, you should try your best to use the<br>> actual vmlinux file that is being run on the live system. If the<br>> running<br>> kernel's vmlinux file does not have debuginfo data, and you are using<br>> a<br>> similar kernel along with the running kernel's System.map file, then<br>> you<br>> must be sure that the "other" vmlinux that you are using is as close<br>> as<br>> possible to the running kernel. There are no guarantees that using a<br>> System.map file will work.<br>> <br>> Anyway, looking at the log file, I'm not
 sure why there's non-crash<br>> related<br>> data intermingled with the crash -d8 output, i.e., like this:<br>> <br>> ...<br>> c00dfc08 clk_enable<br>> c00dfc50 clk_debug_set_enable<br>> c00dfcac clk_[ 1866.844757] ##> wifi_suspend<br>> [ 1866.856903] i2c i2c-1: mpu_dev_suspend, called regulator_disable.<br>> Status: 0<br>> [ 1866.856933] mpu_dev_suspend: Suspend handler executed<br>> [ 1866.872528] PM: suspend of devices complete after 27.886 msecs<br>> [ 1866.872558] PM: suspend devices took 0.030 seconds<br>> [ 1866.873077] PM: late suspend of devices complete after 0.457 msecs<br>> [ 1866.873535] PM: early resume of devices complete after 0.183 msecs<br>> [ 1866.874481] i2c i2c-1: mpu_dev_resume, called regulator_enable.<br>> Status: 0<br>> [ 1866.874511] mpu_dev_resume: Resume handler executed<br>> [ 1866.874572] wakeup wake lock: bcmpmu_i2c<br>> [ 1866.874908] get_update_rate: rate =
 112000<br>> [ 1866.874938] get_update_rate: rate = 112000<br>> [ 1866.876434] ##> wifi_resume<br>> [ 1866.892822] PM: resume of devices complete after 19.007 msecs<br>> [ 1866.893676] PM: resume devices took 0.020 seconds<br>> reset<br>> c00dfd4c clk_debug_reset<br>> c00dfd90 clk_init<br>> c00dfe10 clk_register<br>> ...<br>> <br>> Regardless of that, I was looking for a readmem() call, or other<br>> debug statement<br>> that might help pinpoint the failure location. The best that can be<br>> inferred from<br>> the log data are the GNU_GET_DATATYPE debug statements at the end:<br>> <br>> $ grep GNU_GET_DATATYPE teraterm.log<br>> GNU_GET_DATATYPE[runqueue]: returned via gdb_error_hook (1 buffer in<br>> use)<br>> GNU_GET_DATATYPE[prio_array]: returned via gdb_error_hook (1 buffer<br>> in use)<br>> GNU_GET_DATATYPE[prio_array]: returned via gdb_error_hook (1 buffer<br>> in use)<br>>
 GNU_GET_DATATYPE[prio_array]: returned via gdb_error_hook (1 buffer<br>> in use)<br>> GNU_GET_DATATYPE[irq_desc_t]: returned via gdb_error_hook (1 buffer<br>> in use)<br>> GNU_GET_DATATYPE[hw_interrupt_type]: returned via gdb_error_hook (1<br>> buffer in use)<br>> GNU_GET_DATATYPE[timer_vec_root]: returned via gdb_error_hook (1<br>> buffer in use)<br>> GNU_GET_DATATYPE[timer_vec]: returned via gdb_error_hook (1 buffer in<br>> use)<br>> GNU_GET_DATATYPE[tvec_root_s]: returned via gdb_error_hook (1 buffer<br>> in use)<br>> GNU_GET_DATATYPE[softirq_state]: returned via gdb_error_hook (1<br>> buffer in use)<br>> GNU_GET_DATATYPE[desc_struct]: returned via gdb_error_hook (1 buffer<br>> in use)<br>> GNU_GET_DATATYPE[kallsyms_header]: returned via gdb_error_hook (1<br>> buffer in use)<br>> GNU_GET_DATATYPE[mem_section]: returned via gdb_error_hook (1 buffer<br>> in use)<br>>
 GNU_GET_DATATYPE[note_buf_t]: returned via gdb_error_hook (1 buffer<br>> in use)<br>> $<br>> <br>> From those it's evident that you've successfully made it through<br>> kernel_init(),<br>> and have called machdep_init(POST_GDB) from here in<br>> main.c:main_loop()<br>> <br>> } else if (!(pc->flags & MINIMAL_MODE)) {<br>> read_in_kernel_config(IKCFG_INIT);<br>> kernel_init();<br>> =====> machdep_init(POST_GDB);<br>> vm_init();<br>> machdep_init(POST_VM);<br>> module_init();<br>> help_init();<br>> task_init();<br>> vfs_init();<br>> net_init();<br>> dev_init();<br>> machdep_init(POST_INIT);<br>> }<br>> <br>> which calls into arm.c:arm_init(POST_GDB). That function has<br>> successfully made<br>> it past the STRUCT_SIZE_INIT(note_buf, "note_buf_t") call:<br>> <br>> /*<br>> * We need to have information about note_buf_t which is used to<br>> * hold ELF note
 containing registers and status of the thread<br>> * that panic'd.<br>> */<br>> =====> STRUCT_SIZE_INIT(note_buf, "note_buf_t");<br>> <br>> STRUCT_SIZE_INIT(elf_prstatus, "elf_prstatus");<br>> MEMBER_OFFSET_INIT(elf_prstatus_pr_pid, "elf_prstatus",<br>> "pr_pid");<br>> MEMBER_OFFSET_INIT(elf_prstatus_pr_reg, "elf_prstatus",<br>> "pr_reg");<br>> break;<br>> <br>> But the next STRUCT_SIZE_INIT() for "elf_prstatus" apparently never<br>> got completed.<br>> <br>> In any case, it ended up in open_tmpfile2():<br>> <br>> $ tail teraterm.log<br>> GETBUF(128 -> 0)<br>> FREEBUF(0)<br>> GETBUF(128 -> 0)<br>> FREEBUF(0)<br>> GETBUF(128 -> 0)<br>> FREEBUF(0)<br>> <br>> crash: cannot open secondary temporary file<br>> <br>> 1|shell@android:/system #<br>> $<br>> <br>> <br>> Although it's not clear how it's ending up in open_tmpfile2(),<br>> it's certainly of
 interest that the tmpfile() call is failing:<br>> <br>> void<br>> open_tmpfile2(void)<br>> {<br>> if (pc->tmpfile2)<br>> error(FATAL, "recursive secondary temporary file usage\n");<br>> <br>> if ((pc->tmpfile2 = tmpfile()) == NULL)<br>> error(FATAL, "cannot open secondary temporary file\n");<br>> <br>> rewind(pc->tmpfile2);<br>> }<br>> <br>> The man page for tmpfile() shows these reasons:<br>> <br>> RETURN VALUE<br>> The tmpfile() function returns a stream descriptor, or NULL if a<br>> unique<br>> filename cannot be generated or the unique file cannot be opened. In<br>> the latter case, errno is set to indicate the error.<br>> <br>> ERRORS<br>> EACCES Search permission denied for directory in file’s path<br>> prefix.<br>> <br>> EEXIST Unable to generate a unique filename.<br>> <br>> EINTR The call was interrupted by a signal.<br>> <br>> EMFILE Too
 many file descriptors in use by the process.<br>> <br>> ENFILE Too many files open in the system.<br>> <br>> ENOSPC There was no room in the directory to add the new filename.<br>> <br>> EROFS Read-only filesystem.<br>> <br>> A couple things you might try:<br>> <br>> (1) Put a perror() after the tmpfile() call to determine which errno<br>> is being returned.<br>> (2) Set "pc->flags |= DROP_CORE;" prior to the tmpfile() call.<br>> <br>> Like this:<br>> <br>> void<br>> open_tmpfile2(void)<br>> {<br>> if (pc->tmpfile2)<br>> error(FATAL, "recursive secondary temporary file usage\n");<br>> <br>> + pc->flags |= DROP_CORE;<br>> - if ((pc->tmpfile2 = tmpfile()) == NULL)<br>> + if ((pc->tmpfile2 = tmpfile()) == NULL) {<br>> + perror("tmpfile");<br>> error(FATAL, "cannot open secondary temporary file\n");<br>> + }<br>> pc->flags &= ~DROP_CORE;<br>>
 <br>> rewind(pc->tmpfile2);<br>> }<br>> <br>> Then get a backtrace by running gdb on the resultant core file, or<br>> just<br>> run the whole session from gdb.<br>> <br>> Dave<br>> <br>> <br>> <br>> <br>> <br>> <br>> <br>> <br><br><br> </div> </div>  </div></body></html>