summaryrefslogtreecommitdiff
path: root/ddb
AgeCommit message (Collapse)Author
2024-02-19ddb: Use _irq variants of locks to satisfy LDEBUG assertsDamien Zammit
2024-02-12Add thread_set_name RPC.Flavio Cruz
Like task_set_name, we use the same size as the task name and will inherit the task name, whenever it exists. This will be used to implement pthread_setname_np. Message-ID: <20240212062634.1082207-2-flaviocruz@gmail.com>
2024-02-12Replace kernel header includes in include/mach/mach_types.h with forward ↵Flavio Cruz
declarations. I was trying to reuse TASK_NAME_SIZE in kern/thread.h but it was impossible because files included from kern/task.h end up requiring kern/thread.h (through percpu.h), creating a recursive dependency. With this change, mach_types.h only defines forward declarations and modules have to explicitly include the appropriate header file if they want to be able touch those structures. Most of the other includes are required because we no longer grab many different includes through mach_types.h. Message-ID: <20240212062634.1082207-1-flaviocruz@gmail.com>
2024-02-11ddb: Make show all runqs iterate over psets.Damien Zammit
2023-10-01ddb: Make whatis print copy/pastable textSamuel Thibault
2023-10-01ddb: Add whatis commandSamuel Thibault
This is convenient when tracking buffer overflows
2023-09-29kdb: Add "show all runqs" debug commandDamien Zammit
Message-Id: <20230929045936.31535-1-damien@zamaudio.com>
2023-08-12x86_64: Fix loading ELF symbolsSamuel Thibault
2023-03-07kern: Fix MACH_LOCK_MON lock monitoring debugDamien Zammit
TESTED: - by setting MACH_LOCK_MON to 1 in configfrag.ac and running "show all slocks" in kdb - does not break default configured kernel Message-Id: <20230306070512.292715-1-damien@zamaudio.com>
2023-02-09Remove a.out support for ddbFlavio Cruz
We haven't built gnumach using a.out for a very long time. Message-Id: <Y+SgsQ3y8pPqfxRV@jupiter.tail36e24.ts.net>
2023-02-08slock: Fix initialization of statically-allocated slocksSamuel Thibault
(this is actually a no-op for i386)
2023-01-29Enable -Wmissing-prototypes.Flavio Cruz
* Makefile.am: enable -Wmissing-prototypes * ddb/db_inout.h: Prototype kdb_kintr for entering into DDB. * ddb/db_mp.c Include ddb/db_input.h to get kdb_kintr. * i386/i386at/kd.h: Include ddb/input.h to get kdb_kintr. * linux/Makefrag.am: Disable some of the new warnings for linux drivers, otherwise we will get more and more noise. Message-Id: <Y9YNfNaYSsZJFST5@mercury.tail36e24.ts.net>
2023-01-25ddb/db_mp.c: re-introduce remote_db_enterSamuel Thibault
which will be useful for smp
2023-01-24ddb: Add prototype for remote_db_enterSamuel Thibault
It will be useful for smp support.
2023-01-24Fix several warnings for -Wmissing-prototypesFlavio Cruz
* device/ds_routines.c: use static qualifier. * device/subrs.c: delete unused functions. * i386/i386/ast_check.c: include prototypes in kern/ast.h * i386/i386/db_disasm.c: Include prototypes in ddb/db_examine.h * i386/i386/db_interface.h: Define prototype for kdb_kentry. Expose debug methods feep and kd_debug_put. * i386/i386/db_trace.c: delete left over cthreads support, functions are not used. * i386/i386/model_dep.h: Define prototype for c_boot_entry. * i386/i386at/acpi_parse_apic.c: Static qualifiers. * i386/i386at/autoconf.c: Include header file for prototypes and remove dead code. * i386/i386at/autoconf.h: Fix prototype. * i386/i386at/com.c: Add static qualifiers, delete dead code. * i386/i386at/com.c: ditto. * i386/i386at/com.h: Define prototypes for debug functions. * i386/i386at/int_init.c: Include header. * i386/i386at/kd.c: Include header for debug interface. Remove dead kd_cmdreg_read and make xga_getpos static. * i386/i386at/kd_mouse.c: Static qualifiers. * i386/i386at/lpr.c: Dead lprpr. * i386/i386at/model_dep.c: Remove exit function. * kern/mach_clock.c: Include mig prototypes. * kern/mach_clock.h: Remove duplicates of mig prototypes. * kern/machine.c: Use static. * kern/startup.c: slave_main is unused. * kern/thread.h: Define thread_stats that is useful for debugging. * kern/timer.c: Keep db_thread_times since it can be used for debugging. * kern/timer.h: ditto. * linux/dev/glue/misc.c: Use mig header for host_get_time. Message-Id: <Y8oyiecaflCaYhaW@mercury.tail36e24.ts.net>
2023-01-19Remove existing old style definitions and use -Wold-style-definition.Flavio Cruz
Message-Id: <Y8mYd/pt/og4Tj5I@mercury.tail36e24.ts.net>
2023-01-19Include mig generated headers to avoid warnings with -Wmissing-prototypes.Flavio Cruz
This also reverts 566c227636481b246d928772ebeaacbc7c37145b and 963b1794d7117064cee8ab5638b329db51dad854 Message-Id: <Y8d75KSqNL4FFInm@mercury.tail36e24.ts.net>
2023-01-16add missing argument namesLuca Dariz
* ddb/db_break.c: add argument name, compilation fails on Debian/Linux stable with gcc 10.2 otherwise. For some reason on Debian/Hurd a simple test program without argname succeeds, unless I force -std=c11 or similar; I suppose because newer gcc have different defaults. Gnumach seem to still require c89 for some older code, otherwise we could explicitely use gnu99/c99 or gnu11/c11. * ddb/db_cond.c: Likewise * ddb/db_examine.c: Likewise * ddb/db_macro.c: Likewise * ddb/db_watch.c: Likewise * device/dev_name.c: Likewise Message-Id: <20230116130426.246584-1-luca@orpolo.org>
2023-01-10Preemptively fix warnings that will be caused by -Wmissing-prototypesFlavio Cruz
Declared RPCs in ipc/mach_port.c and ddb/db_ext_symtab.c in their corresponding headers. Ideally these should be used by mig instead of mig declaring its own prototypes. Message-Id: <Y7z/BQhmsBbRgxhe@jupiter.tail36e24.ts.net>
2023-01-09Remove unused db_set_variableFlavio Cruz
Message-Id: <Y7umiZGUjD3E+Duq@jupiter.tail36e24.ts.net>
2023-01-09Remove unused db_lookup_portFlavio Cruz
Message-Id: <Y7ulwrbHJZqKoBPn@jupiter.tail36e24.ts.net>
2023-01-05Fix ddb warnings introduced with -Wstrict-prototypesFlavio Cruz
Changed some ddb command functions to have the expected signature but not all of them due to the being difficult to inter-dependency between header files (for those just used cast). Message-Id: <Y7UO9HTfpZ8U0Nfy@mars>
2023-01-01fix warning from -Wstrict-prototypesGuy-Fleury Iteriteka
Message-Id: <Y7GEhcafJ+4Wn3ao@falom>
2023-01-01convert K&R into ansiGuy-Fleury Iteriteka
Message-Id: <Y7GBQ5bk6ZQqtfda@falom>
2022-12-27Fix some warnings with -Wmissing-prototypes.Flavio Cruz
Marked some functions as static (private) as needed and added missing includes. This also revealed some dead code which was removed. Note that -Wmissing-prototypes is not enabled here since there is a bunch more warnings. Message-Id: <Y6j72lWRL9rsYy4j@mars>
2022-12-11db: Add support for CSI-based arrowsSamuel Thibault
2022-12-07Use mach_port_name in db_lookup_portFlavio Cruz
Message-Id: <Y5AdTQfSxStjbhsj@reue>
2022-10-25kdb: Fix TODO for multiprocessorDamien Zammit
Message-Id: <20221025105502.222708-2-damien@zamaudio.com>
2021-08-21db: Add show vmstat commandSamuel Thibault
with an output similar to the userland vmstat command * vm/vm_page.c (db_show_vmstat): New function. * vm/vm_page.h (db_show_vmstat): New prototype. * ddb/db_command.c (db_show_cmds): Add vmstat command.
2021-04-04SMP: Fix warningsSamuel Thibault
2020-04-06ddb: Add 64bit support to memory examinationSamuel Thibault
* ddb/db_examine.c(db_examine): Add q modifier to examine 64bit values. * doc/mach.texi (examine): Document q modifier.
2019-11-10Fix build warningSamuel Thibault
* ddb/db_command.c: Include <ipc/mach_port.h>.
2017-08-27ddb: More gracefully handle address errorsSamuel Thibault
* i386/i386/db_interface.h (db_read_bytes): Return boolean_t instead of void. * i386/i386/db_interface.c (db_user_to_kernel_address): Return -1 instead of calling db_error() if address is bogus. (db_read_bytes): Return FALSE instead of calling db_error() if address is bogus. * ddb/db_access.c (db_get_task_value): Return 0 if db_read_bytes failed. * ddb/db_examine.c (db_xcdump): Only print * if db_read_bytes failed.
2017-08-12ddb: Add magic variable $mapXX.Justus Winter
Maps '$mapXX' to a VM map structure address. @var{xx} is a task identification number printed by a @code{show all tasks} command. * ddb/db_task_thread.c (db_get_map): New function. * ddb/db_task_thread.h (db_get_map): New declaration. * ddb/db_variables.c (db_vars): Add new variable. * doc/mach.texi: Document this.
2017-08-05ddb: debug traps and port referencesJustus Winter
* ddb/db_command.c (db_debug_all_traps_cmd): New declaration and function. (db_debug_port_references_cmd): Likewise. * doc/mach.texi: Describe new commands. * i386/i386/db_interface.h (db_debug_all_traps): New declaration. * i386/i386/trap.c (db_debug_all_traps): New function. * ipc/mach_port.c (db_debug_port_references): New function. * ipc/mach_port.h (db_debug_port_references): New declaration.
2017-08-05ddb: Print scheduling information.Justus Winter
* ddb/db_print.c (OPTION_SCHED): New macro. (db_print_thread): Display scheduling information if the flag is given. (db_print_task): Adapt. (db_show_all_threads): Parse new modifier. (db_show_one_thread): Likewise. * doc/mach.texi: Document the new flag.
2016-12-24VM: rework map entry wiringRichard Braun
First, user wiring is removed, simply because it has never been used. Second, make the VM system track wiring requests to better handle protection. This change makes it possible to wire entries with VM_PROT_NONE protection without actually reserving any page for them until protection changes, and even make those pages pageable if protection is downgraded to VM_PROT_NONE. * ddb/db_ext_symtab.c: Update call to vm_map_pageable. * i386/i386/user_ldt.c: Likewise. * ipc/mach_port.c: Likewise. * vm/vm_debug.c (mach_vm_region_info): Update values returned as appropriate. * vm/vm_map.c (vm_map_entry_copy): Update operation as appropriate. (vm_map_setup): Update member names as appropriate. (vm_map_find_entry): Update to account for map member variable changes. (vm_map_enter): Likewise. (vm_map_entry_inc_wired): New function. (vm_map_entry_reset_wired): Likewise. (vm_map_pageable_scan): Likewise. (vm_map_protect): Update wired access, call vm_map_pageable_scan. (vm_map_pageable_common): Rename to ... (vm_map_pageable): ... and rewrite to use vm_map_pageable_scan. (vm_map_entry_delete): Fix unwiring. (vm_map_copy_overwrite): Replace inline code with a call to vm_map_entry_reset_wired. (vm_map_copyin_page_list): Likewise. (vm_map_print): Likewise. Also print map size and wired size. (vm_map_copyout_page_list): Update to account for map member variable changes. * vm/vm_map.h (struct vm_map_entry): Remove `user_wired_count' member, add `wired_access' member. (struct vm_map): Rename `user_wired' member to `size_wired'. (vm_map_pageable_common): Remove function. (vm_map_pageable_user): Remove macro. (vm_map_pageable): Replace macro with function declaration. * vm/vm_user.c (vm_wire): Update call to vm_map_pageable.
2016-05-23Fix getting ELF symbol bind and typeSamuel Thibault
ddb/db_elf.c (elf_db_search_symbol): Use ELF32_ST_BIND and ELF32_ST_TYPE to access symbol bind and type.
2016-05-18Fix gcc-6 warningsSamuel Thibault
* ddb/db_elf.c (elf_db_sym_init): Turn `i' into unsigned. * device/ds_routines.c (ds_device_open, device_writev_trap): Likewise. * i386/i386/user_ldt.c (i386_set_ldt): Likewise for `i', `min_selector', and `first_desc'. (i386_get_ldt): Likewise for `ldt_count'. (user_ldt_free): Likewise for `i'. * i386/i386/xen.h (hyp_set_ldt): Turn `count' into unsigned long. * i386/intel/pmap.c (pmap_bootstrap): Turn `i', `j' and 'n' into unsigned. (pmap_clear_bootstrap_pagetable): Likewise for `i' and `j'. * ipc/ipc_kmsg.c (ipc_msg_print): Turn `i' and `numwords' into unsigned. * kern/boot_script.c (boot_script_parse_line): Likewise for `i'. * kern/bootstrap.c (bootstrap_create): Likewise for `n' and `i'. * kern/host.c (host_processors): Likewise for `i'. * kern/ipc_tt.c (mach_ports_register): Likewise. * kern/mach_clock.c (tickadj, bigadj): turn into unsigned. * kern/processor.c (processor_set_things): Turn `i' into unsigned. * kern/task.c (task_threads): Likewise. * kern/thread.c (consider_thread_collect, stack_init): Likewise. * kern/strings.c (memset): Turn `i' into size_t. * vm/memory_object.c (memory_object_lock_request): Turn `i' into unsigned. * xen/block.c (hyp_block_init): Use %u format for evt. (device_open): Drop unused err variable. (device_write): Turn `copy_npages', `i', `nbpages', and `j' into unsigned. * xen/console.c (hypcnread, hypcnwrite, hypcnclose): Turn dev to dev_t. (hypcnclose): Return void. * xen/console.h (hypcnread, hypcnwrite, hypcnclose): Fix prototypes accordingly. * xen/evt.c (form_int_mask): Turn `i' into int. * xen/net.c (hyp_net_init): Use %u format for evt. (device_open): Remove unused `err' variable.
2016-05-17Revert "Fix getting ELF symbol bind and type"Samuel Thibault
This reverts commit a8a52cafb5621b475737ffdc81f63703d5b37904. It seems to be breaking backtracing in ddb...
2016-05-15Fix warningRichard Braun
ddb/db_output.c (db_printf): Return 0. ddb/db_printf.h (db_printf): Change declaration to return an int.
2016-03-19Fix getting ELF symbol bind and typeSamuel Thibault
ddb/db_elf.c (elf_db_search_symbol): Use ELF32_ST_BIND and ELF32_ST_TYPE to access symbol bind and type.
2015-09-29ddb: fix line formattingJustus Winter
* ddb/db_output.c (db_putchar): Fix off-by-one, allowing one more character to be printed before the newline is inserted.
2015-09-29ddb: add new command `show slabinfo'Justus Winter
* ddb/db_command.c (db_show_cmds): Add `slabinfo'. * kern/slab.c (slab_info): Generalize so that it can be used with different printf-like functions, and turn it into a static function. (slab_info): New wrapper retaining the old behaviour. (db_show_slab_info): New wrapper that uses `db_printf' instead. * kern/slab.h (db_show_slab_info): New declaration.
2015-08-17kern: disable the simple lock checks while debuggingJustus Winter
* kern/lock.c (do_check_simple_locks): New variable. (check_simple_locks): Make check conditional. (check_simple_locks_{en,dis}able): New functions. * kern/lock.h (check_simple_locks_{en,dis}able): New declarations. * ddb/db_trap.c (db_task_trap): Disable simple lock checks.
2015-06-28ddb: automatically display stack tracesJustus Winter
* ddb/db_trap.c (db_task_trap): Automatically display stack traces if an unexpected trap occurs.
2015-05-20ipc: replace the IPC table with a radix treeJustus Winter
Currently, the port names are mapped to an IPC object (e.g. a port) using a table. This, however, requires large chunks of continuous memory, and leads to scalability problems as virtual kernel memory is a scarce resource. To avoid excessive overhead, non-contiguous port names are spilled into a splay tree. Replace the IPC table with a radix tree. As the radix tree is able to store non-contiguous names with reasonable overhead, we can drop the splay tree as well. * ipc/ipc_entry.c (ipc_entry_tree_collision): Remove function. (ipc_entry_cache): New variable. (ipc_entry_lookup): Replace with a radix tree lookup. (ipc_entry_get): The free list handling is changed a little. Adopt accordingly. (ipc_entry_free_name): New function. (ipc_entry_alloc): Adopt accordingly. (ipc_entry_alloc_name): Likewise. (ipc_entry_dealloc): Likewise. (ipc_entry_grow_table): Remove function. * ipc/ipc_entry.h (struct ipc_entry): Update comment, add field for name and free list, remove unused fields. (ipc_entry_cache, ie_alloc, ie_free): New declarations. (struct ipc_tree_entry): Remove. Also remove any related declarations. (ipc_entry_grow_table): Remove declaration. * ipc/ipc_init.c (ipc_bootstrap): Adopt initialization. * ipc/ipc_kmsg.c (ipc_kmsg_copyout_header): Use `ipc_entry_alloc' instead of re-coding it. Adopt free list handling. (ipc_kmsg_copyout_object): Adopt free list handling, store the name. * ipc/ipc_object.c (ipc_object_copyout): Likewise. (ipc_object_copyout_multiname): Likewise. * ipc/ipc_space.c (ipc_space_create): Initialize radix tree and free list. Drop table and splay tree initialization. (ipc_space_destroy): Free ipc entries and radix tree, remove table and splay tree cleanup. * ipc/ipc_space.h (struct ipc_space): Add radix tree, free list, and size. Remove all fields related to the table and splay tree. * ddb/db_print.c (db_port_iterate): Adopt iteration. (db_lookup_port): Adopt lookup. * include/mach_debug/ipc_info.h: Remove unused parts of the debug interface. * include/mach_debug/mach_debug.defs: Likewise. * include/mach_debug/mach_debug_types.defs: Likewise. * ipc/mach_debug.c: Likewise. * ipc/ipc_right.c (ipc_right_reverse): Adopt lookup, store name. (ipc_right_check): Adopt removal. (ipc_right_destroy): Likewise. (ipc_right_dealloc): Likewise. (ipc_right_delta): Likewise. (ipc_right_copyin): Adopt insertion, adopt removal. (ipc_right_copyin_two): Adopt removal. (ipc_right_copyout): Adopt insertion, adopt removal. (ipc_right_rename): Likewise, also update comment. * ipc/mach_port.c (mach_port_names): Adopt iteration. (mach_port_get_set_status): Likewise. * ipc/port.h: Update comment. * ipc/ipc_hash.c: Delete file. * ipc/ipc_hash.h: Likewise. * ipc/ipc_splay.c: Likewise. * ipc/ipc_splay.h: Likewise. * Makefrag.am (libkernel_a_SOURCES): Remove these files.
2015-01-02ddb: Fix typos in comments (found by codespell)Stefan Weil
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2014-09-17ddb: add support for ELF symbol tablesJustus Winter
* ddb/db_elf.c: New file. * ddb/db_elf.h: Likewise. * Makefrag.am (libkernel_a_SOURCES): Add db_elf.{c,h}. * ddb/db_sym.c (dummy_db_sym_init): New stub db_sym_init function. (db_sym_switch): Add ELF functions. * ddb/db_sym.h (SYMTAB_ELF): New macro. (elf_db_sym_init): New declaration. * i386/i386at/model_dep.c (c_boot_entry): Get ELF section header information from the multiboot structure, and call elf_db_sym_init.
2014-09-17ddb: add `show all tasks' commandJustus Winter
* ddb/db_command.c (db_show_all_cmds): Add `tasks'. * ddb/db_print.c (db_show_all_tasks): New function. * ddb/db_print.h (db_show_all_tasks): New prototype.