Adding b2g-info, a tool which displays information about B2G processes running on a phone.

Example output:

$ adb shell b2g-info
                         |     megabytes    |
           NAME PID NICE  USS  PSS  RSS VSIZE OOM_ADJ USER
            b2g 146    0 49.2 53.0 64.3 168.8       0 root
          Usage 374   18 10.7 14.1 24.6  64.2       6 app_374
     Homescreen 375   18 12.6 16.3 27.1  67.8       4 app_375
(Preallocated a 383   18  7.9 10.7 20.4  58.6       6 root

System memory info:
            Total 176.5 MB
     Used - cache  98.4 MB
  B2G procs (PSS)  94.1 MB
    Non-B2G procs   4.3 MB
     Free + cache  78.1 MB
             Free  39.2 MB
            Cache  38.9 MB

Low-memory killer parameters:
  notify_trigger 10240 KB

  oom_adj min_free
        6 20480 KB
        4  8192 KB
        3  7168 KB
        2  6144 KB
        1  5120 KB
        0  4096 KB

$ adb shell b2g-info -t

                         |     megabytes    |
           NAME TID NICE  USS  PSS  RSS VSIZE OOM_ADJ USER
            b2g 146    0 49.2 53.1 64.3 168.8       0 root
Binder Thread # 221    0
Binder Thread # 227    0
            b2g 247    0
 Gecko_IOThread 249    0
       XPCOM CC 250    0
  Socket Thread 251    0
   JS GC Helper 252    0
JS Sour~ Thread 253    0
    JS Watchdog 254    0
   Hang Monitor 255    0
            b2g 256    0
     Compositor 257    0
ImageBridgeChil 258    0
          Timer 259    0
     DOM Worker 260    0
   JS GC Helper 261    0
JS Sour~ Thread 262    0
     DOM Worker 263    0
     DOM Worker 264    0
   JS GC Helper 265    0
JS Sour~ Thread 266    0
   JS GC Helper 267    0
JS Sour~ Thread 268    0
     DOM Worker 269    0
   JS GC Helper 270    0
JS Sour~ Thread 271    0
            b2g 272    0
    InputReader 273   -8
    GonkSensors 274    0
   HTML5 Parser 277    0
            b2g 317    0
      Cache I/O 321    0
    Cert Verify 359    0
     GL updater 362  -10
  mozStorage #1 395    0
Proxy R~olution 478    0
            b2g 685    0
-------------------------------------------------------------
           NAME TID NICE  USS  PSS  RSS VSIZE OOM_ADJ USER
          Usage 374   18 10.7 14.1 24.6  64.2       6 app_374
Binder Thread # 438   18
Chrome_ChildThr 439   18
Binder Thread # 440   18
       XPCOM CC 441   18
   JS GC Helper 446   18
JS Sour~ Thread 447   18
    JS Watchdog 448   18
  Socket Thread 449   18
(Preallocated a 454   18
ImageBridgeChil 455   18
          Timer 477   18
   HTML5 Parser 484   18
-------------------------------------------------------------
           NAME TID NICE  USS  PSS  RSS VSIZE OOM_ADJ USER
     Homescreen 375   18 12.6 16.3 27.1  67.8       4 app_375
Binder Thread # 384   18
Chrome_ChildThr 385   18
Binder Thread # 386   18
       XPCOM CC 387   18
   JS GC Helper 388   18
JS Sour~ Thread 389   18
    JS Watchdog 390   18
  Socket Thread 391   18
(Preallocated a 393   18
ImageBridgeChil 394   18
          Timer 397   18
   HTML5 Parser 399   18
-------------------------------------------------------------
           NAME TID NICE  USS  PSS  RSS VSIZE OOM_ADJ USER
(Preallocated a 383   18  7.9 10.7 20.4  58.6       6 root
Binder Thread # 442   18
Chrome_ChildThr 443   18
Binder Thread # 444   18
       XPCOM CC 445   18
   JS GC Helper 450   18
JS Sour~ Thread 451   18
    JS Watchdog 452   18
  Socket Thread 453   18
(Preallocated a 456   18
ImageBridgeChil 457   18
          Timer 481   18

System memory info:
            Total 176.5 MB
     Used - cache  98.4 MB
  B2G procs (PSS)  94.2 MB
    Non-B2G procs   4.3 MB
     Free + cache  78.1 MB
             Free  39.2 MB
            Cache  38.9 MB

Low-memory killer parameters:
  notify_trigger 10240 KB

  oom_adj min_free
        6 20480 KB
        4  8192 KB
        3  7168 KB
        2  6144 KB
        1  5120 KB
        0  4096 KB
In b2g-info, rename strtoint --> str_to_int.
In b2g-info, converting an instance of strtol to str_to_int.
In b2g-info, adding information about building to b2g-info.cpp.
b2g-info: Fix copyright year.
b2g-info: Make print_b2g_pids return void.
b2g-info: Switch to using TEMP_FAILURE_RETRY, and handle short reads.
b2g-info: Print a better error message if opening /proc/meminfo fails.
b2g-info: Display usage() if we receive an invalid arg.
b2g-info: Don't name variables |nice| and |stat|; those already exist as functions.
b2g-info: Forcing assertions enabled.
b2g-info: Replacing printf() with puts and putchar where possible.
b2g-info: Fixing partial-read logic in read_whole_file.
b2g-info: Use assignment suppression in /proc/<pid>/stat sscanf for fields we don't care about.
b2g-info: Add TEMP_FAILURE_RETRY around open() and read() calls to /proc in Process::get_int_file.
b2g-info: Fixing strip() function, so it works properly.
b2g-info: Use sysconf(_SC_PAGESIZE) instead of assuming 4k pages.
b2g-info: Fix build system.
b2g-info: opendir() can return EINTR, so add safe_opendir() to utils.h, which (hopefully) does the right thing.
b2g-info: Find child processes by looking for processes whose |exe|s match /system/b2g/plugin-container.

Previously, we looked for processes whose ppid was equal to the main process's pid.  Looking at |exe|s is a bit faster.