Allow filtering by PID for "db sem"
[akaros.git] / kern / src / monitor.c
index fb9736b..b86207a 100644 (file)
@@ -1134,14 +1134,18 @@ int mon_msr(int argc, char **argv, struct hw_trapframe *hw_tf)
 
 int mon_db(int argc, char **argv, struct hw_trapframe *hw_tf)
 {
+       pid_t pid = -1;
+
        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");
+               printk("\tsem [PID]: print all semaphore info\n");
+               printk("\taddr PID 0xADDR: for PID lookup ADDR's file/vmr info\n");
                return 1;
        }
        if (!strcmp(argv[1], "sem")) {
-               print_all_sem_info();
+               if (argc > 2)
+                       pid = strtol(argv[2], 0, 0);
+               print_all_sem_info(pid);
        } else if (!strcmp(argv[1], "addr")) {
                if (argc < 4) {
                        printk("Usage: db addr PID 0xADDR\n");