From: Andrew Cagney <cagney@gnu.org>
To: gdb-patches@sources.redhat.com
Subject: [patch/rfc] Move skip_prologue_using_sal to symtab.c
Date: Sat, 14 Feb 2004 19:46:00 -0000 [thread overview]
Message-ID: <402E7B0C.8030409@gnu.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 321 bytes --]
Hello,
This patch moves the two identical versions of skip_prologue_using_sal,
found in both mips-tdep and frv-tdep, into symtab.c (just after
in_prologue).
I've also added comments to the two refine_prologue_limit variants
(found in ia64-tdep and rs6000-tdep) pointing at the new code.
comments? symtab ok?
Andrew
[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 9401 bytes --]
2004-02-14 Andrew Cagney <cagney@redhat.com>
* symtab.c (skip_prologue_using_sal): New function.
* symtab.h (skip_prologue_using_sal): Declare.
* frv-tdep.c (skip_prologue_using_sal): Delete function.
* mips-tdep.c (skip_prologue_using_sal): Delete function.
* rs6000-tdep.c (refine_prologue_limit): Mention
skip_prologue_using_sal.
* ia64-tdep.c (refine_prologue_limit): Ditto.
Index: frv-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/frv-tdep.c,v
retrieving revision 1.70
diff -u -r1.70 frv-tdep.c
--- frv-tdep.c 14 Feb 2004 15:46:33 -0000 1.70
+++ frv-tdep.c 14 Feb 2004 19:28:42 -0000
@@ -414,62 +414,6 @@
return (8 <= reg && reg <= 13);
}
-/* Given PC at the function's start address, attempt to find the
- prologue end using SAL information. Return zero if the skip fails.
-
- A non-optimized prologue traditionally has one SAL for the function
- and a second for the function body. A single line function has
- them both pointing at the same line.
-
- An optimized prologue is similar but the prologue may contain
- instructions (SALs) from the instruction body. Need to skip those
- while not getting into the function body.
-
- The functions end point and an increasing SAL line are used as
- indicators of the prologue's endpoint.
-
- This code is based on the function refine_prologue_limit (versions
- found in both ia64 and ppc). */
-
-static CORE_ADDR
-skip_prologue_using_sal (CORE_ADDR func_addr)
-{
- struct symtab_and_line prologue_sal;
- CORE_ADDR start_pc;
- CORE_ADDR end_pc;
-
- /* Get an initial range for the function. */
- find_pc_partial_function (func_addr, NULL, &start_pc, &end_pc);
- start_pc += FUNCTION_START_OFFSET;
-
- prologue_sal = find_pc_line (start_pc, 0);
- if (prologue_sal.line != 0)
- {
- while (prologue_sal.end < end_pc)
- {
- struct symtab_and_line sal;
-
- sal = find_pc_line (prologue_sal.end, 0);
- if (sal.line == 0)
- break;
- /* Assume that a consecutive SAL for the same (or larger)
- line mark the prologue -> body transition. */
- if (sal.line >= prologue_sal.line)
- break;
- /* The case in which compiler's optimizer/scheduler has
- moved instructions into the prologue. We look ahead in
- the function looking for address ranges whose
- corresponding line number is less the first one that we
- found for the function. This is more conservative then
- refine_prologue_limit which scans a large number of SALs
- looking for any in the prologue */
- prologue_sal = sal;
- }
- }
- return prologue_sal.end;
-}
-
-
/* Scan an FR-V prologue, starting at PC, until frame->PC.
If FRAME is non-zero, fill in its saved_regs with appropriate addresses.
We assume FRAME's saved_regs array has already been allocated and cleared.
Index: ia64-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ia64-tdep.c,v
retrieving revision 1.114
diff -u -r1.114 ia64-tdep.c
--- ia64-tdep.c 14 Feb 2004 15:46:33 -0000 1.114
+++ ia64-tdep.c 14 Feb 2004 19:28:47 -0000
@@ -930,6 +930,9 @@
used with no further scanning in the event that the function is
frameless. */
+/* FIXME: cagney/2004-02-14: This function and logic have largely been
+ superseeded by skip_prologue_using_sal. */
+
static CORE_ADDR
refine_prologue_limit (CORE_ADDR pc, CORE_ADDR lim_pc, int *trust_limit)
{
Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.282
diff -u -r1.282 mips-tdep.c
--- mips-tdep.c 11 Feb 2004 18:47:26 -0000 1.282
+++ mips-tdep.c 14 Feb 2004 19:28:52 -0000
@@ -4564,62 +4564,6 @@
extract_unsigned_integer (buf, MIPS_INSTLEN));
}
-
-/* Given PC at the function's start address, attempt to find the
- prologue end using SAL information. Return zero if the skip fails.
-
- A non-optimized prologue traditionally has one SAL for the function
- and a second for the function body. A single line function has
- them both pointing at the same line.
-
- An optimized prologue is similar but the prologue may contain
- instructions (SALs) from the instruction body. Need to skip those
- while not getting into the function body.
-
- The functions end point and an increasing SAL line are used as
- indicators of the prologue's endpoint.
-
- This code is based on the function refine_prologue_limit (versions
- found in both ia64 and ppc). */
-
-static CORE_ADDR
-skip_prologue_using_sal (CORE_ADDR func_addr)
-{
- struct symtab_and_line prologue_sal;
- CORE_ADDR start_pc;
- CORE_ADDR end_pc;
-
- /* Get an initial range for the function. */
- find_pc_partial_function (func_addr, NULL, &start_pc, &end_pc);
- start_pc += FUNCTION_START_OFFSET;
-
- prologue_sal = find_pc_line (start_pc, 0);
- if (prologue_sal.line != 0)
- {
- while (prologue_sal.end < end_pc)
- {
- struct symtab_and_line sal;
-
- sal = find_pc_line (prologue_sal.end, 0);
- if (sal.line == 0)
- break;
- /* Assume that a consecutive SAL for the same (or larger)
- line mark the prologue -> body transition. */
- if (sal.line >= prologue_sal.line)
- break;
- /* The case in which compiler's optimizer/scheduler has
- moved instructions into the prologue. We look ahead in
- the function looking for address ranges whose
- corresponding line number is less the first one that we
- found for the function. This is more conservative then
- refine_prologue_limit which scans a large number of SALs
- looking for any in the prologue */
- prologue_sal = sal;
- }
- }
- return prologue_sal.end;
-}
-
/* Skip the PC past function prologue instructions (32-bit version).
This is a helper function for mips_skip_prologue. */
Index: rs6000-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/rs6000-tdep.c,v
retrieving revision 1.179
diff -u -r1.179 rs6000-tdep.c
--- rs6000-tdep.c 14 Feb 2004 15:46:33 -0000 1.179
+++ rs6000-tdep.c 14 Feb 2004 19:29:07 -0000
@@ -425,6 +425,10 @@
the line data in the symbol table. If successful, a better guess
on where the prologue ends is returned, otherwise the previous
value of lim_pc is returned. */
+
+/* FIXME: cagney/2004-02-14: This function and logic have largely been
+ superseeded by skip_prologue_using_sal. */
+
static CORE_ADDR
refine_prologue_limit (CORE_ADDR pc, CORE_ADDR lim_pc)
{
Index: symtab.c
===================================================================
RCS file: /cvs/src/src/gdb/symtab.c,v
retrieving revision 1.126
diff -u -r1.126 symtab.c
--- symtab.c 7 Feb 2004 23:13:47 -0000 1.126
+++ symtab.c 14 Feb 2004 19:29:11 -0000
@@ -3860,6 +3860,60 @@
return func_addr <= pc && pc < sal.end;
}
+/* Given PC at the function's start address, attempt to find the
+ prologue end using SAL information. Return zero if the skip fails.
+
+ A non-optimized prologue traditionally has one SAL for the function
+ and a second for the function body. A single line function has
+ them both pointing at the same line.
+
+ An optimized prologue is similar but the prologue may contain
+ instructions (SALs) from the instruction body. Need to skip those
+ while not getting into the function body.
+
+ The functions end point and an increasing SAL line are used as
+ indicators of the prologue's endpoint.
+
+ This code is based on the function refine_prologue_limit (versions
+ found in both ia64 and ppc). */
+
+CORE_ADDR
+skip_prologue_using_sal (CORE_ADDR func_addr)
+{
+ struct symtab_and_line prologue_sal;
+ CORE_ADDR start_pc;
+ CORE_ADDR end_pc;
+
+ /* Get an initial range for the function. */
+ find_pc_partial_function (func_addr, NULL, &start_pc, &end_pc);
+ start_pc += FUNCTION_START_OFFSET;
+
+ prologue_sal = find_pc_line (start_pc, 0);
+ if (prologue_sal.line != 0)
+ {
+ while (prologue_sal.end < end_pc)
+ {
+ struct symtab_and_line sal;
+
+ sal = find_pc_line (prologue_sal.end, 0);
+ if (sal.line == 0)
+ break;
+ /* Assume that a consecutive SAL for the same (or larger)
+ line mark the prologue -> body transition. */
+ if (sal.line >= prologue_sal.line)
+ break;
+ /* The case in which compiler's optimizer/scheduler has
+ moved instructions into the prologue. We look ahead in
+ the function looking for address ranges whose
+ corresponding line number is less the first one that we
+ found for the function. This is more conservative then
+ refine_prologue_limit which scans a large number of SALs
+ looking for any in the prologue */
+ prologue_sal = sal;
+ }
+ }
+ return prologue_sal.end;
+}
\f
struct symtabs_and_lines
decode_line_spec (char *string, int funfirstline)
Index: symtab.h
===================================================================
RCS file: /cvs/src/src/gdb/symtab.h,v
retrieving revision 1.87
diff -u -r1.87 symtab.h
--- symtab.h 7 Feb 2004 23:13:47 -0000 1.87
+++ symtab.h 14 Feb 2004 19:29:33 -0000
@@ -1318,6 +1318,8 @@
extern int in_prologue (CORE_ADDR pc, CORE_ADDR func_start);
+extern CORE_ADDR skip_prologue_using_sal (CORE_ADDR func_addr);
+
extern struct symbol *fixup_symbol_section (struct symbol *,
struct objfile *);
next reply other threads:[~2004-02-14 19:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-14 19:46 Andrew Cagney [this message]
2004-02-17 14:53 ` Elena Zannoni
2004-02-17 15:19 ` 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=402E7B0C.8030409@gnu.org \
--to=cagney@gnu.org \
--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