Monitor interface for debug_addr_pid
authorBarret Rhoden <brho@cs.berkeley.edu>
Mon, 5 Jan 2015 21:20:18 +0000 (16:20 -0500)
committerBarret Rhoden <brho@cs.berkeley.edu>
Mon, 5 Jan 2015 21:20:18 +0000 (16:20 -0500)
db addr PID 0xADDR

It'll print out info for that process's address.  Specifically, if the addr
belongs to a file-backed VMR, it'll print the filename and offset of that
address within the file.

Don't forget you can access the monitor from userspace with the script "m".

$ m db addr 1 0xWHATEVER

kern/src/monitor.c

index a7323d8..d3fa542 100644 (file)
@@ -1160,10 +1160,17 @@ int mon_db(int argc, char **argv, struct hw_trapframe *hw_tf)
        if (argc < 2) {
                printk("Usage: db OPTION\n");
                printk("\tsem: print all semaphore info\n");
+               printk("\taddr: for PID lookup ADDR's file/vmr info\n");
                return 1;
        }
        if (!strcmp(argv[1], "sem")) {
                print_all_sem_info();
+       } else if (!strcmp(argv[1], "addr")) {
+               if (argc < 4) {
+                       printk("Usage: db addr PID 0xADDR\n");
+                       return 1;
+               }
+               debug_addr_pid(strtol(argv[2], 0, 10), strtol(argv[3], 0, 16));
        } else {
                printk("Bad option\n");
                return 1;