From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 108771 invoked by alias); 18 Oct 2016 19:47:44 -0000 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 Received: (qmail 108747 invoked by uid 89); 18 Oct 2016 19:47:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=jumps, entrypoint, bootstrapping, pitfalls X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 18 Oct 2016 19:47:33 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 410E081F01; Tue, 18 Oct 2016 19:47:32 +0000 (UTC) Received: from host1.jankratochvil.net (ovpn-116-55.ams2.redhat.com [10.36.116.55]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9IJlTHu023189 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 18 Oct 2016 15:47:31 -0400 Date: Tue, 18 Oct 2016 19:47:00 -0000 From: Jan Kratochvil To: deffo@gmx.de Cc: gdb@sourceware.org Subject: Re: GDB does not stop at assembly code address Message-ID: <20161018194728.GA19800@host1.jankratochvil.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.0 (2016-08-17) X-IsSubscribed: yes X-SW-Source: 2016-10/txt/msg00029.txt.bz2 On Fri, 14 Oct 2016 17:21:36 +0200, deffo@gmx.de wrote: > What does not work is the breakpoint on startup_32, which is still in > Assembly land. GDB just jumps over it as if it wasn't called, but it is > definitely called since it's the 32-bit kernel entrypoint. > > Is this due to some real-mode/protected-mode fiddlings? On Tue, 18 Oct 2016 18:53:05 +0200, deffo@gmx.de wrote: > (gdb) b startup_32 > Breakpoint 1 at 0xc1000000: file arch/x86/kernel/head_32.S, line 97. It is because it is too early bootstap which does not yet run from virtual addresses. 0xc1000000 is a virtual address - if it was a physical address Linux kernel could not run on any machine with less than 3GB of RAM. (Which it can - there did exist machines with less than 3GB RAM. :-) ) This startup_32 code sets up the virtual memory page tables where it later jumps. But sure it does not jump to 0xc1000000 as it would dead-lock itself. It is better written in the 64-bit startup code but the principle is the same: arch/x86/kernel/head_64.S 63 * Since we may be loaded at an address different from what we were 64 * compiled to run at we first fixup the physical addresses in our page 65 * tables and then reload them. Debugging any bootstrapping code usually has many pitfalls. Jan