Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C6140C433F5 for ; Tue, 5 Apr 2022 14:04:22 +0000 (UTC) Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.94.2) (envelope-from ) id 1nbjmh-0006zV-9G; Tue, 05 Apr 2022 10:03:51 -0400 Received: from mscreen.etri.re.kr ([129.254.9.16]) by shelob.surriel.com with esmtps (TLS1.2) tls TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA (Exim 4.94.2) (envelope-from ) id 1nbjme-0006z4-JB for kernelnewbies@kernelnewbies.org; Tue, 05 Apr 2022 10:03:49 -0400 Received: from unknown (HELO send002-relay.gov-dooray.com) (211.180.235.153) by 129.254.9.16 with ESMTP; 5 Apr 2022 23:03:40 +0900 X-Original-SENDERIP: 211.180.235.153 X-Original-MAILFROM: ckim@etri.re.kr X-Original-RCPTTO: kernelnewbies@kernelnewbies.org Received: from [10.162.225.106] (HELO smtp001-imp.gov-dooray.com) ([10.162.225.106]) by send002-relay.gov-dooray.com with SMTP id e5ae9752624c4c3c; Tue, 05 Apr 2022 23:03:40 +0900 DKIM-Signature: a=rsa-sha256; b=mmC1ZPupSV5SzQS1ZKjxuMc7Wl0LYjmfx2KXh9CdazJ5lRUguWuNOY5aSwW0lMhfoZebvlAWYo AUXAULPcI7a94XWQT2/469cmTuFvdOW9gfI9L1SD/L/L+34q7ViBPUze6iDaP8ur1Rlek40vGSM4 PHtm8vY8JXj2SWIJTU+DxJE+QWjqwN9go8zEc29eD4vIerqtlfc7CYZiSlwmAo3Yr3isTBdrNUW+ VUcjGJByXlCarb6mMSA7Aestggsv51GsVnODUcNBOXLHyOLQoX8c03mM1gJJu4mMF2kKpweQ/zY7 ix+521fuiPKiXJYj7PwgREYpmMZYtt5WuzDsHEpQ==; c=relaxed/relaxed; s=selector; d=dooray.com; v=1; bh=q6Y+sL20pByjS7tnsRpbRbv8LTWKow9uCe+F1yDFr5M=; h=From:To:Subject:Message-ID; Received: from [129.254.132.39] (HELO CHANKIMPC) ([129.254.132.39]) by smtp001-imp.gov-dooray.com with SMTP id d1d447ce624c4c3c; Tue, 05 Apr 2022 23:03:40 +0900 From: "Chan Kim" To: "'qemu-discuss'" , References: In-Reply-To: Subject: RE: How can I debug kernel module running on a virtual machine? Date: Tue, 5 Apr 2022 23:03:38 +0900 Message-ID: <02c301d848f5$f2d89fe0$d889dfa0$@etri.re.kr> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Content-Language: ko Thread-Index: AQF7yQE9IP5l0B3BZpxrpIYdQdmn1q2aWXdQ X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kernelnewbies-bounces@kernelnewbies.org Hello all, I found how to do it, I had asked it on stackoverflow.com and posted it as an answer there. Please see if you are interested. https://stackoverflow.com/questions/71749640/how-can-i-debug-kernel-module-r unning-on-a-virtual-machine/71753139#71753139 Thank you! Chan Kim > -----Original Message----- > From: Chan Kim > Sent: Tuesday, April 5, 2022 6:54 PM > To: 'qemu-discuss' ; > kernelnewbies@kernelnewbies.org > Subject: How can I debug kernel module running on a virtual machine? > > Hello all, > > I think I have once read about this but can't find it now. > I'm running linux-5.4.188 on a qemu arm64 virtual machine. Because I built > the kernel from the source, I can debug(analyze) the kernel by attaching > to the linux kernel program running on a remote machine(qemu virtual > machine). To test an application which uses our device(the device model is > in qemu too), I compiled a device driver against kernel 5.4.188 and the > linux application and can do insmod the driver and run the application. > Now something is wrong and I have panic while running the application. I > can debug linux kernel itself, but I don't know where the kernel module > was loaded, so the debugger cannot debug the driver module. How can I > debug the device driver? (or even the application? in case I need to > someday). I remember by first getting the loaded address of the kernel > module, and doing add-symbol-file for the driver image relative to that > loaded address, it is possible to do kernel module debug. I think this is > what driver developers will be doing always. Please tell me how I can do > it. If this is possible, it will save many days for me. > > Thank you! > Chan Kim _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies