public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "karthikthecool at gmail dot com" <sourceware-bugzilla@sourceware.org> 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 [thread overview] Message-ID: <bug-14261-4717@http.sourceware.org/bugzilla/> (raw) 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.
next reply other threads:[~2012-06-18 12:12 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-06-18 12:12 karthikthecool at gmail dot com [this message] 2013-10-30 23:18 ` [Bug gdb/14261] " will.newton at gmail dot com 2014-10-30 14:53 ` chrbr at gcc dot gnu.org 2014-10-30 14:56 ` chrbr at gcc dot gnu.org 2014-12-12 0:42 ` [Bug tdep/14261] " qiyao at gcc dot gnu.org 2014-12-12 0:52 ` cvs-commit at gcc dot gnu.org 2014-12-12 2:14 ` qiyao at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-14261-4717@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=gdb-prs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).