From: Aleksandar Ristovski <aristovski@qnx.com>
To: gdb-patches@sources.redhat.com
Subject: Re: [patch] nto target: fix null pointer dereference
Date: Thu, 14 Aug 2008 20:46:00 -0000 [thread overview]
Message-ID: <48A4996B.3000109@qnx.com> (raw)
In-Reply-To: <48A301C7.7050306@qnx.com>
[-- Attachment #1: Type: text/plain, Size: 153 bytes --]
Ulrich Weigand wrote:
>
> ... you might want to cache the address you've computed once
Changed accordingly, new patch attached.
Thanks,
Aleksandar
[-- Attachment #2: nto-tdep.c.200808141635.diff.ChangeLog --]
[-- Type: text/plain, Size: 208 bytes --]
2008-08-14 Aleksandar Ristovski <aristovski@qnx.com>
* nto-tdep.c (lm_info): Updated struct lm_info definition from
solib-svr4.c
(LM_ADDR): Use l_addr if available; if not, use link map and set l_addr.
[-- Attachment #3: nto-tdep.c.200808141635.diff --]
[-- Type: text/plain, Size: 1979 bytes --]
Index: gdb/nto-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/nto-tdep.c,v
retrieving revision 1.25
diff -u -p -r1.25 nto-tdep.c
--- gdb/nto-tdep.c 23 Jul 2008 13:36:00 -0000 1.25
+++ gdb/nto-tdep.c 14 Aug 2008 20:37:20 -0000
@@ -253,21 +253,39 @@ nto_parse_redirection (char *pargv[], co
solib-svr4.c to support nto_relocate_section_addresses
which is different from the svr4 version. */
+/* Link map info to include in an allocated so_list entry */
+
struct lm_info
-{
- /* Pointer to copy of link map from inferior. The type is char *
- rather than void *, so that we may use byte offsets to find the
- various fields without the need for a cast. */
- char *lm;
-};
+ {
+ /* Pointer to copy of link map from inferior. The type is char *
+ rather than void *, so that we may use byte offsets to find the
+ various fields without the need for a cast. */
+ gdb_byte *lm;
+
+ /* Amount by which addresses in the binary should be relocated to
+ match the inferior. This could most often be taken directly
+ from lm, but when prelinking is involved and the prelink base
+ address changes, we may need a different offset, we want to
+ warn about the difference and compute it only once. */
+ CORE_ADDR l_addr;
+
+ /* The target location of lm. */
+ CORE_ADDR lm_addr;
+ };
+
static CORE_ADDR
LM_ADDR (struct so_list *so)
{
- struct link_map_offsets *lmo = nto_fetch_link_map_offsets ();
+ if (so->lm_info->l_addr == (CORE_ADDR)-1)
+ {
+ struct link_map_offsets *lmo = nto_fetch_link_map_offsets ();
- return extract_typed_address (so->lm_info->lm + lmo->l_addr_offset,
- builtin_type_void_data_ptr);
+ so->lm_info->l_addr =
+ extract_typed_address (so->lm_info->lm + lmo->l_addr_offset,
+ builtin_type_void_data_ptr);
+ }
+ return so->lm_info->l_addr;
}
static CORE_ADDR
next prev parent reply other threads:[~2008-08-14 20:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-13 13:30 Ulrich Weigand
2008-08-13 15:50 ` Aleksandar Ristovski
2008-08-14 20:46 ` Aleksandar Ristovski [this message]
-- strict thread matches above, loose matches on Subject: below --
2008-08-14 20:51 Ulrich Weigand
2008-08-12 18:33 Ulrich Weigand
2008-08-12 21:26 ` Aleksandar Ristovski
2008-08-12 21:32 ` Daniel Jacobowitz
2008-08-13 15:47 ` Aleksandar Ristovski
2008-08-12 16:38 Aleksandar Ristovski
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=48A4996B.3000109@qnx.com \
--to=aristovski@qnx.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