From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27608 invoked by alias); 1 Nov 2011 15:32:02 -0000 Received: (qmail 27599 invoked by uid 22791); 1 Nov 2011 15:32:01 -0000 X-SWARE-Spam-Status: No, hits=-3.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD,TW_QE X-Spam-Check-By: sourceware.org Received: from fmmailgate07.web.de (HELO fmmailgate07.web.de) (217.72.192.248) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 01 Nov 2011 15:31:33 +0000 Received: from moweb002.kundenserver.de (moweb002.kundenserver.de [172.19.20.108]) by fmmailgate07.web.de (Postfix) with ESMTP id 7C3B8AB991E for ; Tue, 1 Nov 2011 16:31:31 +0100 (CET) Received: from mchn199C.mchp.siemens.de ([88.66.121.220]) by smtp.web.de (mrweb002) with ESMTPA (Nemesis) id 0M8QaI-1R00IL09B4-00vsxN; Tue, 01 Nov 2011 16:31:31 +0100 Message-ID: <4EB010D1.9050209@web.de> Date: Tue, 01 Nov 2011 15:32:00 -0000 From: Jan Kiszka User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 To: Tom Tromey CC: Vimal , gdb@sourceware.org Subject: Re: Multiple breakpoint issue when debugging loadable kernel module References: <4EA89365.2010807@web.de> <4EAED7DC.5030805@siemens.com> In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig1AC85F9BE05D7AE02EBCBA2E" Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2011-11/txt/msg00003.txt.bz2 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig1AC85F9BE05D7AE02EBCBA2E Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Content-length: 2579 On 2011-10-31 21:53, Tom Tromey wrote: >>>>>> "Jan" =3D=3D Jan Kiszka writes: >=20 > Jan> Tom, do you still like to have a description of the full reproduction > Jan> scenario or are you debugging via Vimal? >=20 > I'd still like a way to reproduce it myself. Here we go: The setup is not that simple, in fact (unless I miss a much simpler scenario). You need a target Linux system on which you can install a kernel (with modules) which has debug symbols enabled. Either (re-)build your own or use a -debug package from a distro. Then you need to decide which gdbserver to use: either kgdb on a live system or (I think that's easier) qemu with it's gdb stub. Boot the kernel on the target/guest for which you have the corresponding debug objects on the host. If you feel brave, run qemu as root and let it pick up your host's disk for the guest - in no-modification mode: qemu-system-x86_64 /dev/sda -snapshot -m 1G -s Don't forget the -snapshot or host and guest will use the same disk... If you have VT-x/AMD-V on your host: modprobe kvm-intel/kvm-amd first, and then append -enable-kvm to the qemu command line (the qemu fork qemu-kvm will imply this and refuse to work with kvm modules). Once the target is up, check /proc/modules for some used module and its start address. Pick one, say mac80211, and note the address (or use my script later on). Also pick some function in that module (see /proc/kallsyms, e.g. ieee80211_register_hw in the mac80211 case). Next fire up the debugger (the kernel comes with kgdb docbook section, qemu just requires the "-s" command line switch) and attach to the target (kgdb via serial console, qemu is listening on TCP port 1234 by default). Now we get to the point. Load the module symbols at the right address (or use my script) and perform the following steps: (gdb) add-symbol-file /path/to/some/module.ko 0x... (gdb) l ieee80211_register_hw 624 return local_to_hw(local); 625 } 626 EXPORT_SYMBOL(ieee80211_alloc_hw); 627 628 int ieee80211_register_hw(struct ieee80211_hw *hw) 629 { 630 struct ieee80211_local *local =3D hw_to_local(hw); 631 int result; 632 enum ieee80211_band band; 633 int channels, max_bitrates; (gdb) b ieee80211_register_hw Breakpoint 1 at 0xffffffffa01b31a0: file /data/linux/net/mac80211/main.c, line 646. (gdb) l ieee80211_register_hw No line number known for ieee80211_register_hw. That's the bug. Hope that's manageable - somehow. Feel free to ask if you run into problems with the setup. Jan --------------enig1AC85F9BE05D7AE02EBCBA2E Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" Content-length: 262 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk6wENIACgkQitSsb3rl5xRDJwCdFTbMg3akJgltUMIYj4JrlWiI u78An2ervRDFUmzVc+UFRN+xjxAX1QmX =5meg -----END PGP SIGNATURE----- --------------enig1AC85F9BE05D7AE02EBCBA2E--