From: Jose Flavio Aguilar Paulino <jflavio@br.ibm.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 24700]
Date: Thu, 01 Mar 2007 18:27:00 -0000 [thread overview]
Message-ID: <1172777198.10229.11.camel@kadinsky.prado> (raw)
[-- Attachment #1: Type: text/plain, Size: 544 bytes --]
This patch modifies the <gdb/ppc-linux-tdep.c> file.
It was noticed in GDB for PPC64 that the command "set var" failed when
used to change a string value, the intent of this patch is to solve this
gdb64's problem. Ex:
char *ptr = NULL;
printf("ptr string is %s\n", ptr);
(gdb) set var ptr="def"
---Problem Description---
gdb64: failed to set a string variable's value.
I could not detect any regressions that could be caused by this patch in GDB's testsuite.
-----
José Flávio Aguilar Paulino
Software Engineer
LoP Toolchain Team
IBM
[-- Attachment #2: 24700.patch --]
[-- Type: text/x-patch, Size: 2025 bytes --]
Index: ppc-linux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ppc-linux-tdep.c,v
retrieving revision 1.81
diff -a -u -r1.81 ppc-linux-tdep.c
--- ppc-linux-tdep.c 9 Jan 2007 17:58:55 -0000 1.81
+++ ppc-linux-tdep.c 8 Feb 2007 01:11:15 -0000
@@ -753,11 +753,57 @@
CORE_ADDR addr,
struct target_ops *targ)
{
+ CORE_ADDR addr2deref = 0;
struct section_table *s = target_section_by_addr (targ, addr);
+ char buf[sizeof (ULONGEST)];
+ struct objfile *objfile;
+ struct obj_section *osect;
+ asection *sect;
+ CORE_ADDR sect_addr;
/* Check if ADDR points to a function descriptor. */
- if (s && strcmp (s->the_bfd_section->name, ".opd") == 0)
- return get_target_memory_unsigned (targ, addr, 8);
+
+
+ if (s)
+ {
+ if (strcmp (s->the_bfd_section->name, ".opd") != 0)
+ /* Found a the section, but it's not an .opd section. */
+ return addr;
+ addr2deref = addr;
+ }
+ else
+ /* The followin table search has been copied from printcmd.c */
+ ALL_OBJSECTIONS (objfile, osect)
+ {
+ /* Only process each object file once, even if there's a separate
+ debug file. */
+ if (objfile->separate_debug_objfile_backlink)
+ continue;
+
+ sect = osect->the_bfd_section;
+ sect_addr = overlay_mapped_address (addr, sect);
+
+ if (osect->addr <= sect_addr && sect_addr < osect->endaddr)
+ {
+ if (strcmp (sect->name, ".opd") != 0)
+ /* Found the section, but it's not an .opd section. */
+ return addr;
+ addr2deref = addr;
+ break;
+ }
+ }
+
+ if (addr2deref)
+ {
+ if (targ != ¤t_target)
+ return get_target_memory_unsigned (targ, addr2deref, 8);
+ else
+ {
+ gdb_assert (8 <= sizeof (buf));
+ target_read_memory(addr, buf, 8);
+ return extract_unsigned_integer (buf, 8);
+ }
+ }
return addr;
}
next reply other threads:[~2007-03-01 18:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-01 18:27 Jose Flavio Aguilar Paulino [this message]
2007-03-01 18:37 ` Daniel Jacobowitz
2007-03-01 20:06 ` Jose Flavio Aguilar Paulino
2007-03-01 20:40 ` Daniel Jacobowitz
2007-03-01 21:56 ` Thiago Jung Bauermann
2007-03-01 22:03 ` Daniel Jacobowitz
2007-03-01 22:28 ` Thiago Jung Bauermann
2007-03-01 22:47 ` Andreas Schwab
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=1172777198.10229.11.camel@kadinsky.prado \
--to=jflavio@br.ibm.com \
--cc=gdb-patches@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: 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