From: Andrew Cagney <ac131313@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: [ppc64 help] Convert breakpoint's into addresses
Date: Fri, 19 Sep 2003 19:41:00 -0000 [thread overview]
Message-ID: <3F6B5BCA.1040504@redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 981 bytes --]
Hello,
I think the ppc64 ELF ABI is officially wierd.
For "main" the minimal symbol table contains two symbols vis:
main: points at descriptor in .opd sectoin
.main: points at main's code entry point
Consequently, given only a minimal symbol table, GDB, when given:
(gdb) break main
will try to insert the breakpoint in the descriptor, and not the
function. Trying to enter:
(gdb) break .main
gets you no where (syntax error :-/)
Adding to the fun, GCC's debug info contains the symbol "main" which
points at the code address (and not the descriptor) and consequently
debugging with symbols works. Yes, this means that "main" has two
different values, arrrghghgh!!
Attatched is a hack to breakpoint.c that applies "convert from func ptr
addr" to any address. This causing the breakpoint code to convert
"main" into ".main" and hence work.
I don't know if its a right fix, good fix, or of any other alternative
fix. However it does work ...
help!
Andrew
[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 1112 bytes --]
2003-09-17 Andrew Cagney <cagney@redhat.com>
* breakpoint.c (set_raw_breakpoint): Apply
CONVERT_FROM_FUNC_PTR_ADDR to the breakpoint address.
(breakpoint_re_set_one): Ditto.
Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.129
diff -u -r1.129 breakpoint.c
--- breakpoint.c 14 Sep 2003 16:32:12 -0000 1.129
+++ breakpoint.c 19 Sep 2003 15:43:52 -0000
@@ -3866,7 +3866,7 @@
b = (struct breakpoint *) xmalloc (sizeof (struct breakpoint));
memset (b, 0, sizeof (*b));
- b->address = sal.pc;
+ b->address = CONVERT_FROM_FUNC_PTR_ADDR (sal.pc);
if (sal.symtab == NULL)
b->source_file = NULL;
else
@@ -6838,7 +6838,7 @@
savestring (sals.sals[i].symtab->filename,
strlen (sals.sals[i].symtab->filename));
b->line_number = sals.sals[i].line;
- b->address = sals.sals[i].pc;
+ b->address = CONVERT_FROM_FUNC_PTR_ADDR (sals.sals[i].pc);
/* Used to check for duplicates here, but that can
cause trouble, as it doesn't check for disabled
next reply other threads:[~2003-09-19 19:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-09-19 19:41 Andrew Cagney [this message]
2003-09-22 22:17 ` Kevin Buettner
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=3F6B5BCA.1040504@redhat.com \
--to=ac131313@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