Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Theodore Roth <troth@verinet.com>
To: gdb-patches@sources.redhat.com
Subject: [RFC] fix for avr_skip_prologue()
Date: Fri, 19 Jul 2002 11:52:00 -0000	[thread overview]
Message-ID: <Pine.BSF.4.44.0207191235520.22394-100000@io.frii.com> (raw)

Hi,

Before I commit this, I wanted to know if this is the correct fix or just
an evil hack side-stepping the some other problem.

The problem shows up when I set a break point on a simple function as
such:

  (gdb) b foo_simple

If foo_simple() has no prologue, the break point is set at the _end_ of
the function (effectively the return insn).

If this fix is acceptable, is it too late to make it into the 5.2 branch?

Ted Roth



2002-07-19  Theodore A. Roth  <troth@verinet.com>

	* gdb/avr-tdep.c(avr_skip_prologue): Fix to return the correct pc.

Index: gdb/avr-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/avr-tdep.c,v
retrieving revision 1.4
diff -u -p -r1.4 avr-tdep.c
--- gdb/avr-tdep.c	17 Jun 2002 23:32:27 -0000	1.4
+++ gdb/avr-tdep.c	19 Jul 2002 18:33:30 -0000
@@ -995,7 +995,12 @@ avr_skip_prologue (CORE_ADDR pc)
     {
       sal = find_pc_line (func_addr, 0);

-      if (sal.line != 0 && sal.end < func_end)
+      /* troth/2002-70-19: For some very simple functions, gcc doesn't
+         generate a prologue and the sal.end ends up being the insn (2 bytes)
+         before func_end (the address of the next func). By adjusting
+         func_end, we can catch these functions and return the correct pc. */
+
+      if (sal.line != 0 && sal.end < (func_end-2))
 	return sal.end;
     }



             reply	other threads:[~2002-07-19 18:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-19 11:52 Theodore Roth [this message]
2002-07-19 12:04 ` Andrew Cagney
2002-08-04 12:43 ` Andrew Cagney
2002-08-04 13:54   ` Theodore A. Roth
2002-08-04 17:04     ` Andrew Cagney

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=Pine.BSF.4.44.0207191235520.22394-100000@io.frii.com \
    --to=troth@verinet.com \
    --cc=gdb-patches@sources.redhat.com \
    /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: link
Be 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