]> granicus.if.org Git - procps-ng/commitdiff
pmap: use only address start to range determination
authorSami Kerola <kerolasa@iki.fi>
Sat, 3 Mar 2012 16:51:51 +0000 (17:51 +0100)
committerSami Kerola <kerolasa@iki.fi>
Sun, 4 Mar 2012 11:13:18 +0000 (12:13 +0100)
Fix to an edge case.  When user defined begining of address range to
be at between two allocations the previous allocation which ended to
that address was included to printout.  After this commit one will
see only allocations that are within range definition.

$ pmap -A00007f4e0df08000,00007f4e0df08000 895
895:   bash
00007f4e0dd08000   2048K -----  /lib/libreadline.so.6.2
00007f4e0df08000      8K r----  /lib/libreadline.so.6.2
 total             2056K

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
pmap.c

diff --git a/pmap.c b/pmap.c
index b04b521b360b78b42d1275797d9d42b5b6795bc3..3ba1bfe33433b7d935f4ef93f2a3d920d9052ed8 100644 (file)
--- a/pmap.c
+++ b/pmap.c
@@ -272,10 +272,10 @@ static int one_proc(proc_t * p)
                       &end, flags, &file_offset, &dev_major, &dev_minor,
                       &inode);
 
-               if (start > range_high)
-                       break;
-               if (end < range_low)
+               if (end - 1 < range_low)
                        continue;
+               if (range_high < start)
+                       break;
 
                tmp = strchr(mapbuf, '\n');
                if (tmp)