From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21208 invoked by alias); 18 Jun 2012 12:12:54 -0000 Received: (qmail 21182 invoked by uid 22791); 18 Jun 2012 12:12:51 -0000 X-SWARE-Spam-Status: No, hits=-3.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO sourceware.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 18 Jun 2012 12:12:38 +0000 From: "karthikthecool at gmail dot com" To: gdb-prs@sourceware.org Subject: [Bug gdb/14261] New: Break point not set at the 1st executable instruction in case of code compiled with clang on ARM Architecture. Date: Mon, 18 Jun 2012 12:12:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: karthikthecool at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org X-SW-Source: 2012-q2/txt/msg00252.txt.bz2 http://sourceware.org/bugzilla/show_bug.cgi?id=14261 Bug #: 14261 Summary: Break point not set at the 1st executable instruction in case of code compiled with clang on ARM Architecture. Product: gdb Version: 7.4 Status: NEW Severity: normal Priority: P2 Component: gdb AssignedTo: unassigned@sourceware.org ReportedBy: karthikthecool@gmail.com Classification: Unclassified Created attachment 6456 --> http://sourceware.org/bugzilla/attachment.cgi?id=6456 Assembly files with R(0123) which works fine and Assembly generated by clang which uses R(4-12) as well. Dear Developers, We are using clang(LLVM) compiled binary on ARM and debugging the same using GDB. When a break point is set at a function, it is set at the 1st line instead of 1st executable instruction. E.g. For e.g. In the below function- int main() //line 1 { //line 2 //line 3 int j =0; //line 4 return j; //line 5 } //line 6 When we compile the above code and run gdb with the following commands- gdb a.out break main The break point is set at line 2 instead of line 4. Upon Debugging we found that in GDB Arm-tdep.c - static CORE_ADDR arm_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) if ((inst & 0xffffc000) == 0xe5cd0000 /* strb r(0123),[sp,#nn] */ || (inst & 0xffffc0f0) == 0xe1cd00b0 /* strh r(0123),[sp,#nn] */ || (inst & 0xffffc000) == 0xe58d0000) /* str r(0123),[sp,#nn] */ continue; We skip the prologue only in case strb uses registers r0,r1,r2 or r3 in prologue code. clang (LLVM) generates strb instruction with r4,r5...etc not just r(0123) in prologue code. In clang case the usage of any other register other than r(0123) in strb/strh/str instruction is resulting in generation of wrong prologue_end resulting in break point not being set at 1st executable instruction.When we modified the strb/strh/str instructions to use r(0123) gdb functionality of break/list/watch functions correctly. Attached is the assembly and source code of a function compiled using clang in which r12/ r4 is used in strb/strh/str/ldr etc instructions used during parameter assignment which results in failure of the above check in arm_skip_prologue resulting in wrong prologue end info. We would like to know if we are checking against r(0123) for some specific purpose or because some specification mandates this usage ? -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.