Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: John Gilmore <gnu@toad.com>
To: Aleksandar Ristovski <aristovski@qnx.com>
Cc: John Gilmore <gnu@toad.com>,
	Jan Kratochvil <jan.kratochvil@redhat.com>,
	  Raphael Zulliger <zulliger@indel.ch>,
	gdb@sourceware.org
Subject: Re: Ensure correct symbol-file when attaching to a (remote) process
Date: Wed, 26 Dec 2012 00:47:00 -0000	[thread overview]
Message-ID: <201212260135.qBQ1ZOJJ024756@new.toad.com> (raw)
In-Reply-To: <50D8B4C9.9080708@qnx.com>

> I have addressed some of your concerns, and some issues I found while 
> writing the testcase. Please take a look: 
> http://sourceware.org/ml/gdb-patches/2012-12/msg00809.html

Thank you!

There are several places where you assume that there are only
two possible pointer sizes ("if (ptr_size == 4)" and "else").
These should abort -- or return false -- if they encounter a
pointer size they don't understand.  And what is this constant "4"
doing in there?

In read_program_headers_from_target, you initialize load_base_trusted
to 0, then in the first executable statement, you test it and abort if
it's zero.  It took me some detailed reading to discover that in
another initializer, you pass load_base_trusted's address to
lm_addr_check, which modifies it as a side effect.  Could you move that
call to lm_addr_check to just before the if statement, so it's clearly
in a place where people can see that a side effect will occur?

In svr4_validate_ehdr_match, you compare the "magic numbers" by
directly feeding struct pointers to memcmp.  You should compare
the magic number field the same way you compare all the other
fields -- as e.g. ehdr1->_32.e_magic.

I'm still bothered that you read the symbol file's ELF header three
times, once when BFD opens the file, once when you read the ELF header
because you don't use BFD's copy, and once again when you need it to
find the phdrs.  And you're still reading it from location "0" in the
file.  Ditto for accessing the target memory twice, unnecessarily.

I am also wondering why all this infrastructure has been made specific
to shared libraries (it's in the solib ops vector).  The original
request on the mailing list was for this validation to occur for
ordinary symbol-files; this implementation prevents it from ever
being used for that.

	John


  reply	other threads:[~2012-12-26  0:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-21  6:05 Raphael Zulliger
2012-12-21 16:11 ` Jan Kratochvil
2012-12-21 18:17   ` John Gilmore
2013-01-02 17:57     ` Pedro Alves
2013-01-12 10:59       ` Martin Runge
     [not found]       ` <50EA78FB.3040609@indel.ch>
2013-01-14 18:57         ` Pedro Alves
2013-01-29  3:18       ` Raphael Zulliger
2013-01-29  3:51         ` Raphael Zulliger
2013-02-06 18:47           ` Tom Tromey
2012-12-21 21:12   ` Aleksandar Ristovski
2012-12-22  0:38     ` John Gilmore
2012-12-22  2:54       ` Aleksandar Ristovski
2012-12-24 20:02         ` Aleksandar Ristovski
2012-12-26  0:47           ` John Gilmore [this message]
2012-12-27 20:13             ` Aleksandar Ristovski
2013-01-29  3:18     ` Raphael Zulliger

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=201212260135.qBQ1ZOJJ024756@new.toad.com \
    --to=gnu@toad.com \
    --cc=aristovski@qnx.com \
    --cc=gdb@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    --cc=zulliger@indel.ch \
    /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