[Crash-utility] [PATCH] add -s option to vm to display one vma at a time

Dave Anderson anderson at redhat.com
Tue Mar 13 20:45:41 UTC 2012



----- Original Message -----
> At 2012-3-13 17:56, qiaonuohan wrote:
>   
> Hello Dave,
> 
> When I am using "vm -p" command, I feel it is chaotic when too 
> much data is printed. I think it is clear to display one vma 
> each time.
> 
> In the patch, I compare all vmas with the argument of -s option. 
> If an equal vma is found, it will be printed like below.
> 
> crash> vm -ps ffff88028ff7d3a0
>       VMA           START       END     FLAGS FILE
> ffff88028ff7d3a0 7fff29b71000 7fff29b87000 100173
> VIRTUAL     PHYSICAL
> 7fff29b71000  (not mapped)
> 7fff29b72000  (not mapped)
> 7fff29b73000  (not mapped)
> 7fff29b74000  (not mapped)
> 7fff29b75000  (not mapped)
> 7fff29b76000  (not mapped)
> 7fff29b77000  27faad000
> 7fff29b78000  2807aa000
> 7fff29b79000  280781000
> 7fff29b7a000  280787000
> 7fff29b7b000  280776000
> 7fff29b7c000  280786000
> 7fff29b7d000  27f2df000
> 7fff29b7e000  27f2e0000
> 7fff29b7f000  27f2e1000
> 7fff29b80000  27f2d7000
> 7fff29b81000  28b1ac000
> 7fff29b82000  28ecc1000
> 7fff29b83000  28c5c2000
> 7fff29b84000  28aaf4000
> 7fff29b85000  28aaf9000
> 7fff29b86000  289566000
> crash>

Seems like a reasonable request.

However, I don't like your mixing it with the "-R reference" usage,
because it confuses things like this simple example:
     
  crash> vm -p -s ffff810ec9f57818
        VMA           START       END     FLAGS FILE
  ffff810ec9f57818   4010d000   40110000 101877 /usr/local/java/jdk1.5.0_19/bin/java
  VIRTUAL     PHYSICAL 
  4010d000    ec89b1000
  4010e000    FILE: /usr/local/java/jdk1.5.0_19/bin/java  OFFSET: e000
  4010f000    e99803000
  crash> 
  
If the command above were to be qualified with a "-R 4010e000" reference
check, it results in a nonsensical error message:
  
  crash> vm -p -s ffff810ec9f57818 -R 4010e000
  vm: only one -R option allowed
  Usage:
    vm [-p | -v | -m | [-R reference] | [-f vm_flags]] [pid | taskp] ... 
  Enter "help vm" for details.
  crash> 

A few suggestions:

(1) Don't even bother to tie it in with the "vm -v" option, because if
    you already know the vm_area_struct address, then just print it with
    "vm_area_struct <address>".

(2) Then, since it *only* applies with the -p functionality, make it
    a new "-P <vmaddr>" option, where the help page explains that the
    <vmaddr> argument must be a vm_area_struct of the current context: 
  
    Usage:
      vm [-p | -P vmaddr | -v | -m | [-R reference] | [-f vm_flags]] [pid | taskp] ...

(3) Make -P mutually exclusive with all of the other options.

(4) Do not use the reference structure for this feature.  Just use your new 
    flag, and pass the vma address in the 3rd "vaddr" argument to vm_area_dump(),
    since it's not even being used by cmd_vm().

Dave





More information about the Crash-utility mailing list