Hi,

I'm using linux kernel 2.6.9 for both the host and the guest. I'm trying to debug a kernel module I'm writing.
Unfortunately, the procedures that are described on UML web site are not usable because they refer to structure/field/variable names which are not valid anymore in 2.6.9.


As far as I could see,

(gdb) p *(struct module *)((char*)modules->next - 4)

prints the module structure of the last module loaded

$1 = {state = MODULE_STATE_LIVE, list = {next = 0xa2851f04,
prev = 0xa02aca68}, name = "ipe_drv", '\0' <repeats 52 times>,
mkobj = 0xa148c794, syms = 0x0, num_syms = 0, crcs = 0x0, gpl_syms = 0x0,
num_gpl_syms = 0, gpl_crcs = 0x0, num_exentries = 0, extable = 0x0,
init = 0xa2854000, module_init = 0x0, module_core = 0xa2875000,
init_size = 0, core_size = 180364, init_text_size = 0,
core_text_size = 8775, arch = {<No data fields>}, unsafe = 0,
license_gplok = 0, ref = {{count = {counter = 0}}}, modules_which_use_me = {
next = 0xa2878f40, prev = 0xa2878f40}, waiter = 0xa1be3160,
exit = 0xa2877220, refcnt_param = {name = 0xa026f166 "refcnt", perm = 292,
set = 0, get = 0xa0060da0 <refcnt_get_fn>, arg = 0x0},
symtab = 0xa2877b60, num_symtab = 143, strtab = 0xa2878450 "",
sect_attrs = 0xa15cc95c, percpu = 0x0, args = 0xa14d7334 ""}

I thought at first that using the value of the "module_core" field for the add-symbol-file command would be OK but it seems it is not always the case. See...


(gdb) add-symbol-file ipe_drv.o 0xa2875000
add symbol table from file "ipe_drv.o" at
        .text_addr = 0xa2875000
(gdb) p/x &ipe_get_packetizer_config
$5 = 0xa2875b10

Although /proc/kallsyms says...

a2875b20 t ipe_get_packetizer_config [ipe_drv]

Here, the offset is 0x10. Sometimes it is 0. I could not find the rule to determine it.


Reloading completely gdb & UML and applying the offset worked but still the question remains... How to determine this offset ?

Thanks in advance,


Olivier Smeesters



-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
User-mode-linux-user mailing list
User-mode-linux-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user

Reply via email to