From: Corinna Vinschen <vinschen@redhat.com>
To: gdb-patches <gdb-patches@sources.redhat.com>
Subject: [PATCH]: Add SKIP_TRAMPOLINE_CODE handling to multi arch code
Date: Wed, 15 Aug 2001 01:50:00 -0000 [thread overview]
Message-ID: <20010815105028.R17709@cygbert.vinschen.de> (raw)
Hi,
since the SKIP_TRAMPOLINE_CODE handling had no multi arch interface
so far, I created the following patch. For non-multiarched and
mutiarched targets which don't have the need to define
SKIP_TRAMPOLINE_CODE this patch defines `generic_skip_trampoline_code()'
in arch-utils which behaves like the old SKIP_TRAMPOLINE_CODE
default in infrun.c (returning 0).
Corinna
ChangeLog:
==========
2001-08-15 Corinna Vinschen <vinschen@redhat.com>
* arch-utils.c (generic_skip_trampoline_code): New function.
* arch-utils.h: Declare generic_skip_trampoline_code external.
* gdbarch.c: Regeberated from gdbarch.sh.
* gdbarch.h: Ditto.
* gdbarch.sh (SKIP_TRAMPOLINE_CODE): Multi-arch.
* infrun.c: Remove default setting of SKIP_TRAMPOLINE_CODE macro.
Index: arch-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.c,v
retrieving revision 1.34
diff -u -p -r1.34 arch-utils.c
--- arch-utils.c 2001/08/11 00:59:29 1.34
+++ arch-utils.c 2001/08/15 08:41:30
@@ -99,6 +99,12 @@ generic_return_value_on_stack_not (struc
return 0;
}
+CORE_ADDR
+generic_skip_trampoline_code (CORE_ADDR pc)
+{
+ return 0;
+}
+
char *
legacy_register_name (int i)
{
Index: arch-utils.h
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.h,v
retrieving revision 1.19
diff -u -p -r1.19 arch-utils.h
--- arch-utils.h 2001/08/11 00:59:29 1.19
+++ arch-utils.h 2001/08/15 08:41:30
@@ -127,4 +127,6 @@ int cannot_register_not (int regnum);
extern gdbarch_virtual_frame_pointer_ftype legacy_virtual_frame_pointer;
+extern CORE_ADDR generic_skip_trampoline_code (CORE_ADDR pc);
+
#endif
Index: gdbarch.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.c,v
retrieving revision 1.71
diff -u -p -r1.71 gdbarch.c
--- gdbarch.c 2001/08/11 00:59:29 1.71
+++ gdbarch.c 2001/08/15 08:41:31
@@ -249,6 +249,7 @@ struct gdbarch
gdbarch_convert_from_func_ptr_addr_ftype *convert_from_func_ptr_addr;
gdbarch_addr_bits_remove_ftype *addr_bits_remove;
gdbarch_software_single_step_ftype *software_single_step;
+ gdbarch_skip_trampoline_code_ftype *skip_trampoline_code;
};
@@ -383,6 +384,7 @@ struct gdbarch startup_gdbarch =
0,
0,
0,
+ 0,
/* startup_gdbarch() */
};
@@ -482,6 +484,7 @@ gdbarch_alloc (const struct gdbarch_info
gdbarch->extra_stack_alignment_needed = 1;
gdbarch->convert_from_func_ptr_addr = core_addr_identity;
gdbarch->addr_bits_remove = core_addr_identity;
+ gdbarch->skip_trampoline_code = generic_skip_trampoline_code;
/* gdbarch_alloc() */
return gdbarch;
@@ -777,6 +780,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of convert_from_func_ptr_addr, invalid_p == 0 */
/* Skip verify of addr_bits_remove, invalid_p == 0 */
/* Skip verify of software_single_step, has predicate */
+ /* Skip verify of skip_trampoline_code, invalid_p == 0 */
}
@@ -1468,6 +1472,12 @@ gdbarch_dump (struct gdbarch *gdbarch, s
"SOFTWARE_SINGLE_STEP(sig, insert_breakpoints_p)",
XSTRING (SOFTWARE_SINGLE_STEP (sig, insert_breakpoints_p)));
#endif
+#ifdef SKIP_TRAMPOLINE_CODE
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "SKIP_TRAMPOLINE_CODE(pc)",
+ XSTRING (SKIP_TRAMPOLINE_CODE (pc)));
+#endif
#ifdef TARGET_ARCHITECTURE
if (TARGET_ARCHITECTURE != NULL)
fprintf_unfiltered (file,
@@ -2200,6 +2210,13 @@ gdbarch_dump (struct gdbarch *gdbarch, s
(long) current_gdbarch->software_single_step
/*SOFTWARE_SINGLE_STEP ()*/);
#endif
+#ifdef SKIP_TRAMPOLINE_CODE
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: SKIP_TRAMPOLINE_CODE = 0x%08lx\n",
+ (long) current_gdbarch->skip_trampoline_code
+ /*SKIP_TRAMPOLINE_CODE ()*/);
+#endif
if (current_gdbarch->dump_tdep != NULL)
current_gdbarch->dump_tdep (current_gdbarch, file);
}
@@ -4311,6 +4328,24 @@ set_gdbarch_software_single_step (struct
gdbarch_software_single_step_ftype software_single_step)
{
gdbarch->software_single_step = software_single_step;
+}
+
+CORE_ADDR
+gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, CORE_ADDR pc)
+{
+ if (gdbarch->skip_trampoline_code == 0)
+ internal_error (__FILE__, __LINE__,
+ "gdbarch: gdbarch_skip_trampoline_code invalid");
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_skip_trampoline_code called\n");
+ return gdbarch->skip_trampoline_code (pc);
+}
+
+void
+set_gdbarch_skip_trampoline_code (struct gdbarch *gdbarch,
+ gdbarch_skip_trampoline_code_ftype skip_trampoline_code)
+{
+ gdbarch->skip_trampoline_code = skip_trampoline_code;
}
Index: gdbarch.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.h,v
retrieving revision 1.58
diff -u -p -r1.58 gdbarch.h
--- gdbarch.h 2001/08/11 00:59:29 1.58
+++ gdbarch.h 2001/08/15 08:41:32
@@ -1947,6 +1947,23 @@ extern void set_gdbarch_software_single_
#endif
#endif
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (SKIP_TRAMPOLINE_CODE)
+#define SKIP_TRAMPOLINE_CODE(pc) (generic_skip_trampoline_code (pc))
+#endif
+
+typedef CORE_ADDR (gdbarch_skip_trampoline_code_ftype) (CORE_ADDR pc);
+extern CORE_ADDR gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, CORE_ADDR pc);
+extern void set_gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, gdbarch_skip_trampoline_code_ftype *skip_trampoline_code);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (SKIP_TRAMPOLINE_CODE)
+#error "Non multi-arch definition of SKIP_TRAMPOLINE_CODE"
+#endif
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (SKIP_TRAMPOLINE_CODE)
+#define SKIP_TRAMPOLINE_CODE(pc) (gdbarch_skip_trampoline_code (current_gdbarch, pc))
+#endif
+#endif
+
extern struct gdbarch_tdep *gdbarch_tdep (struct gdbarch *gdbarch);
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.75
diff -u -p -r1.75 gdbarch.sh
--- gdbarch.sh 2001/08/11 00:59:29 1.75
+++ gdbarch.sh 2001/08/15 08:41:33
@@ -539,6 +539,7 @@ f:2:ADDR_BITS_REMOVE:CORE_ADDR:addr_bits
# FIXME/cagney/2001-01-18: The logic is backwards. It should be asking if the target can
# single step. If not, then implement single step using breakpoints.
F:2:SOFTWARE_SINGLE_STEP:void:software_single_step:enum target_signal sig, int insert_breakpoints_p:sig, insert_breakpoints_p::0:0
+f:2:SKIP_TRAMPOLINE_CODE:CORE_ADDR:skip_trampoline_code:CORE_ADDR pc:pc:::generic_skip_trampoline_code::0
EOF
}
Index: infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.45
diff -u -p -r1.45 infrun.c
--- infrun.c 2001/07/16 14:46:34 1.45
+++ infrun.c 2001/08/15 08:41:36
@@ -120,14 +120,6 @@ static int may_follow_exec = MAY_FOLLOW_
#endif
-/* Some machines have trampoline code that sits between function callers
- and the actual functions themselves. If this machine doesn't have
- such things, disable their processing. */
-
-#ifndef SKIP_TRAMPOLINE_CODE
-#define SKIP_TRAMPOLINE_CODE(pc) 0
-#endif
-
/* Dynamic function trampolines are similar to solib trampolines in that they
are between the caller and the callee. The difference is that when you
enter a dynamic trampoline, you can't determine the callee's address. Some
--
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.
mailto:vinschen@redhat.com
next reply other threads:[~2001-08-15 1:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-08-15 1:50 Corinna Vinschen [this message]
2001-08-15 8:20 ` 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=20010815105028.R17709@cygbert.vinschen.de \
--to=vinschen@redhat.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