H.J. Lu | 1 Oct 2010 03:51
Picon

Re: PATCH: gdbserver: Clear regcache if buf is NULL

On Tue, Sep 28, 2010 at 1:23 PM, Pedro Alves <pedro <at> codesourcery.com> wrote:
> On Wednesday 03 February 2010 17:44:14, H.J. Lu wrote:
>> If xstate_bv bits are zero, XSAVE extended state is in init state and
>> gdbserver should treat XMM/YMM registers as 0. This patch clears regcache
>> if buf is NULL. OK to install?
>>
>> Thanks.
>>
>>
>> H.J.
>> ---
>> 2010-02-03  H.J. Lu  <hongjiu.lu <at> intel.com>
>>
>>       * regcache.c (supply_register): Clear regcache if buf is NULL.
>>
>> diff --git a/gdb/gdbserver/regcache.c b/gdb/gdbserver/regcache.c
>> index 2082604..d6cdc46 100644
>> --- a/gdb/gdbserver/regcache.c
>> +++ b/gdb/gdbserver/regcache.c
>>  <at>  <at>  -215,7 +215,10  <at>  <at>  register_data (struct regcache *regcache, int n, int fetch)
>>  void
>>  supply_register (struct regcache *regcache, int n, const void *buf)
>>  {
>> -  memcpy (register_data (regcache, n, 0), buf, register_size (n));
>> +  if (buf)
>> +    memcpy (register_data (regcache, n, 0), buf, register_size (n));
>> +  else
>> +    memset (register_data (regcache, n, 0), 0, register_size (n));
>>  }
>
(Continue reading)

Joel Brobecker | 1 Oct 2010 04:40
Favicon

[PATCH] [sparc] inferior SEGV while calling Ada subprogram

This is one of these issues that makes you wonder how we managed
to miss it after all these years...  But it's probably just because
our users simply never call subprograms that take an array as one
of the parameters - it's just the AdaCore testsuite that does :).

The problem can be reproduced on sparc-solaris using gdb.ada/arrayparam.exp:

   (gdb) print call_me ("bonjour")

   Program received signal SIGSEGV, Segmentation fault.
   0x000190d0 in pck.call_me (str=...) at /[...]/gdb.ada/arrayparam/pck.adb:18
   18         procedure Call_Me (Str : String) is
   The program being debugged was signaled while in a function called from GDB.
   [...]

The SEGV is due to an unaligned access.  This is because Ada arrays
can take several forms, and the one that is used in this case is
a reference to a structure containing 2 pointers: One pointer to
the array of characters, and one pointer to another structure containing
the bounds. We call them `fat pointers'.

During the function call setup, there is some special code for Ada
inside value_arg_coerce that converts a C-type array into Ada arrays:

  /* Perform any Ada-specific coercion first.  */
  if (current_language->la_language == language_ada)
    arg = ada_convert_actual (arg, type, gdbarch, sp);

What this function does is allocating some memory on the stack
in order to store the array contents, the bounds, and the descriptor.
(Continue reading)

Paul Hilfinger | 1 Oct 2010 08:30

[patch] Replace wild_match with faster version and modify its interface.


Barring objection, I will be checking in the following patch from our tree.
Tested on i686 Linux with no regressions.

This new version of wild_match is comparable in speed to strcmp_iw, and has
the same signature and same return value for equal names.

gdb/ChangeLog:
    * ada-lang.c (wild_match): Reimplement.
    Change API to eliminate unused length argument, reverse arguments and
    make 0 the 'true' return value.
    (advance_wild_match): New auxiliary function for wild_match to improve
    readability.
    (ada_match_name, ada_add_block_symbols): Use new API for wild_match.
    * psymtab.c (ada_lookup_partial_symbol, map_ada_symtabs): Use new
    API for wild_match.
    * symfile.h (map_ada_symtabs): Modify declaration to use new API for
    wild_match.
    * dwarf2read.c (dw2_map_ada_symtabs): Ditto.
---
 gdb/ada-lang.c   |   89 +++++++++++++++++++++++++++++++++++++++++------------
 gdb/dwarf2read.c |    2 +-
 gdb/psymtab.c    |    6 ++--
 gdb/symfile.h    |    2 +-
 4 files changed, 74 insertions(+), 25 deletions(-)

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 3eaf649..bb14c39 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
(Continue reading)

Paul Hilfinger | 1 Oct 2010 08:32

[patch] Have ptype handle types declared pragma Unchecked_Variants.


Another patch from our tree I intend to check in soon, barring objection.
Also tested on i686 Linux.

When a type is marked with pragma Unchecked_Variants, ptype did not print
variants having a single component, since the compiler produces incorrect
debugging output for such cases.  With this patch, we special-case these
components so that they print.

Changelog:

    * gdb/ada-typeprint.c (print_selected_record_field_types): New function,
    incorporating and generalizing print_record_field_types.
    (print_record_field_types): Change return value and update comment.
    Re-implement using print_selected_record_field_types.
    (print_choices): Print "=>" here.
    Handle case of unencoded variant branch.
    (print_variant_clauses): Reformat comment.
    Special-case unencoded variant branch.
---
 gdb/ada-typeprint.c |   98 +++++++++++++++++++++++++++++++++------------------
 1 files changed, 64 insertions(+), 34 deletions(-)

diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c
index a02c8d4..6139edd 100644
--- a/gdb/ada-typeprint.c
+++ b/gdb/ada-typeprint.c
 <at>  <at>  -38,13 +38,17  <at>  <at> 
 #include "gdb_string.h"
 #include <errno.h>
(Continue reading)

Mark Kettenis | 1 Oct 2010 11:47
Picon
Picon
Favicon

Re: [PATCH] [sparc] inferior SEGV while calling Ada subprogram

> From: Joel Brobecker <brobecker <at> adacore.com>
> Date: Thu, 30 Sep 2010 19:40:51 -0700
> 
> This is one of these issues that makes you wonder how we managed
> to miss it after all these years...  But it's probably just because
> our users simply never call subprograms that take an array as one
> of the parameters - it's just the AdaCore testsuite that does :).
> 
> The problem can be reproduced on sparc-solaris using gdb.ada/arrayparam.exp:
> 
>    (gdb) print call_me ("bonjour")
>    
>    Program received signal SIGSEGV, Segmentation fault.
>    0x000190d0 in pck.call_me (str=...) at /[...]/gdb.ada/arrayparam/pck.adb:18
>    18         procedure Call_Me (Str : String) is
>    The program being debugged was signaled while in a function called from GDB.
>    [...]
> 
> The SEGV is due to an unaligned access.  This is because Ada arrays
> can take several forms, and the one that is used in this case is
> a reference to a structure containing 2 pointers: One pointer to
> the array of characters, and one pointer to another structure containing
> the bounds. We call them `fat pointers'.
> 
> During the function call setup, there is some special code for Ada
> inside value_arg_coerce that converts a C-type array into Ada arrays:
> 
>   /* Perform any Ada-specific coercion first.  */
>   if (current_language->la_language == language_ada)
>     arg = ada_convert_actual (arg, type, gdbarch, sp);
(Continue reading)

Ken Werner | 1 Oct 2010 15:22
Picon

Re: RFA: shrink main_type

On Thursday, September 30, 2010 7:55:18 pm Joel Brobecker wrote:
> I'm sorry about the delay in getting to this. I hope it's something
> temporary that we all seem to be busier than usual.

Thanks for taking a look at this.

> > One approach to restore that functionality would be to move the
> > nottext flag into to the instance_flags of the type. Attached is an
> > untested patch of what I have in mind. Comments are welcome.

> It took me a while to figure out why this is necessary. Initially,
> I thought that the vector type should have the NOTTEXT bit set,
> but that wouldn't be sufficient for the case where we just print
> one element of the vector (because we'd end up checking type of
> the element and not find the NOTTEXT bit set, and thus print it
> as a character rather than an integer.
>
> Do I understand the situation correctly? If yes, can we add a test
> that checks that, if not already there?

I think you are right because c_textual_element_type queries the type of the 
element to be printed. In case a single element of the vector is printed it is 
the type of the vectors target type. Printing of character vectors is only 
tested indirectly through gdb.arch/altivec-abi.exp. I think it would be good 
to add a few tests to gdb.base/gnu_vector.exp.

> Based on that understanding, then I agree that the NOTTEXT flag
> seems to be more of an instance flag than a type flag.  The code
> in make_vector_type seems to be confirming that.
> 
(Continue reading)

Ken Werner | 1 Oct 2010 17:34
Picon

[patch] move the nottext flag to the instance_flags

On Thursday, September 30, 2010 7:55:18 pm Joel Brobecker wrote:
> If you make a proper submission for this patch, I will officially
> review it.

This patch moves the nottext flag into to the instance_flags of the 
type to handle the printing of character vectors as discussed here:
http://sourceware.org/ml/gdb-patches/2010-10/msg00005.html
The initial patch on how char vectors should be treated can be found at:
http://sourceware.org/ml/gdb-patches/2007-08/msg00467.html

Tested on powerpc64-*-linux-gnu and i686-*-linux-gnu, no regressions.
OK to apply?

Thanks
-ken
Attachment (type_nottext.patch): text/x-patch, 8 KiB
Joel Brobecker | 1 Oct 2010 17:57
Favicon

Re: [PATCH] [sparc] inferior SEGV while calling Ada subprogram

> > gdb/ChangeLog:
> > 
> >         * sparc-tdep.c (sparc32_frame_align): New function.
> >         (sparc32_gdbarch_init): Set the frame_align gdbarch method.
> >         * sparc64-tdep.c (sparc64_frame_align): New function.
> >         (sparc64_gdbarch_init): Set the frame_align gdbarch method.
[...]
> Looks ok to me.  However...

Thanks, checked in :).

> > +/* Implement the frame_align gdbarch method.  */
> > +
> 
> That comment is pretty meaningless.  Can you leave it out?

Sure, I removed the comment from the patch that got checked in.
The reason for putting the comment is the fact that we're trying to
have every function documented.  These ones are already documented
by virtue of being one architecture-specific version of a documented
routine. But adding a comment allows us to avoid the question of
what needs to be documented, and what does not...

Thanks again,
--

-- 
Joel

Joel Brobecker | 1 Oct 2010 18:15
Favicon

Re: [patch] move the nottext flag to the instance_flags

> 2010-10-01  Ken Werner  <ken.werner <at> de.ibm.com>
> 
> 	* gdbtypes.h (struct main_type): Remove flag_nottext.
> 	(enum type_flag_value): Remove TYPE_FLAG_NOTTEXT.
> 	(enum type_instance_flag_value): Add TYPE_INSTANCE_FLAG_NOTTEXT.
> 	(TYPE_NOTTEXT): Use TYPE_INSTANCE_FLAG_NOTTEXT instead of flag_nottext.
> 	* gdbtypes.c (make_vector_type): Use TYPE_INSTANCE_FLAG_NOTTEXT instead
> 	of TYPE_FLAG_NOTTEXT.
> 	(init_type): Remove the initialization of the flag_nottext field.
> 	(gdbtypes_post_init): Use TYPE_INSTANCE_FLAG_NOTTEXT instead of
> 	TYPE_FLAG_NOTTEXT.
> 	* c-valprint.c (c_val_print): Remove TYPE_VECTOR check.
> 
> testsuite/ChangeLog:
> 
> 2010-10-01  Ken Werner  <ken.werner <at> de.ibm.com>
> 
> 	* gdb.base/gnu_vector.c: Add variable c4.
> 	* gdb.base/gnu_vector.exp: Add tests for character vector printing.
> 	* gdb.arch/altivec-abi.exp: Fix expect pattern of character vectors.

Looks good to me. Can you wait, maybe a day or two to give Tom a chance
to comment before you commit, in case he spots something I didn't?

Thanks,
--

-- 
Joel

Joel Brobecker | 1 Oct 2010 18:26
Favicon

[commit/Ada] array and bounds in fat pointer can be a stub

Hello,

This patch adds handling of the case when a fat pointer has the
P_ARRAY and/or P_BOUNDS fields defined as a stub.  In that case,
this stub needs to be resolved.

There are two issues:

  . First, making sure that the resolution takes place itself.
    That's the change to ada_check_typedef.

  . Make sure that the type returned after resolution is not itself
    a typedef.  This is the change to ada_check_typedef.

gdb/ChangeLog (Jerome Guitton, Joel Brobecker):

        * ada-lang.c (desc_bounds): Add handling of the case where
        the P_BOUNDS field is a pointer to a stub.
        (desc_data_target_type): Same for P_ARRAY field.
        (ada_check_typedef): Strip the typedef layers from the type
        found by ada_find_any_type.

Tested on x86_64-linux, and checked in.

---
 gdb/ChangeLog  |    8 ++++++++
 gdb/ada-lang.c |   34 ++++++++++++++++++++++++++++++----
 2 files changed, 38 insertions(+), 4 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
(Continue reading)


Gmane