public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: Doug Evans <xdje42@gmail.com>,
	       "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: time to workaround libc/13097 in fsf gdb?
Date: Fri, 26 Sep 2014 12:05:00 -0000	[thread overview]
Message-ID: <54255687.30207@redhat.com> (raw)
In-Reply-To: <20140922183505.GA21660@host2.jankratochvil.net>

On 09/22/2014 07:35 PM, Jan Kratochvil wrote:

> Yes, it works for me on kernel-2.6.32-220.el6.x86_64 (also verified your
> previous patch still displayed the warning).

Thanks for the testing.

>> --- a/gdb/gdbarch.sh
>> +++ b/gdb/gdbarch.sh
>> @@ -1029,6 +1029,10 @@ m:int:insn_is_jump:CORE_ADDR addr:addr::default_insn_is_jump::0
>>  # Return -1 if there is insufficient buffer for a whole entry.
>>  # Return 1 if an entry was read into *TYPEP and *VALP.
>>  M:int:auxv_parse:gdb_byte **readptr, gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp:readptr, endptr, typep, valp
>> +
>> +# Find the address range of the current inferior's vsyscall/vDSO, and
>> +# write it to *START, *END.  Returns true if found, false otherwise.
> 
> I find unclear the description whether *END is the last byte address or the
> after-the-last byte address.

OK.  Best just use "struct mem_range" instead and avoid this
ambiguity whenever we need a range.  That struct uses "int" for
length.  Although that should be fixed, that can be done
independently.  int is obviously sufficient for the vDSO.

>> +/* Arguments for symbol_file_add_from_memory_wrapper.  */
>> +
>> +struct find_mapping_size_args
>> +{
>> +  CORE_ADDR vaddr;
>> +  size_t size;
> 
> size_t and not CORE_ADDR?  (This patch uses also unsigned long for this value.)

I assume you means ULONGEST or some such.  But, I just moved that
code (and renamed it).  IIRC, it's size_t because that's what the
"bfd from remote memory" interface uses.  This structure disappears in
the next version.  We can work with struct mem_range here too.

>> +
>> +static int
>> +linux_vsyscall_range (struct gdbarch *gdbarch, CORE_ADDR *start, CORE_ADDR *end)
>> +{
>> +  struct find_mapping_size_args args;
>> +
>> +  if (target_auxv_search (&current_target, AT_SYSINFO_EHDR, &args.vaddr) <= 0)
>> +    return 0;
>> +
>> +  /* This is installed by linux_init_abi below, so should always be
>> +     available.  */
>> +  gdb_assert (gdbarch_find_memory_regions_p (target_gdbarch ()));
> 
> Is there a reason for target_gdbarch () and not gdbarch?

No reason.

> 
> 
>> +
>> +  args.size = 0;
>> +  gdbarch_find_memory_regions (target_gdbarch (),
>> +			       find_mapping_size, &args);
>> +
>> +  *start = args.vaddr;
>> +  *end = *start + args.size;
>> +  return 1;
> 
> Here it returns 1 even if the vDSO was not found.
> It will return *start == *end so the current only caller behaves correctly.
> But I do not find it fully compliant to its gdbarch.sh documentation.

Yeah.  The next version will make that clear in the documentation.

>>
>>  static void
>>  add_vsyscall_page (struct target_ops *target, int from_tty)
>>  {
>> -  CORE_ADDR sysinfo_ehdr;
>> +  CORE_ADDR vsyscall_start, vsyscall_end;
>>
>> -  if (target_auxv_search (target, AT_SYSINFO_EHDR, &sysinfo_ehdr) > 0
>> -      && sysinfo_ehdr != (CORE_ADDR) 0)
>> +  if (gdbarch_vsyscall_range (target_gdbarch (),
>> +			      &vsyscall_start, &vsyscall_end))
> 
> This is a code cleanup part of the patch which could be separate.

OK.  The next version splits this out to a preparatory patch.

Thanks.  I'll be posting the new series in a bit.

Pedro Alves

  parent reply	other threads:[~2014-09-26 12:05 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-11 16:25 Doug Evans
2014-09-11 16:37 ` Pedro Alves
2014-09-12 11:55   ` Jan Kratochvil
2014-09-12 12:14     ` Pedro Alves
2014-09-12 12:33       ` Jan Kratochvil
2014-09-12 12:46         ` Pedro Alves
2014-09-17 20:10           ` Jan Kratochvil
2014-09-19 14:38             ` Pedro Alves
2014-09-19 14:41               ` Pedro Alves
2014-09-20 21:30                 ` Jan Kratochvil
2014-09-21 19:12                   ` Pedro Alves
2014-09-21 19:46                     ` Pedro Alves
2014-09-23 23:05                       ` Doug Evans
2014-09-26 12:09                         ` Pedro Alves
2014-09-22 18:35                     ` Jan Kratochvil
2014-09-23 11:49                       ` Pedro Alves
2014-09-28 13:41                         ` Jan Kratochvil
2014-09-29 10:36                           ` Pedro Alves
2014-10-03 13:09                             ` Gary Benson
2014-10-07 23:16                             ` Doug Evans
2014-09-23 12:05                       ` Pedro Alves
2014-09-26 12:05                       ` Pedro Alves [this message]
2014-09-23 10:59                     ` automated testing comment [Re: time to workaround libc/13097 in fsf gdb?] Jan Kratochvil
2014-09-23 12:32                       ` Pedro Alves
2014-09-23 12:45                         ` Jan Kratochvil
2014-09-23 13:30                           ` Pedro Alves
2014-09-23 13:57                             ` Jan Kratochvil
2014-09-23 14:48                               ` Pedro Alves
2014-09-23 15:53                                 ` Jan Kratochvil
2014-09-23 15:56                                   ` Pedro Alves
2014-09-24 13:22                                 ` Andreas Arnez
2014-09-24 15:23                                   ` Ulrich Weigand
2014-09-25  7:11                                     ` Andreas Arnez
2014-09-25  8:20                                     ` Pedro Alves
2014-09-25 10:52                                       ` Jan Kratochvil
2014-09-23 14:54                           ` Doug Evans
2014-09-23 15:16                         ` Simon Marchi
2014-09-23 14:48                       ` Doug Evans
2014-09-23 14:59                         ` Pedro Alves
2014-09-20 19:50               ` time to workaround libc/13097 in fsf gdb? Jan Kratochvil
2014-09-23 11:18                 ` Pedro Alves
2014-09-23 13:16                   ` Gary Benson
2014-10-09 20:09                   ` Jan Kratochvil
2014-10-09 22:07                     ` Pedro Alves
2014-09-13  1:06       ` Doug Evans
2014-09-17 20:13         ` Jan Kratochvil
2014-09-23 21:35         ` Doug Evans

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=54255687.30207@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    --cc=xdje42@gmail.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).