On Saturday, July 27, 2002, at 07:05 AM, Scott Taggart wrote: At 03:31 PM 7/27/2002, Tsuyoshi Tanaka wrote: At 9:10 -0400 02-7-26, Francis bouchard wrote: In both cases you will have to generate your symbols as "relocatable". 10.1.x kmodsyms or 10.2: kextload. Then you have to load(in the debugger) your symbol at the specific address you see in the panic. what's the gdb command to do this? I'm pretty sure this is in the archives somewhere, but I guess it doesn't hurt to have it again more recenly... [ej:~] ej% gdb GNU gdb 5.1-20020408 (Apple version gdb-228) (Sun Jul 14 10:07:24 GMT 2002) Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "powerpc-apple-macos10". (gdb) help List of classes of commands: aliases -- Aliases of other commands breakpoints -- Making program stop at certain points data -- Examining data files -- Specifying and examining files internals -- Maintenance commands obscure -- Obscure features running -- Running the program stack -- Examining the stack status -- Status inquiries support -- Support facilities tracepoints -- Tracing of program execution without stopping the program user-defined -- User-defined commands Type "help" followed by a class name for a list of commands in that class. Type "help" followed by command name for full documentation. Command name abbreviations are allowed if unambiguous. (gdb) help files Specifying and examining files. List of commands: add-shared-symbol-files -- Load the symbols from shared objects in the dynamic linker's link map add-symbol-file -- Usage: add-symbol-file FILE ADDR [-s <SECT> <SECT_ADDR> -s <SECT> <SECT_ADDR> cd -- Set working directory to DIR for debugger and program being debugged core-file -- Use FILE as core dump for examining memory and registers directory -- Add directory DIR to beginning of search path for source files exec-file -- Use FILE as program for getting contents of pure memory file -- Use FILE as program to be debugged forward-search -- Search for regular expression (see regex(3)) from last line listed list -- List specified function or line load -- Dynamically load FILE into the running program path -- Add directory DIR(s) to beginning of search path for object files pwd -- Print working directory remove-symbol-file -- Usage: remove-symbol-file FILE reread-symbols -- Usage: reread-symbols reverse-search -- Search backward for regular expression (see regex(3)) from last line listed search -- Search for regular expression (see regex(3)) from last line listed section -- Change the base address of section SECTION of the exec file to ADDR set extension-language -- Set mapping between filename extension and source language set gnutarget -- Set the current BFD target show gnutarget -- Show the current BFD target symbol-file -- Load symbol table from executable file FILE Type "help" followed by command name for full documentation. Command name abbreviations are allowed if unambiguous. (gdb) help add-symbol-file Usage: add-symbol-file FILE ADDR [-s <SECT> <SECT_ADDR> -s <SECT> <SECT_ADDR> ...] Load the symbols from FILE, assuming FILE has been dynamically loaded. ADDR is the starting address of the file's text. The optional arguments are section-name section-address pairs and should be specified if the data and bss segments are not contiguous with the text. SECT is a section name to be loaded at SECT_ADDR. ... The kernel is always based @ address 0x0, so to get the kernel symbols you can an always easily do (gdb) add-symbol-file Jaguar/Symbols/xnu/mach_kernel add symbol table from file "/Users/me/Jaguar/Symbols/xnu/mach_kernel" at (y or n) Please answer y or n. (y or n) y Reading symbols from /Users/me/Jaguar/Symbols/xnu/mach_kernel...done. (gdb) For kexts, it's a bit more interesting... For this example, the kmod is com.apple.filesystems.cddafs, at HexAddress 0x7e40000 (you'd get this either by running as root/sudo "kmodstat" [in MacOSX < 10.2] or "kextstat" [OSX >= 10.2] , or by the gdb script "showallkmods" [source the .gdbinit script from xnu/osfmk/ ] when you're connected to the remote machine ; or from the panic backtrace where it shows "loadable kernel modules in backtrace"...) Use kmodsyms/kextload to generate symbol file from your fully symboled kext; kmodsyms -v -k /tmp/mach_kernel -o /tmp/cddafs.sym /tmp/cddafs@0x7e40000 Also, sometimes you need the dependencies of that module, so find it and use a "-d dependencyfile@address" flag... this is all in the kmodsyms man page... (arguments & flags have changed a bit for kextload on 10.2... but it's fully documented in the man page ; and it's a bit easier on 10.2 ). Then in gdb when attached to the other machine, you can (gdb) add-symbol-file /tmp/cddafs.sym 0x7e40000 and then in the bt, you will get #0 CDDA_Statfs (mountPtr=0x1b64e80, statFSPtr=0x1b64eec, theProcPtr=0x1539834) at AppleCDDAFileSystemVFSOps.c:625 instead of #0 0x07e42510 in ?? () Easy, isn't it? ;-) -ej _______________________________________________ darwin-kernel mailing list | darwin-kernel@lists.apple.com Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-kernel Do not post admin requests to the list. They will be ignored.