From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24654 invoked by alias); 20 Jun 2011 18:31:28 -0000 Received: (qmail 24646 invoked by uid 22791); 20 Jun 2011 18:31:27 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from ausxipps301.us.dell.com (HELO ausxipps301.us.dell.com) (143.166.148.223) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 20 Jun 2011 18:31:13 +0000 X-Loopcount0: from 10.152.240.141 Subject: Re: Gdb shows wrong line numbers for the sourcecode Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Paul Koning In-Reply-To: <20110620173958.GA28683@raven.wolf.lan> Date: Mon, 20 Jun 2011 18:31:00 -0000 Cc: Content-Transfer-Encoding: quoted-printable Message-Id: References: <20110620173958.GA28683@raven.wolf.lan> To: Josef Wolf X-IsSubscribed: yes 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-06/txt/msg00123.txt.bz2 Probably the fact that your GDB is an antique. I found that a version of GDB not nearly so out of date was unuseable with = current GCC. Updated to the current (7.2) and all is well. paul On Jun 20, 2011, at 1:39 PM, Josef Wolf wrote: > Hello, >=20 > I have built a toolchain for ARM Cortex-M3 based on >=20 > binutils-2.20 > gcc-4.4.3 > gdb-6.0 > openocd-0.4.0 >=20 > With this combination, gdb shows wrong line numbers and wrong lines in the > source listings and in the backtrace like this: >=20 > (gdb) bt > #0 0x080004a6 in main (argc=3D536891392, argv=3D0x20005000) at main.c:45 > (gdb) cont > Continuing. >=20 > Breakpoint 2, 0x080003a4 in send_char (ch=3D19 '\023') at main.c:45 > 45 while (RCC_GetFlagStatus (RCC_FLAG_PLLRDY) =3D=3D RESET) { > (gdb) bt > #0 0x080003a4 in send_char (ch=3D19 '\023') at main.c:45 > #1 0x080004ca in main (argc=3D536891392, argv=3D0x20005000) at main.c:45 >=20 > In reality, the main function begins at line 91 and the send_char function > begins at line 84. The source code line shown at the breakpoint is a tota= lly > different function. >=20 > Any ideas what could cause gdb to get confused?