Dear gdb authors: I am the de-facto leader of a small group of programmers who maintain the gdb kernel stub patch for Linux. This patch allows remote debugging of the Linux kernel via gdb running on a second machine with a serial line connecting the two. Amit Kale is one of the other contributors from whom you may have heard already. I have been testing gdb 4.18 (April 7 version) against Linux 2.3.99-pre3. I am experiencing difficulties with loadable modules. The problem is not the one that you may have heard from Amit about (global data symbols). This is a different problem. On the target machine I do "insmod -m streams >streams.map" to load my module. I am enclosing the file streams.map that is the result of this operation. Back on the gdb machine I attach to the symbols using some gdb macros that end up using add-symbol-file. The problem, then, is that gdb does not seem to be able to obtain the correct address and line number information about routines in this loaded module. Knowing that the module loads at 0xc281004c and that the relocatable offset for the routine "lis_i_link" is 0x2d5c, you can calculate that the correct address for this routine is 0xc2812da8. This is in agreement with the streams.map file. "lis_i_link" was chosen more-or-less at random as a symbol name to use to illustrate the problem. The attached typescript file from the gdb session shows several different "looks" at this routine name and address. I don't know if this is enough for you to go on, but if you need anything more just let me know what to do and I will gather information for you. I realize that this could be especially difficult for you to reproduce yourselves. One other relevant fact: gdb 4.17 does _not_ suffer from this problem. Thanks, Dave
Script started on Wed Apr 12 15:27:17 2000 [root@linux-dev2 linux-kgdb]# gdb vmlinux GNU gdb 4.18 Copyright 1998 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 "i686-pc-linux-gnu"... (gdb) rmt breakpoint () at gdbstub.c:1241 1241 } (gdb) c Continuing. Program received signal SIGTRAP, Trace/breakpoint trap. breakpoint () at gdbstub.c:1241 1241 } (gdb) mod-list 0xc2810000 streams (gdb) mod-add-lis 0xc2810000 (gdb) info addr lis_i_link Symbol "lis_i_link" is a function at address 0xc28128b0. (gdb) # above does not match map file (gdb) info sym 0xc2812da8 lis_i_link in section .text (gdb) # matches map file (gdb) info func lis_i_link All functions matching regular expression "lis_i_link": File /usr/src/LiS/head/head.c: int lis_i_link(struct inode *, struct file *, stdata_t *, int, int, cred_t *); (gdb) list lis_il _l;ink ink 256 * 257 * Get a new muxid. Ensure that it is not in use already. 258 */ 259 static int 260 new_muxid(void) 261 { 262 static int muxid ; 263 stdata_t *hd ; 264 int n ; 265 (gdb) # incorrect line number information, file info is correct (gdb) i x/i lis_i_link 0xc28128b0 <lis_terminate_head>: push %ebp (gdb) info sym 0xc281292c new_muxid in section .text (gdb) # the memory address of the routine that printed as "list lis-i _i_link" (gdb) list 561 556 * However, if the stream does get closed then the stdata structure 557 * will be laying around in memory with refcnt==1 and nothing holding 558 * onto it. It will be their until the next reboot. Hopefully, 559 * this multiplexor can take care of itself until then. 560 */ 561 int lis_i_link(struct inode *i, 562 struct file *f, 563 stdata_t *hd, 564 int muxfd, 565 int cmd, (gdb) c Continuing. [1]+ Stopped gdb vmlinux [root@linux-dev2 linux-kgdb]# kill %1 [1]+ Stopped gdb vmlinux [root@linux-dev2 linux-kgdb]# [1]+ Terminated gdb vmlinux [root@linux-dev2 linux-kgdb]# exit Script done on Wed Apr 12 15:59:35 2000
Sections: Size Address Align .this 0000004c c2810000 2**2 .text 0001223c c281004c 2**2 .text.lock 000001ba c2822288 2**0 .fixup 000000f0 c2822442 2**0 .rodata 0000566f c2822532 2**0 __ex_table 000000a0 c2827ba4 2**2 .data 00000614 c2827c44 2**2 .kstrtab 00001353 c2828258 2**0 .bss 00028398 c28295b0 2**4 __ksymtab 00000a18 c2851948 2**2 Symbols: 00000000 a loop.c 00000000 a safe.c 00000000 a errmsg.c 00000000 a buffcall.c 00000000 a msgutl.c 00000000 a dki.c 00000000 a msg.c 00000000 a mdep.c 00000000 a mod.c 00000000 a queue.c 00000000 a Space.c 00000000 a events.c 00000000 a syscalls.c 00000000 a relay.c 00000000 a ip_strm_mod.c 00000000 a clone.c 00000000 a stats.c 00000000 a slog.c 00000000 a wait.c 00000000 a printk.c 00000000 a sputbuf.c 00000000 a strmdbg.c 00000000 a cmn_err.c 00000000 a head.c 00000000 a minimux.c 00000000 a poll.c 00000000 a osif.c 00000000 a version.c 00000000 a stream.c c2810000 d __this_module c281004c t relay_open c281004c t .text c2810064 t relay_wput c2810080 t relay_rput c281009c t relay_close c28100a4 t clone_open c2810118 t clone_close c2810120 T sloop_init c2810130 t loop_open c28101ec t loop_timeout c2810238 t loop_bufcall c281025c t loop_concat c2810294 T loop_request_copyio c2810304 T loop_iocdata c28105d4 t loop_wput c2810ae8 t loop_wsrv c2810ba8 t loop_rsrv c2810bd4 t loop_close c2810ce4 t new_mux c2810d2c t mux_open c2810df4 T mux_ioctl c28110ac t mux_wput c2811218 t mux_messenger_service c2811274 t mux_rsrv c2811284 t mux_close c2811384 t mux_lrput c28114e4 t mux_lwsrv c28114f4 t printk_open c28114fc t printk_close c2811504 t printk_wput c2811558 T ip_to_streams_open c2811648 T ip_to_streams_close c2811708 T ip_to_streams_ioctl c28118a8 T ip_to_streams_wput c2811b58 T ip_to_streams_allocb c2811ba8 T ip_to_streams_m_error c2811c98 T ip_to_streams_error_ack c2811d8c T ip_to_streams_ok_ack c2811eac T ip_to_streams_rsrv c2811f44 T ip_to_streams_wsrv c28120a8 T ip_to_streams_proto c281212c T ip_to_streams_rput c2812318 T convert_to_skbuf c2812488 t ip_strm_xmit c2812734 T ip_strm_ioctl c2812740 t get_stats c2812758 T ip_strm_open c28127f8 T ip_strm_close c281281c T ip_strm_init c28128b0 T lis_sem_init c281292c t new_muxid c2812988 t str_link_mux c28129c8 t lis_i_unlink c2812cd4 t lis_unlink_all c2812da8 T lis_i_link c2813130 t lis_dismantle c28131b0 t set_readopt c281320c t add_to_scanl c2813284 t start_scanl_timer c28132b0 t alloc_stdata c2813400 t free_stdata c28134c0 T lis_check_ino c2813520 t copyin_msgpart c281367c t copyin_msg c2813744 t copyout_msgpart c2813960 t copyout_msg c28139a8 T lis_qdetach c2813d8c t lis_qattach c2813f58 t push_mod c2813fac t pop_mod c2813ff0 t set_options c2814190 t lis_wake_up_poll c28141e0 t lis_deallocate_polllist c281422c t kill_procs c2814300 t signalusr c2814330 t snd_mread c2814394 t lis_snd_mflush c2814420 t snd_iocnak c2814474 t bad_ioc_seq c2814490 t open_mods c281455c T lis_strrput c2814ecc T lis_strwsrv c2815098 t lis_do_tmout c2815118 t lis_wait_for_wiocing c28151e0 t copyout_blks c2815284 t lis_strdoioctl c2815bf4 t lis_lookup_stdata c2815c34 T lis_stropen c28163b4 T lis_strwrite c2816988 t lis_requeue c2816a0c T lis_strread c2817198 T lis_strputpmsg c28175fc T lis_strgetpmsg c2818118 T lis_strioctl c281a6a8 T lis_poll_bits c281a7dc T lis_wakeup_close c281a848 t lis_doclose c281abb8 T lis_strclose c281ad68 T lis_init_head c281adc8 T lis_terminate_head c281ade8 T lis_timeout_fcn c281af30 T untimeout c281afac T lis_terminate_dki c281b054 t allochdr c281b144 t freehdr c281b20c T lis_terminate_msg c281b244 t allocdb c281b320 t initb c281b3f0 T lis_allocb_physreq c281b408 T lis_allocb c281b4c8 T lis_testb c281b4f8 T lis_esballoc c281b538 T lis_freedb c281b714 T lis_freeb c281b724 T lis_freemsg c281b74c T lis_getint c281b760 T lis_putbyte c281b774 T find_mod_objname c281b780 T find_dev_objname c281b78c T find_dev_by_major c281b798 T find_drv_objname c281b7a4 t apush_free c281b8b0 t apush_free_major c281b90c t apush_free_all c281b95c t apush_drop_mod c281ba34 t apush_validate c281ba74 t apush_conf c281be28 t find_apush_entry c281bee4 T lis_register_strmod c281c028 T lis_unregister_strmod c281c0f0 T lis_findmod c281c13c T lis_enable_intr c281c204 T lis_register_strdev c281c2e4 T lis_unregister_strdev c281c3dc T lis_find_strdev c281c408 T lis_apushm c281c528 T lis_apush_set c281c724 T lis_apush_get c281c8e4 T lis_valid_mod_list c281c96c T lis_init_mod c281ca74 T lis_terminate_mod c281cb1c t bc_timeout c281cb30 t bc_link c281cc98 t bc_ulink c281cd0c T lis_bufcall c281cd5c T lis_esbbcall c281cda8 T lis_unbufcall c281ce3c T lis_dobufcall c281cf80 T lis_init_bufcall c281d018 T lis_terminate_bufcall c281d058 T lis_assert_fail c281d074 T lis_memfree c281d07c T lis_copyin_str c281d104 T lis_errmsg c281d14c T lis_tmout c281d188 T lis_untmout c281d198 T lis_time_till c281d1b0 T lis_target_time c281d1c4 T lis_fd2str c281d204 T lis_pick_inode c281d27c T lis_init_module c281d2f4 t init_module c281d300 t cleanup_module c281d330 T lis_print_trace_func c281d344 T streams_init c281d350 T lis_inc_mod_cnt c281d368 T lis_dec_mod_cnt c281d380 T lis_hitime c281d3b0 T lis_splstr c281d458 T lis_splx c281d4e8 T lis_print_spl_track c281d590 T lis_thread_runqueues c281d770 T lis_start_qsched c281d894 T lis_setqsched c281d934 T lis_kill_qsched c281d99c t lis_do_panic c281d9a8 T lis_error c281da30 T lis_get_elist_ent c281da6c T lis_add_to_elist c281db64 T lis_del_from_elist c281dbe8 T lis_free_elist c281dc24 t tmsgsize c281dc84 T lis_msgsize c281dcb0 T lis_msgdsize c281dcdc T lis_xmsgsize c281dd24 T lis_adjmsg c281ddd0 T lis_copyb c281de2c T lis_copymsg c281de80 T lis_dupb c281dec8 T lis_dupmsg c281df20 T lis_linkb c281df48 T lis_unlinkb c281df64 T lis_pullupmsg c281e12c T lis_msgpullup c281e304 T lis_rmvb c281e354 t find_qband c281e3f8 t updatequeue c281e4c4 t find_q_spot_head c281e530 t find_q_spot_tail c281e5bc t ins_before c281e634 t rmv_msg c281e7bc T lis_check_q_magic c281e7f0 T lis_backq c281e838 T lis_backenable c281e8b4 T lis_getq c281e914 T lis_putq c281e9a4 T lis_putbq c281ea2c T lis_insq c281eb04 T lis_rmvq c281eba8 T lis_qenable c281ec48 T lis_setq c281ed24 T lis_flushband c281ee0c T lis_flushq c281ef60 T lis_putctl c281efdc T lis_putnextctl c281f004 T lis_putctl1 c281f088 T lis_putnextctl1 c281f0b4 T lis_qsize c281f11c T lis_strqget c281f2b4 T lis_strqset c281f418 T lis_allocq c281f49c T lis_freeq c281f590 T lis_appq c281f5e0 T lis_bcanput c281f6d0 T lis_bcanputnext c281f714 T lis_bcanputnext_anyband c281f7e8 T lis_qcountstrm c281f870 T lis_qprocson c281f878 T lis_qprocsoff c281f880 T safe_noenable c281f8e8 T safe_enableok c281f950 T safe_canenable c281f994 T safe_OTHERQ c281fa14 T safe_RD c281fa94 T safe_WR c281fb10 T safe_SAMESTR c281fb80 T safe_putnext c281fc9c T safe_qreply c281fd4c T lis_stat_neg c281fd58 T LisUpCounter c281fd88 T LisSetCounter c281fdb0 t queuerun c281ff80 T lis_run_queues c282001c T lis_scantmout_handler c2820028 T lis_malloc c2820124 T lis_check_guard c2820170 T lis_free c2820250 T lis_terminate_mem c28202a0 T lis_check_mem c28202e4 T lis_mark_mem c28202fc T lis_print_block c2820474 T lis_print_mem c28204b8 T lis_print_queues c2820528 T lis_strm_name c282055c T lis_queue_name c2820588 T lis_msg_type_name c2820704 T lis_maj_min_name c2820774 T lis_print_queue c2820974 t strm_print c2820a94 T lis_print_stream c2820aa4 T lis_print_data c2820bb8 T lis_print_msg c2820c8c T lis_poll_events c2820e80 T lis_sleep_on_wopen c2820ee0 T lis_sleep_on_wioc c2820f38 T lis_sleep_on_wwrite c2820fcc T lis_wake_up_wwrite c2821058 T lis_wake_up_all_wwrite c28210f4 T lis_sleep_on_wread c282118c T lis_wake_up_wread c282121c T lis_wake_up_all_wread c28212b8 T lis_sleep_on_wiocing c2821310 T cmn_err c28213d4 T lis_strm_trace c2821404 T lis_strm_log c2821434 T lis_strm_print_trace c2821548 T lis_strm_putc c2821568 T lis_strm_readbuf c2821658 T lis_strm_init c282174c T sys_putpmsg c2821a2c T sys_getpmsg c2821d10 T hook_syscalls c2821d40 T restore_syscalls c2821d70 T lis_pcibios_present c2821d7c T lis_pcibios_init c2821d84 T lis_pcibios_find_class c2821d9c T lis_pcibios_find_device c2821dbc T lis_pcibios_read_config_byte c2821e10 T lis_pcibios_read_config_word c2821e2c T lis_pcibios_read_config_dword c2821e48 T lis_pcibios_write_config_byte c2821e68 T lis_pcibios_write_config_word c2821e88 T lis_pcibios_write_config_dword c2821ea4 T lis_pcibios_strerror c2821f34 T lis_pci_find_device c2821f48 T lis_pci_find_class c2821f58 T lis_pci_find_slot c2821f68 T lis_pci_read_config_byte c2821f80 T lis_pci_read_config_word c2821f98 T lis_pci_read_config_dword c2821fb0 T lis_pci_write_config_byte c2821fc8 T lis_pci_write_config_word c2821fe0 T lis_pci_write_config_dword c2821ff8 T lis_pci_set_master c2822008 T lis_request_irq c2822024 T lis_free_irq c2822034 T lis_enable_irq c2822044 T lis_disable_irq c2822054 T lis_ioremap c2822068 T lis_ioremap_nocache c282207c T lis_iounmap c282208c T lis_vremap c28220a0 T lis_virt_to_phys c28220b0 T lis_phys_to_virt c28220c0 T lis_check_region c28220d8 T lis_request_region c28220f0 T lis_release_region c2822108 T lis_kmalloc c2822118 T lis_kfree c2822128 T lis_vmalloc c2822138 T lis_vfree c2822148 T lis_request_dma c2822158 T lis_free_dma c2822168 T lis_udelay c2822178 T lis_jiffies c2822184 T lis_printk c28221b4 T lis_sprintf c28221c8 T lis_vsprintf c28221dc T lis_sleep_on c28221ec T lis_interruptible_sleep_on c28221fc T lis_wake_up c2822210 T lis_wake_up_interruptible c2822224 T lis_poll_2_1 c2822288 t .text.lock c2822442 t .fixup c2822532 r .rodata c2827ba4 r __ex_table c2827c44 d relay_minfo c2827c44 d .data c2827c5c d relay2_minfo c2827c74 d relay_rinit c2827c90 d relay_winit c2827cac D relay_info c2827cbc d relay2_rinit c2827cd8 d relay2_winit c2827cf4 D relay2_info c2827d04 d clone_minfo c2827d1c d clone_rinit c2827d38 d clone_winit c2827d54 D clone_info c2827d64 d loop_minfo c2827d7c d loop_rinit c2827d98 d loop_winit c2827db4 D sloop_info c2827dc4 d loop_cnt c2827dc8 d mux_minfo c2827de0 d mux_rinit c2827dfc d mux_winit c2827e18 d mux_lminfo c2827e30 d mux_lrinit c2827e4c d mux_lwinit c2827e68 D mux_info c2827e78 d printk_minfo c2827e90 d printk_rinit c2827eac d printk_winit c2827ec8 D printk_info c2827ed8 D ip_to_streams_minfo c2827ef0 D ip_to_streams_rinit c2827f0c D ip_to_streams_winit c2827f28 D ip_to_streams_info c2827f38 D ip_to_streamsdevflag c2827f3c D ip_to_streams_debug_mask c2827f40 D strmhd_rdminfo c2827f58 D strmhd_wrminfo c2827f70 D strmhd_rdinit c2827f8c D strmhd_wrinit c2827fa8 D lis_mdbfreelist c2827fac D lis_driver_config c282810c D lis_device_config c282810c D lis_module_config c28281e4 D lis_apush_init c28281e4 D lis_stropts_file c28281e8 D lis_streams_fops c2828224 D lis_kernel_version c2828230 D lis_mem_head c2828244 D lis_debug_mask c2828248 D lis_version c282824c D lis_date c2828254 D lis_poll_file c28295b0 d .bss c28295b0 d loop_loop c28297f0 d muxid.516 c28297f4 d mb_zero.522 c2829818 d frtn_zero.523 c2829820 d apush c2829c1c d apush_nref c282a018 d id_num.516 c282a01c d lis_strbctimer c282a020 d cnt.636 c282a024 d lis_major c282a028 d disableinx c282a02c d disabletim c282a030 d disablestate c282a034 d name.538 c282a0b4 d index.539 c282a0b8 d event_names.552 c282a310 d index.553 c282a314 d total_bytes.518 c282a318 d lis_strm_in c282a31c d lis_strm_out c282a320 d lis_strm_buf c282a324 d lis_strm_end c282a328 d lis_strm_size c282a32c d lis_strm_max_bytes c282a330 d p_sem c282a354 d msg.618 c282a3b8 D proto_space_filler c282a3b9 D lis_strbcflag c282a3bc D lis_putnext_flag c282a3c0 D lis_strmsgsz c282a3c4 D lis_runq_open_flag c282a3c8 D lis_scanqtail c282a3cc D lis_bc_cnt c282a3d0 D lis_nstrpush c282a3d4 D lis_spl_track_inx c282a3d8 D lis_print_trace c282a3dc D lis_runq_pid c282a3e0 D lis_qhead c282a3e4 D lis_runq_sched c282a3e8 D lis_bcfreel c282a3ec D lis_mem_alloced c282a3f0 D lis_strthresh c282a3f4 D lis_iocseq c282a3f8 D lis_global_major c282a3fc D lis_close_cnt c282a400 D lis_max_mem c282a404 D lis_strcount c282a408 D lis_stdata_head c282a40c D lis_tlist_head c282a410 D lis_fmodcnt c282a414 D lis_sefreelist c282a418 D lis_qtail c282a41c D lis_secachep c282a420 D lis_tlist_handle c282a424 D lis_queues_running c282a428 D mux_head c282a42c D lis_max_msg_mem c282a430 D lis_strhold c282a434 D lis_poll_sleeping c282a438 D lis_scanqhead c282a43c D lis_negstat c282a440 D lis_stdata_cnt c282a444 D lis_open_cnt c282a448 D lis_bctl c282a460 D lis_runq_sem c282a484 D lis_runq_kill_sem c282a4a8 D lis_sem_template c282a4cc D lis_strstats c282a64c D mux_minors c282a7e0 D lis_strm_print_trace_buf c282abe0 D lis_bchash c282b1e0 D lis_cmn_err_buf c282c1e0 D lis_fmod_sw c2830d94 D lis_fstr_sw c2835948 D lis_spl_track