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 3DF32C433EF for ; Mon, 18 Jul 2022 08:57:04 +0000 (UTC) Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.95) (envelope-from ) id 1oDMYl-0008RR-2t; Mon, 18 Jul 2022 04:56:59 -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.95) (envelope-from ) id 1oDMYh-0008O7-M1 for kernelnewbies@kernelnewbies.org; Mon, 18 Jul 2022 04:56:56 -0400 Received: from unknown (HELO send002-relay.gov-dooray.com) (211.180.235.153) by 129.254.9.16 with ESMTP; 18 Jul 2022 17:56:50 +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 f687e63462d52052; Mon, 18 Jul 2022 17:56:50 +0900 DKIM-Signature: a=rsa-sha256; b=eaIBemKudUBjobeAdpmlEuRqWQXaVSvUvOS/hctYTMh6xciGA3OPG+yO81XSDimO6lxC8GEtLf 3xojbq3/Wpo2czmh7JgsumN6hNpgFEaCMkFKpPwfeAifsm696ktcOudsYpRyB5X973QNqtdFMY7x 4cPg8njdj3Z2pNbhXXsWTjv44XUaMT2EQFSy89+ed/xcs6B5cI+yEscSq+JIuFuIfdywzTXrw8Y7 TCjmQAqrmQblWVlcW6NKeK7UDzR3t5Yq2v2oMvk+SL9AiG6yoobK8vM8YXGBoec9cEj75hxQLAoj u5gu6LYrIH2btC8Gkm1TIAJ9RytGPZIhPH2sOD6A==; c=relaxed/relaxed; s=selector; d=dooray.com; v=1; bh=ibziBmwZgcepoovEspd40YOoskGDdRGp/CSP00cCyUc=; 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 5dced6e462d52052; Mon, 18 Jul 2022 17:56:50 +0900 From: "Chan Kim" To: References: In-Reply-To: Subject: RE: Confused about how to apply add-symbol-file in gdb Date: Mon, 18 Jul 2022 17:56:49 +0900 Message-ID: <02e101d89a84$513862c0$f3a92840$@etri.re.kr> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Content-Language: ko Thread-Index: AQFvsyxdef9Ttkm8chXZ5rIqEqjrWK5VoTBQ 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, I found from the manual, (https://sourceware.org/gdb/onlinedocs/gdb/Files.html#:~:text=The%20add%2Dsy mbol%2Dfile%20command,text%20section%20has%20been%20loaded.) By giving "-o 0x10000" I can follow the kernel source in the virtual address. (and follow sources after start_kernel) Thank you. Chan Kim >-----Original Message----- >From: Chan Kim >Sent: Monday, July 18, 2022 5:43 PM >To: kernelnewbies@kernelnewbies.org >Subject: Confused about how to apply add-symbol-file in gdb > >Hello all, > >I thought I know how to apply add-symbol-file command in gdb but now I'm >confused. >I'm using qemu to test booting linux using u-boot. (arm64) I've loaded u- >boot at 0x4000000 and loaded linux Image (binary, not elf) at 0x80010000. >The dtb is loaded at 0x80000000. >(because qemu loads the dtb file at the first address of RAM (which is >0x80000000) I moved kernel image to 0x80010000) After the PC jumps to linux, >I can follow the source while the PC value uses physical address. >I think this is possible that I gave gdb this command. >add-symbol-file vmlinux -s .head.text 0x80010000 -s .text 0x80020000 (using >readelf -e vmlinux command, I can see the section offsets relative to the >start of the Image file. The output starts like this. >Section Headers: > [Nr] Name Type Address Offset > Size EntSize Flags Link Info Align > [ 0] NULL 0000000000000000 00000000 > 0000000000000000 0000000000000000 0 0 0 > [ 1] .head.text PROGBITS ffffffc010000000 00010000 > 0000000000010000 0000000000000000 AX 0 0 65536 > [ 2] .text PROGBITS ffffffc010010000 00020000 > 0000000000aa4dc8 0000000000000008 AX 0 0 2048 > [ 3] .got.plt PROGBITS ffffffc010ab4dc8 00ac4dc8 > 0000000000000018 0000000000000008 WA 0 0 8 > [ 4] .rodata PROGBITS ffffffc010ac0000 00ad0000 > 0000000000645018 0000000000000000 WA 0 0 4096 > [ 5] .pci_fixup PROGBITS ffffffc011105020 01115020 > 00000000000025e0 0000000000000000 A 0 0 16 > [ 6] __ksymtab PROGBITS ffffffc011107600 01117600 > 000000000000b3b8 0000000000000000 A 0 0 4 > [ 7] __ksymtab_gpl PROGBITS ffffffc0111129b8 011229b8 >... > >Now, at the end of __primary_switch function, the PC value becomes virtual. >But I can't follow kernel source from that point. >Until now, I have placed kernel Image at 0x80000000 and dtb was at >0x82800000 and just by giving "add-symbol-file vmlinux" again, there was no >problem following the kernel source in virtual address. >How should I give the add-symbol-file command when the Image is now at >0x80010000?? >Any comment welcome. >Thank you. > >Chan Kim _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies