- Remove obsolete patches:
gdb-aarch64-v81-hwbreakpoints.diff gdb-bare-DW_TAG_lexical_block-1of2.patch gdb-bare-DW_TAG_lexical_block-2of2.patch gdb-fortran-stride-intel-1of6.patch gdb-fortran-stride-intel-2of6.patch gdb-fortran-stride-intel-3of6.patch gdb-fortran-stride-intel-4of6.patch gdb-fortran-stride-intel-5of6.patch gdb-fortran-stride-intel-6of6-nokfail.patch gdb-fortran-stride-intel-6of6.patch gdb-testsuite-dw2-undefined-ret-addr.patch gdb-vla-intel-04of23-fix.patch gdb-vla-intel-logical-not.patch gdb-vla-intel.patch gdb-6.7-testsuite-stable-results.patch gdb-add-index-chmod.patch gdb-bison-old.patch gdb-container-rh-pkg.patch gdb-libexec-add-index.patch gdb-linux_perf-bundle.patch gdb-physname-pr11734-test.patch gdb-physname-pr12273-test.patch gdb-rhbz1007614-memleak-infpy_read_memory-test.patch gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch gdb-rhbz1149205-catch-syscall-after-fork-test.patch gdb-rhbz1156192-recursive-dlopen-test.patch gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch gdb-rhbz1350436-type-printers-error.patch gdb-test-ivy-bridge.patch OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=152
This commit is contained in:
parent
a2f8e1d8c6
commit
b7a691f683
@ -1,235 +0,0 @@
|
||||
From 3a2b436ae9958a1029545c03201b7223ff33c150 Mon Sep 17 00:00:00 2001
|
||||
From: Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Date: Mon, 30 May 2016 14:11:43 +0200
|
||||
Subject: [PATCH 1/2] Code cleanup: dwarf2_get_pc_bounds: -1/0/+1 -> enum
|
||||
|
||||
Make the code (maybe) more readable + primarily prepare it for [patch 2/2]
|
||||
enum extension.
|
||||
|
||||
This change should have no code change impact.
|
||||
|
||||
gdb/ChangeLog
|
||||
2016-05-30 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
Code cleanup: dwarf2_get_pc_bounds: -1/0/+1 -> enum
|
||||
* dwarf2read.c (enum pc_bounds_kind) New.
|
||||
(dwarf2_get_pc_bounds): Use it in the declaration.
|
||||
(process_psymtab_comp_unit_reader): Adjust caller. Rename has_pc_info
|
||||
to cu_bounds_kind.
|
||||
(read_func_scope, read_lexical_block_scope, read_call_site_scope):
|
||||
Adjust callers.
|
||||
(dwarf2_get_pc_bounds): Use enum pc_bounds_kind in the definition.
|
||||
(dwarf2_get_subprogram_pc_bounds, get_scope_pc_bounds): Adjust callers.
|
||||
---
|
||||
gdb/ChangeLog | 12 ++++++++++
|
||||
gdb/dwarf2read.c | 71 ++++++++++++++++++++++++++++++++++++--------------------
|
||||
2 files changed, 58 insertions(+), 25 deletions(-)
|
||||
|
||||
### a/gdb/ChangeLog
|
||||
### b/gdb/ChangeLog
|
||||
## -1,3 +1,15 @@
|
||||
+2016-05-30 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
+
|
||||
+ Code cleanup: dwarf2_get_pc_bounds: -1/0/+1 -> enum
|
||||
+ * dwarf2read.c (enum pc_bounds_kind) New.
|
||||
+ (dwarf2_get_pc_bounds): Use it in the declaration.
|
||||
+ (process_psymtab_comp_unit_reader): Adjust caller. Rename has_pc_info
|
||||
+ to cu_bounds_kind.
|
||||
+ (read_func_scope, read_lexical_block_scope, read_call_site_scope):
|
||||
+ Adjust callers.
|
||||
+ (dwarf2_get_pc_bounds): Use enum pc_bounds_kind in the definition.
|
||||
+ (dwarf2_get_subprogram_pc_bounds, get_scope_pc_bounds): Adjust callers.
|
||||
+
|
||||
2016-05-29 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* NEWS (QCatchSyscalls): Remove the parameter. Include ...
|
||||
--- a/gdb/dwarf2read.c
|
||||
+++ b/gdb/dwarf2read.c
|
||||
@@ -1606,9 +1606,25 @@ static void read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu);
|
||||
static int dwarf2_ranges_read (unsigned, CORE_ADDR *, CORE_ADDR *,
|
||||
struct dwarf2_cu *, struct partial_symtab *);
|
||||
|
||||
-static int dwarf2_get_pc_bounds (struct die_info *,
|
||||
- CORE_ADDR *, CORE_ADDR *, struct dwarf2_cu *,
|
||||
- struct partial_symtab *);
|
||||
+/* How dwarf2_get_pc_bounds constructed its *LOWPC and *HIGHPC return
|
||||
+ values. */
|
||||
+enum pc_bounds_kind
|
||||
+{
|
||||
+ /* No valid combination of DW_AT_low_pc, DW_AT_high_pc or DW_AT_ranges
|
||||
+ was found. */
|
||||
+ PC_BOUNDS_NOT_PRESENT,
|
||||
+
|
||||
+ /* Discontiguous range was found - that is DW_AT_ranges was found. */
|
||||
+ PC_BOUNDS_RANGES,
|
||||
+
|
||||
+ /* Contiguous range was found - DW_AT_low_pc and DW_AT_high_pc were found. */
|
||||
+ PC_BOUNDS_HIGH_LOW,
|
||||
+};
|
||||
+
|
||||
+static enum pc_bounds_kind dwarf2_get_pc_bounds (struct die_info *,
|
||||
+ CORE_ADDR *, CORE_ADDR *,
|
||||
+ struct dwarf2_cu *,
|
||||
+ struct partial_symtab *);
|
||||
|
||||
static void get_scope_pc_bounds (struct die_info *,
|
||||
CORE_ADDR *, CORE_ADDR *,
|
||||
@@ -5947,7 +5963,7 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
|
||||
CORE_ADDR baseaddr;
|
||||
CORE_ADDR best_lowpc = 0, best_highpc = 0;
|
||||
struct partial_symtab *pst;
|
||||
- int has_pc_info;
|
||||
+ enum pc_bounds_kind cu_bounds_kind;
|
||||
const char *filename;
|
||||
struct process_psymtab_comp_unit_data *info
|
||||
= (struct process_psymtab_comp_unit_data *) data;
|
||||
@@ -5977,9 +5993,9 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
|
||||
|
||||
/* Possibly set the default values of LOWPC and HIGHPC from
|
||||
`DW_AT_ranges'. */
|
||||
- has_pc_info = dwarf2_get_pc_bounds (comp_unit_die, &best_lowpc,
|
||||
- &best_highpc, cu, pst);
|
||||
- if (has_pc_info == 1 && best_lowpc < best_highpc)
|
||||
+ cu_bounds_kind = dwarf2_get_pc_bounds (comp_unit_die, &best_lowpc,
|
||||
+ &best_highpc, cu, pst);
|
||||
+ if (cu_bounds_kind == PC_BOUNDS_HIGH_LOW && best_lowpc < best_highpc)
|
||||
/* Store the contiguous range if it is not empty; it can be empty for
|
||||
CUs with no code. */
|
||||
addrmap_set_empty (objfile->psymtabs_addrmap,
|
||||
@@ -6003,7 +6019,7 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
|
||||
first_die = load_partial_dies (reader, info_ptr, 1);
|
||||
|
||||
scan_partial_symbols (first_die, &lowpc, &highpc,
|
||||
- ! has_pc_info, cu);
|
||||
+ cu_bounds_kind == PC_BOUNDS_NOT_PRESENT, cu);
|
||||
|
||||
/* If we didn't find a lowpc, set it to highpc to avoid
|
||||
complaints from `maint check'. */
|
||||
@@ -6012,7 +6028,7 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
|
||||
|
||||
/* If the compilation unit didn't have an explicit address range,
|
||||
then use the information extracted from its child dies. */
|
||||
- if (! has_pc_info)
|
||||
+ if (cu_bounds_kind == PC_BOUNDS_NOT_PRESENT)
|
||||
{
|
||||
best_lowpc = lowpc;
|
||||
best_highpc = highpc;
|
||||
@@ -11373,7 +11389,8 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
|
||||
}
|
||||
|
||||
/* Ignore functions with missing or invalid low and high pc attributes. */
|
||||
- if (!dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL))
|
||||
+ if (dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL)
|
||||
+ == PC_BOUNDS_NOT_PRESENT)
|
||||
{
|
||||
attr = dwarf2_attr (die, DW_AT_external, cu);
|
||||
if (!attr || !DW_UNSND (attr))
|
||||
@@ -11535,7 +11552,8 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
|
||||
as multiple lexical blocks? Handling children in a sane way would
|
||||
be nasty. Might be easier to properly extend generic blocks to
|
||||
describe ranges. */
|
||||
- if (!dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL))
|
||||
+ if (dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL)
|
||||
+ == PC_BOUNDS_NOT_PRESENT)
|
||||
return;
|
||||
lowpc = gdbarch_adjust_dwarf2_addr (gdbarch, lowpc + baseaddr);
|
||||
highpc = gdbarch_adjust_dwarf2_addr (gdbarch, highpc + baseaddr);
|
||||
@@ -11745,7 +11763,8 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
|
||||
CORE_ADDR lowpc;
|
||||
|
||||
/* DW_AT_entry_pc should be preferred. */
|
||||
- if (!dwarf2_get_pc_bounds (target_die, &lowpc, NULL, target_cu, NULL))
|
||||
+ if (dwarf2_get_pc_bounds (target_die, &lowpc, NULL, target_cu, NULL)
|
||||
+ == PC_BOUNDS_NOT_PRESENT)
|
||||
complaint (&symfile_complaints,
|
||||
_("DW_AT_GNU_call_site_target target DIE has invalid "
|
||||
"low pc, for referencing DIE 0x%x [in module %s]"),
|
||||
@@ -12020,11 +12039,11 @@ dwarf2_ranges_read (unsigned offset, CORE_ADDR *low_return,
|
||||
return 1;
|
||||
}
|
||||
|
||||
-/* Get low and high pc attributes from a die. Return 1 if the attributes
|
||||
- are present and valid, otherwise, return 0. Return -1 if the range is
|
||||
- discontinuous, i.e. derived from DW_AT_ranges information. */
|
||||
+/* Get low and high pc attributes from a die. See enum pc_bounds_kind
|
||||
+ definition for the return value. *LOWPC and *HIGHPC are set iff
|
||||
+ PC_BOUNDS_NOT_PRESENT is not returned. */
|
||||
|
||||
-static int
|
||||
+static enum pc_bounds_kind
|
||||
dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
|
||||
CORE_ADDR *highpc, struct dwarf2_cu *cu,
|
||||
struct partial_symtab *pst)
|
||||
@@ -12033,7 +12052,7 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
|
||||
struct attribute *attr_high;
|
||||
CORE_ADDR low = 0;
|
||||
CORE_ADDR high = 0;
|
||||
- int ret = 0;
|
||||
+ enum pc_bounds_kind ret = PC_BOUNDS_NOT_PRESENT;
|
||||
|
||||
attr_high = dwarf2_attr (die, DW_AT_high_pc, cu);
|
||||
if (attr_high)
|
||||
@@ -12048,10 +12067,10 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
|
||||
}
|
||||
else
|
||||
/* Found high w/o low attribute. */
|
||||
- return 0;
|
||||
+ return PC_BOUNDS_NOT_PRESENT;
|
||||
|
||||
/* Found consecutive range of addresses. */
|
||||
- ret = 1;
|
||||
+ ret = PC_BOUNDS_HIGH_LOW;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -12070,15 +12089,15 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
|
||||
/* Value of the DW_AT_ranges attribute is the offset in the
|
||||
.debug_ranges section. */
|
||||
if (!dwarf2_ranges_read (ranges_offset, &low, &high, cu, pst))
|
||||
- return 0;
|
||||
+ return PC_BOUNDS_NOT_PRESENT;
|
||||
/* Found discontinuous range of addresses. */
|
||||
- ret = -1;
|
||||
+ ret = PC_BOUNDS_RANGES;
|
||||
}
|
||||
}
|
||||
|
||||
/* read_partial_die has also the strict LOW < HIGH requirement. */
|
||||
if (high <= low)
|
||||
- return 0;
|
||||
+ return PC_BOUNDS_NOT_PRESENT;
|
||||
|
||||
/* When using the GNU linker, .gnu.linkonce. sections are used to
|
||||
eliminate duplicate copies of functions and vtables and such.
|
||||
@@ -12089,7 +12108,7 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
|
||||
If this is a discarded function, mark the pc bounds as invalid,
|
||||
so that GDB will ignore it. */
|
||||
if (low == 0 && !dwarf2_per_objfile->has_section_at_zero)
|
||||
- return 0;
|
||||
+ return PC_BOUNDS_NOT_PRESENT;
|
||||
|
||||
*lowpc = low;
|
||||
if (highpc)
|
||||
@@ -12110,7 +12129,8 @@ dwarf2_get_subprogram_pc_bounds (struct die_info *die,
|
||||
CORE_ADDR low, high;
|
||||
struct die_info *child = die->child;
|
||||
|
||||
- if (dwarf2_get_pc_bounds (die, &low, &high, cu, NULL))
|
||||
+ if (dwarf2_get_pc_bounds (die, &low, &high, cu, NULL)
|
||||
+ != PC_BOUNDS_NOT_PRESENT)
|
||||
{
|
||||
*lowpc = min (*lowpc, low);
|
||||
*highpc = max (*highpc, high);
|
||||
@@ -12147,7 +12167,8 @@ get_scope_pc_bounds (struct die_info *die,
|
||||
CORE_ADDR best_high = (CORE_ADDR) 0;
|
||||
CORE_ADDR current_low, current_high;
|
||||
|
||||
- if (dwarf2_get_pc_bounds (die, ¤t_low, ¤t_high, cu, NULL))
|
||||
+ if (dwarf2_get_pc_bounds (die, ¤t_low, ¤t_high, cu, NULL)
|
||||
+ != PC_BOUNDS_NOT_PRESENT)
|
||||
{
|
||||
best_low = current_low;
|
||||
best_high = current_high;
|
||||
--
|
||||
2.5.5
|
||||
|
@ -1,343 +0,0 @@
|
||||
From e385593eef98ac92be57159e141f4b805dadbbb3 Mon Sep 17 00:00:00 2001
|
||||
From: Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Date: Mon, 30 May 2016 14:14:43 +0200
|
||||
Subject: [PATCH 2/2] PR 15231: import bare DW_TAG_lexical_block
|
||||
|
||||
Local variables in lambdas are not accessible
|
||||
https://sourceware.org/bugzilla/show_bug.cgi?id=15231
|
||||
|
||||
GDB: read_lexical_block_scope
|
||||
/* Ignore blocks with missing or invalid low and high pc attributes. */
|
||||
[...]
|
||||
if (!dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL))
|
||||
return;
|
||||
|
||||
But sometimes there is:
|
||||
|
||||
FAIL: gcc-5.3.1-6.fc23.x86_64
|
||||
<2><92>: Abbrev Number: 11 (DW_TAG_lexical_block)
|
||||
<3><9c>: Abbrev Number: 13 (DW_TAG_structure_type)
|
||||
<9d> DW_AT_name : (indirect string, offset: 0x3c): <lambda()>
|
||||
[...]
|
||||
|
||||
Where DW_TAG_lexical_block has no attributes. Such whole subtree is currently
|
||||
dropped by GDB while I think it should just import all its children DIEs.
|
||||
|
||||
It even XFAIL->XPASSes gdb.ada/out_of_line_in_inlined.exp:
|
||||
commit 0fa7fe506c242b459c4c05d331e7c7d66fb52390
|
||||
Author: Joel Brobecker <brobecker@adacore.com>
|
||||
out of line functions nested inside inline functions.
|
||||
So I have removed that xfail.
|
||||
|
||||
gdb/ChangeLog
|
||||
2016-05-30 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
PR c++/15231
|
||||
* dwarf2read.c (enum pc_bounds_kind): Add PC_BOUNDS_INVALID.
|
||||
(process_psymtab_comp_unit_reader, read_func_scope): Adjust callers.
|
||||
(read_lexical_block_scope): Import DIEs from bare DW_TAG_lexical_block.
|
||||
(read_call_site_scope): Adjust callers.
|
||||
(dwarf2_get_pc_bounds): Implement pc_bounds_invalid.
|
||||
(dwarf2_get_subprogram_pc_bounds, get_scope_pc_bounds): Adjust callers.
|
||||
|
||||
gdb/testsuite/ChangeLog
|
||||
2016-05-30 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
PR c++/15231
|
||||
* gdb.ada/out_of_line_in_inlined.exp: Remove xfails.
|
||||
* gdb.dwarf2/dw2-lexical-block-bare.exp: New file.
|
||||
---
|
||||
gdb/ChangeLog | 10 ++++
|
||||
gdb/dwarf2read.c | 53 ++++++++++------
|
||||
gdb/testsuite/ChangeLog | 6 ++
|
||||
gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp | 6 --
|
||||
.../gdb.dwarf2/dw2-lexical-block-bare.exp | 70 ++++++++++++++++++++++
|
||||
5 files changed, 120 insertions(+), 25 deletions(-)
|
||||
create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-lexical-block-bare.exp
|
||||
|
||||
### a/gdb/ChangeLog
|
||||
### b/gdb/ChangeLog
|
||||
## -1,5 +1,15 @@
|
||||
2016-05-30 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
+ PR c++/15231
|
||||
+ * dwarf2read.c (enum pc_bounds_kind): Add PC_BOUNDS_INVALID.
|
||||
+ (process_psymtab_comp_unit_reader, read_func_scope): Adjust callers.
|
||||
+ (read_lexical_block_scope): Import DIEs from bare DW_TAG_lexical_block.
|
||||
+ (read_call_site_scope): Adjust callers.
|
||||
+ (dwarf2_get_pc_bounds): Implement pc_bounds_invalid.
|
||||
+ (dwarf2_get_subprogram_pc_bounds, get_scope_pc_bounds): Adjust callers.
|
||||
+
|
||||
+2016-05-30 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
+
|
||||
Code cleanup: dwarf2_get_pc_bounds: -1/0/+1 -> enum
|
||||
* dwarf2read.c (enum pc_bounds_kind) New.
|
||||
(dwarf2_get_pc_bounds): Use it in the declaration.
|
||||
--- a/gdb/dwarf2read.c
|
||||
+++ b/gdb/dwarf2read.c
|
||||
@@ -1607,13 +1607,16 @@ static int dwarf2_ranges_read (unsigned, CORE_ADDR *, CORE_ADDR *,
|
||||
struct dwarf2_cu *, struct partial_symtab *);
|
||||
|
||||
/* How dwarf2_get_pc_bounds constructed its *LOWPC and *HIGHPC return
|
||||
- values. */
|
||||
+ values. Keep the items ordered with increasing constraints compliance. */
|
||||
enum pc_bounds_kind
|
||||
{
|
||||
- /* No valid combination of DW_AT_low_pc, DW_AT_high_pc or DW_AT_ranges
|
||||
- was found. */
|
||||
+ /* No attribute DW_AT_low_pc, DW_AT_high_pc or DW_AT_ranges was found. */
|
||||
PC_BOUNDS_NOT_PRESENT,
|
||||
|
||||
+ /* Some of the attributes DW_AT_low_pc, DW_AT_high_pc or DW_AT_ranges
|
||||
+ were present but they do not form a valid range of PC addresses. */
|
||||
+ PC_BOUNDS_INVALID,
|
||||
+
|
||||
/* Discontiguous range was found - that is DW_AT_ranges was found. */
|
||||
PC_BOUNDS_RANGES,
|
||||
|
||||
@@ -6019,7 +6022,7 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
|
||||
first_die = load_partial_dies (reader, info_ptr, 1);
|
||||
|
||||
scan_partial_symbols (first_die, &lowpc, &highpc,
|
||||
- cu_bounds_kind == PC_BOUNDS_NOT_PRESENT, cu);
|
||||
+ cu_bounds_kind <= PC_BOUNDS_INVALID, cu);
|
||||
|
||||
/* If we didn't find a lowpc, set it to highpc to avoid
|
||||
complaints from `maint check'. */
|
||||
@@ -6028,7 +6031,7 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
|
||||
|
||||
/* If the compilation unit didn't have an explicit address range,
|
||||
then use the information extracted from its child dies. */
|
||||
- if (cu_bounds_kind == PC_BOUNDS_NOT_PRESENT)
|
||||
+ if (cu_bounds_kind <= PC_BOUNDS_INVALID)
|
||||
{
|
||||
best_lowpc = lowpc;
|
||||
best_highpc = highpc;
|
||||
@@ -11390,7 +11393,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
|
||||
|
||||
/* Ignore functions with missing or invalid low and high pc attributes. */
|
||||
if (dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL)
|
||||
- == PC_BOUNDS_NOT_PRESENT)
|
||||
+ <= PC_BOUNDS_INVALID)
|
||||
{
|
||||
attr = dwarf2_attr (die, DW_AT_external, cu);
|
||||
if (!attr || !DW_UNSND (attr))
|
||||
@@ -11552,9 +11555,20 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
|
||||
as multiple lexical blocks? Handling children in a sane way would
|
||||
be nasty. Might be easier to properly extend generic blocks to
|
||||
describe ranges. */
|
||||
- if (dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL)
|
||||
- == PC_BOUNDS_NOT_PRESENT)
|
||||
- return;
|
||||
+ switch (dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL))
|
||||
+ {
|
||||
+ case PC_BOUNDS_NOT_PRESENT:
|
||||
+ /* DW_TAG_lexical_block has no attributes, process its children as if
|
||||
+ there was no wrapping by that DW_TAG_lexical_block.
|
||||
+ GCC does no longer produces such DWARF since GCC r224161. */
|
||||
+ for (child_die = die->child;
|
||||
+ child_die != NULL && child_die->tag;
|
||||
+ child_die = sibling_die (child_die))
|
||||
+ process_die (child_die, cu);
|
||||
+ return;
|
||||
+ case PC_BOUNDS_INVALID:
|
||||
+ return;
|
||||
+ }
|
||||
lowpc = gdbarch_adjust_dwarf2_addr (gdbarch, lowpc + baseaddr);
|
||||
highpc = gdbarch_adjust_dwarf2_addr (gdbarch, highpc + baseaddr);
|
||||
|
||||
@@ -11764,7 +11778,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
|
||||
|
||||
/* DW_AT_entry_pc should be preferred. */
|
||||
if (dwarf2_get_pc_bounds (target_die, &lowpc, NULL, target_cu, NULL)
|
||||
- == PC_BOUNDS_NOT_PRESENT)
|
||||
+ <= PC_BOUNDS_INVALID)
|
||||
complaint (&symfile_complaints,
|
||||
_("DW_AT_GNU_call_site_target target DIE has invalid "
|
||||
"low pc, for referencing DIE 0x%x [in module %s]"),
|
||||
@@ -12041,7 +12055,7 @@ dwarf2_ranges_read (unsigned offset, CORE_ADDR *low_return,
|
||||
|
||||
/* Get low and high pc attributes from a die. See enum pc_bounds_kind
|
||||
definition for the return value. *LOWPC and *HIGHPC are set iff
|
||||
- PC_BOUNDS_NOT_PRESENT is not returned. */
|
||||
+ neither PC_BOUNDS_NOT_PRESENT nor PC_BOUNDS_INVALID are returned. */
|
||||
|
||||
static enum pc_bounds_kind
|
||||
dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
|
||||
@@ -12052,7 +12066,7 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
|
||||
struct attribute *attr_high;
|
||||
CORE_ADDR low = 0;
|
||||
CORE_ADDR high = 0;
|
||||
- enum pc_bounds_kind ret = PC_BOUNDS_NOT_PRESENT;
|
||||
+ enum pc_bounds_kind ret;
|
||||
|
||||
attr_high = dwarf2_attr (die, DW_AT_high_pc, cu);
|
||||
if (attr_high)
|
||||
@@ -12067,7 +12081,7 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
|
||||
}
|
||||
else
|
||||
/* Found high w/o low attribute. */
|
||||
- return PC_BOUNDS_NOT_PRESENT;
|
||||
+ return PC_BOUNDS_INVALID;
|
||||
|
||||
/* Found consecutive range of addresses. */
|
||||
ret = PC_BOUNDS_HIGH_LOW;
|
||||
@@ -12089,15 +12103,17 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
|
||||
/* Value of the DW_AT_ranges attribute is the offset in the
|
||||
.debug_ranges section. */
|
||||
if (!dwarf2_ranges_read (ranges_offset, &low, &high, cu, pst))
|
||||
- return PC_BOUNDS_NOT_PRESENT;
|
||||
+ return PC_BOUNDS_INVALID;
|
||||
/* Found discontinuous range of addresses. */
|
||||
ret = PC_BOUNDS_RANGES;
|
||||
}
|
||||
+ else
|
||||
+ return PC_BOUNDS_NOT_PRESENT;
|
||||
}
|
||||
|
||||
/* read_partial_die has also the strict LOW < HIGH requirement. */
|
||||
if (high <= low)
|
||||
- return PC_BOUNDS_NOT_PRESENT;
|
||||
+ return PC_BOUNDS_INVALID;
|
||||
|
||||
/* When using the GNU linker, .gnu.linkonce. sections are used to
|
||||
eliminate duplicate copies of functions and vtables and such.
|
||||
@@ -12108,7 +12124,7 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
|
||||
If this is a discarded function, mark the pc bounds as invalid,
|
||||
so that GDB will ignore it. */
|
||||
if (low == 0 && !dwarf2_per_objfile->has_section_at_zero)
|
||||
- return PC_BOUNDS_NOT_PRESENT;
|
||||
+ return PC_BOUNDS_INVALID;
|
||||
|
||||
*lowpc = low;
|
||||
if (highpc)
|
||||
@@ -12129,8 +12145,7 @@ dwarf2_get_subprogram_pc_bounds (struct die_info *die,
|
||||
CORE_ADDR low, high;
|
||||
struct die_info *child = die->child;
|
||||
|
||||
- if (dwarf2_get_pc_bounds (die, &low, &high, cu, NULL)
|
||||
- != PC_BOUNDS_NOT_PRESENT)
|
||||
+ if (dwarf2_get_pc_bounds (die, &low, &high, cu, NULL) >= PC_BOUNDS_RANGES)
|
||||
{
|
||||
*lowpc = min (*lowpc, low);
|
||||
*highpc = max (*highpc, high);
|
||||
@@ -12168,7 +12183,7 @@ get_scope_pc_bounds (struct die_info *die,
|
||||
CORE_ADDR current_low, current_high;
|
||||
|
||||
if (dwarf2_get_pc_bounds (die, ¤t_low, ¤t_high, cu, NULL)
|
||||
- != PC_BOUNDS_NOT_PRESENT)
|
||||
+ >= PC_BOUNDS_RANGES)
|
||||
{
|
||||
best_low = current_low;
|
||||
best_high = current_high;
|
||||
### a/gdb/testsuite/ChangeLog
|
||||
### b/gdb/testsuite/ChangeLog
|
||||
## -1,3 +1,9 @@
|
||||
+2016-05-30 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
+
|
||||
+ PR c++/15231
|
||||
+ * gdb.ada/out_of_line_in_inlined.exp: Remove xfails.
|
||||
+ * gdb.dwarf2/dw2-lexical-block-bare.exp: New file.
|
||||
+
|
||||
2016-05-27 Pedro Alves <palves@redhat.com>
|
||||
|
||||
* gdb.threads/attach-many-short-lived-threads.exp (bad_dejagnu):
|
||||
--- a/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
|
||||
+++ b/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
|
||||
@@ -23,20 +23,14 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug optimize=-O2}]
|
||||
|
||||
clean_restart ${testfile}
|
||||
|
||||
-# GCC currently is missing a DW_AT_origin attribute in one of the
|
||||
-# lexical blocks, preventing GDB from creating a symbol for the
|
||||
-# subprogram we want to break on.
|
||||
-setup_xfail "*-*-*"
|
||||
gdb_test "break foo_o224_021.child1.child2" \
|
||||
"Breakpoint \[0-9\]+ at.*: file .*foo_o224_021.adb, line \[0-9\]+."
|
||||
|
||||
gdb_run_cmd
|
||||
-setup_xfail "*-*-*"
|
||||
gdb_test "" \
|
||||
"Breakpoint $decimal, foo_o224_021\\.child1\\.child2 \\(s=\\.\\.\\.\\).*"
|
||||
|
||||
set opt_addr_in "($hex in)?"
|
||||
-setup_xfail "*-*-*"
|
||||
gdb_test "bt" \
|
||||
[multi_line "#0 +$opt_addr_in +foo_o224_021\\.child1\\.child2 \\(s=\\.\\.\\.\\).*" \
|
||||
"#1 +$opt_addr_in +foo_o224_021\\.child1 \\(\\).*" \
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/dw2-lexical-block-bare.exp
|
||||
@@ -0,0 +1,70 @@
|
||||
+# Copyright 2016 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+load_lib dwarf.exp
|
||||
+
|
||||
+# This test can only be run on targets which support DWARF-2 and use gas.
|
||||
+if {![dwarf2_support]} {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+standard_testfile .S main.c
|
||||
+
|
||||
+# Make some DWARF for the test.
|
||||
+set asm_file [standard_output_file $srcfile]
|
||||
+Dwarf::assemble $asm_file {
|
||||
+ cu {} {
|
||||
+ compile_unit {
|
||||
+ {low_pc [gdb_target_symbol main] DW_FORM_addr}
|
||||
+ {high_pc [gdb_target_symbol main]+0x10000 DW_FORM_addr}
|
||||
+ } {
|
||||
+ declare_labels integer_label
|
||||
+
|
||||
+ integer_label: DW_TAG_base_type {
|
||||
+ {DW_AT_byte_size 4 DW_FORM_sdata}
|
||||
+ {DW_AT_encoding @DW_ATE_signed}
|
||||
+ {DW_AT_name integer}
|
||||
+ }
|
||||
+
|
||||
+ DW_TAG_subprogram {
|
||||
+ {name main}
|
||||
+ {DW_AT_external 1 flag}
|
||||
+ {low_pc [gdb_target_symbol main] DW_FORM_addr}
|
||||
+ {high_pc [gdb_target_symbol main]+0x10000 DW_FORM_addr}
|
||||
+ } {
|
||||
+ DW_TAG_lexical_block {
|
||||
+ } {
|
||||
+ DW_TAG_variable {
|
||||
+ {DW_AT_name testvar}
|
||||
+ {DW_AT_type :$integer_label}
|
||||
+ {DW_AT_external 1 flag}
|
||||
+ {DW_AT_location {
|
||||
+ DW_OP_addr [gdb_target_symbol main]
|
||||
+ } SPECIAL_expr}
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+if { [prepare_for_testing ${testfile}.exp ${testfile} \
|
||||
+ [list $srcfile2 $asm_file] {nodebug}] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+runto_main
|
||||
+
|
||||
+# FAILing GDB did print: No symbol "testvar" in current context.
|
||||
+gdb_test "p testvar" { = -?[0-9]+}
|
||||
--
|
||||
2.5.5
|
||||
|
@ -1,611 +0,0 @@
|
||||
http://sourceware.org/ml/gdb-patches/2016-02/msg00843.html
|
||||
Subject: [PATCH v2 1/6] fortran: allow multi-dimensional subarrays
|
||||
|
||||
From: Christoph Weinmann <christoph.t.weinmann@intel.com>
|
||||
|
||||
Add an argument count for subrange expressions in Fortran.
|
||||
Based on the counted value calculate a new array with the
|
||||
elements specified by the user. First parse the user input,
|
||||
secondly copy the desired array values into the return
|
||||
array, thirdly re-create the necessary ranges and bounds.
|
||||
|
||||
1| program prog
|
||||
2| integer :: ary(10,5) = (/ (i,i=1,10) (j, j=1,5) /)
|
||||
3| end program prog
|
||||
|
||||
(gdb) print ary(2:4,1:3)
|
||||
old> Syntax error in expression near ':3'
|
||||
new> $3 = ( ( 21, 31, 41) ( 22, 32, 42) ( 23, 33, 43) )
|
||||
|
||||
2013-11-25 Christoph Weinmann <christoph.t.weinmann@intel.com>
|
||||
|
||||
* eval.c (multi_f77_subscript): Remove function.
|
||||
* eval.c (evaluate_subrange_expr): When evaluating
|
||||
an array or string expression, call
|
||||
value_f90_subarray.
|
||||
* eval.c (value_f90_subarray): Add argument parsing
|
||||
and compute result array based on user input.
|
||||
* f-exp.y: Increment argument counter for every subrange
|
||||
expression entered by the user.
|
||||
* valops.c (value_slice): Call value_slice_1 with
|
||||
additional default argument.
|
||||
* valops.c (value_slice_1): Add functionality to
|
||||
copy and return result values based on input.
|
||||
* value.h: Add function definition.
|
||||
|
||||
|
||||
Signed-off-by: Christoph Weinmann <christoph.t.weinmann@intel.com>
|
||||
---
|
||||
gdb/eval.c | 309 ++++++++++++++++++++++++++++++++++++++++++++++-------------
|
||||
gdb/f-exp.y | 2 +
|
||||
gdb/valops.c | 157 ++++++++++++++++++++++++------
|
||||
gdb/value.h | 2 +
|
||||
4 files changed, 375 insertions(+), 95 deletions(-)
|
||||
|
||||
diff --git a/gdb/eval.c b/gdb/eval.c
|
||||
index 78ad946..c9f325f 100644
|
||||
--- a/gdb/eval.c
|
||||
+++ b/gdb/eval.c
|
||||
@@ -399,29 +399,253 @@ init_array_element (struct value *array, struct value *element,
|
||||
return index;
|
||||
}
|
||||
|
||||
+/* Evaluates any operation on Fortran arrays or strings with at least
|
||||
+ one user provided parameter. Expects the input ARRAY to be either
|
||||
+ an array, or a string. Evaluates EXP by incrementing POS, and
|
||||
+ writes the content from the elt stack into a local struct. NARGS
|
||||
+ specifies number of literal or range arguments the user provided.
|
||||
+ NARGS must be the same number as ARRAY has dimensions. */
|
||||
+
|
||||
static struct value *
|
||||
-value_f90_subarray (struct value *array,
|
||||
- struct expression *exp, int *pos, enum noside noside)
|
||||
+value_f90_subarray (struct value *array, struct expression *exp,
|
||||
+ int *pos, int nargs, enum noside noside)
|
||||
{
|
||||
- int pc = (*pos) + 1;
|
||||
+ int i, dim_count = 0;
|
||||
LONGEST low_bound, high_bound;
|
||||
struct type *range = check_typedef (TYPE_INDEX_TYPE (value_type (array)));
|
||||
- enum f90_range_type range_type
|
||||
- = (enum f90_range_type) longest_to_int (exp->elts[pc].longconst);
|
||||
-
|
||||
- *pos += 3;
|
||||
+ struct value *new_array = array;
|
||||
+ struct type *array_type = check_typedef (value_type (new_array));
|
||||
+ struct type *temp_type;
|
||||
+
|
||||
+ /* Local struct to hold user data for Fortran subarray dimensions. */
|
||||
+ struct subscript_store
|
||||
+ {
|
||||
+ /* For every dimension, we are either working on a range or an index
|
||||
+ expression, so we store this info separately for later. */
|
||||
+ enum
|
||||
+ {
|
||||
+ SUBSCRIPT_RANGE, /* e.g. "(lowbound:highbound)" */
|
||||
+ SUBSCRIPT_INDEX /* e.g. "(literal)" */
|
||||
+ } kind;
|
||||
+
|
||||
+ /* We also store either the lower and upper bound info, or the index
|
||||
+ number. Before evaluation of the input values, we do not know if we are
|
||||
+ actually working on a range of ranges, or an index in a range. So as a
|
||||
+ first step we store all input in a union. The array calculation itself
|
||||
+ deals with this later on. */
|
||||
+ union
|
||||
+ {
|
||||
+ struct subscript_range
|
||||
+ {
|
||||
+ enum f90_range_type f90_range_type;
|
||||
+ LONGEST low, high;
|
||||
+ }
|
||||
+ range;
|
||||
+ LONGEST number;
|
||||
+ };
|
||||
+ } *subscript_array;
|
||||
+
|
||||
+ /* Check if the number of arguments provided by the user matches
|
||||
+ the number of dimension of the array. A string has only one
|
||||
+ dimension. */
|
||||
+ if (nargs != calc_f77_array_dims (value_type (new_array)))
|
||||
+ error (_("Wrong number of subscripts"));
|
||||
+
|
||||
+ subscript_array = alloca (sizeof (*subscript_array) * nargs);
|
||||
+
|
||||
+ /* Parse the user input into the SUBSCRIPT_ARRAY to store it. We need
|
||||
+ to evaluate it first, as the input is from left-to-right. The
|
||||
+ array is stored from right-to-left. So we have to use the user
|
||||
+ input in reverse order. Later on, we need the input information to
|
||||
+ re-calculate the output array. For multi-dimensional arrays, we
|
||||
+ can be dealing with any possible combination of ranges and indices
|
||||
+ for every dimension. */
|
||||
+ for (i = 0; i < nargs; i++)
|
||||
+ {
|
||||
+ struct subscript_store *index = &subscript_array[i];
|
||||
|
||||
- if (range_type == LOW_BOUND_DEFAULT || range_type == BOTH_BOUND_DEFAULT)
|
||||
- low_bound = TYPE_LOW_BOUND (range);
|
||||
- else
|
||||
- low_bound = value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside));
|
||||
+ /* The user input is a range, with or without lower and upper bound.
|
||||
+ E.g.: "p arry(2:5)", "p arry( :5)", "p arry( : )", etc. */
|
||||
+ if (exp->elts[*pos].opcode == OP_F90_RANGE)
|
||||
+ {
|
||||
+ int pc = (*pos) + 1;
|
||||
+ struct subscript_range *range;
|
||||
+
|
||||
+ index->kind = SUBSCRIPT_RANGE;
|
||||
+ range = &index->range;
|
||||
+
|
||||
+ *pos += 3;
|
||||
+ range->f90_range_type = longest_to_int (exp->elts[pc].longconst);
|
||||
+
|
||||
+ /* If a lower bound was provided by the user, the bit has been
|
||||
+ set and we can assign the value from the elt stack. Same for
|
||||
+ upper bound. */
|
||||
+ if ((range->f90_range_type == HIGH_BOUND_DEFAULT)
|
||||
+ || range->f90_range_type == NONE_BOUND_DEFAULT)
|
||||
+ range->low = value_as_long (evaluate_subexp (NULL_TYPE, exp,
|
||||
+ pos, noside));
|
||||
+ if ((range->f90_range_type == LOW_BOUND_DEFAULT)
|
||||
+ || range->f90_range_type == NONE_BOUND_DEFAULT)
|
||||
+ range->high = value_as_long (evaluate_subexp (NULL_TYPE, exp,
|
||||
+ pos, noside));
|
||||
+ }
|
||||
+ /* User input is an index. E.g.: "p arry(5)". */
|
||||
+ else
|
||||
+ {
|
||||
+ struct value *val;
|
||||
|
||||
- if (range_type == HIGH_BOUND_DEFAULT || range_type == BOTH_BOUND_DEFAULT)
|
||||
- high_bound = TYPE_HIGH_BOUND (range);
|
||||
- else
|
||||
- high_bound = value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside));
|
||||
+ index->kind = SUBSCRIPT_INDEX;
|
||||
+
|
||||
+ /* Evaluate each subscript; it must be a legal integer in F77. This
|
||||
+ ensures the validity of the provided index. */
|
||||
+ val = evaluate_subexp_with_coercion (exp, pos, noside);
|
||||
+ index->number = value_as_long (val);
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ /* Traverse the array from right to left and evaluate each corresponding
|
||||
+ user input. VALUE_SUBSCRIPT is called for every index, until a range
|
||||
+ expression is evaluated. After a range expression has been evaluated,
|
||||
+ every subsequent expression is also treated as a range. */
|
||||
+ for (i = nargs - 1; i >= 0; i--)
|
||||
+ {
|
||||
+ struct subscript_store *index = &subscript_array[i];
|
||||
+ struct type *index_type = TYPE_INDEX_TYPE (array_type);
|
||||
+
|
||||
+ switch (index->kind)
|
||||
+ {
|
||||
+ case SUBSCRIPT_RANGE:
|
||||
+ {
|
||||
+
|
||||
+ /* When we hit the first range specified by the user, we must
|
||||
+ treat any subsequent user entry as a range. We simply
|
||||
+ increment DIM_COUNT which tells us how many times we are
|
||||
+ calling VALUE_SLICE_1. */
|
||||
+ struct subscript_range *range = &index->range;
|
||||
+
|
||||
+ /* If no lower bound was provided by the user, we take the
|
||||
+ default boundary. Same for the high bound. */
|
||||
+ if ((range->f90_range_type == LOW_BOUND_DEFAULT)
|
||||
+ || (range->f90_range_type == BOTH_BOUND_DEFAULT))
|
||||
+ range->low = TYPE_LOW_BOUND (index_type);
|
||||
+
|
||||
+ if ((range->f90_range_type == HIGH_BOUND_DEFAULT)
|
||||
+ || (range->f90_range_type == BOTH_BOUND_DEFAULT))
|
||||
+ range->high = TYPE_HIGH_BOUND (index_type);
|
||||
+
|
||||
+ /* Both user provided low and high bound have to be inside the
|
||||
+ array bounds. Throw an error if not. */
|
||||
+ if (range->low < TYPE_LOW_BOUND (index_type)
|
||||
+ || range->low > TYPE_HIGH_BOUND (index_type)
|
||||
+ || range->high < TYPE_LOW_BOUND (index_type)
|
||||
+ || range->high > TYPE_HIGH_BOUND (index_type))
|
||||
+ error (_("provided bound(s) outside array bound(s)"));
|
||||
+
|
||||
+ /* DIM_COUNT counts every user argument that is treated as a range.
|
||||
+ This is necessary for expressions like 'print array(7, 8:9).
|
||||
+ Here the first argument is a literal, but must be treated as a
|
||||
+ range argument to allow the correct output representation. */
|
||||
+ dim_count++;
|
||||
+
|
||||
+ new_array
|
||||
+ = value_slice_1 (new_array,
|
||||
+ longest_to_int (range->low),
|
||||
+ longest_to_int (range->high - range->low + 1),
|
||||
+ dim_count);
|
||||
+ }
|
||||
+ break;
|
||||
+
|
||||
+ case SUBSCRIPT_INDEX:
|
||||
+ {
|
||||
+ /* DIM_COUNT only stays '0' when no range argument was processed
|
||||
+ before, starting from the last dimension. This way we can
|
||||
+ reduce the number of dimensions from the result array.
|
||||
+ However, if a range has been processed before an index, we
|
||||
+ treat the index like a range with equal low- and high bounds
|
||||
+ to get the value offset right. */
|
||||
+ if (dim_count == 0)
|
||||
+ new_array
|
||||
+ = value_subscripted_rvalue (new_array, index->number,
|
||||
+ f77_get_lowerbound (value_type
|
||||
+ (new_array)));
|
||||
+ else
|
||||
+ {
|
||||
+ /* Check for valid index input. */
|
||||
+ if (index->number < TYPE_LOW_BOUND (index_type)
|
||||
+ || index->number > TYPE_HIGH_BOUND (index_type))
|
||||
+ error (_("error no such vector element"));
|
||||
+
|
||||
+ dim_count++;
|
||||
+ new_array = value_slice_1 (new_array,
|
||||
+ longest_to_int (index->number),
|
||||
+ 1, /* length is '1' element */
|
||||
+ dim_count);
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* With DIM_COUNT > 1 we currently have a one dimensional array, but expect
|
||||
+ an array of arrays, depending on how many ranges have been provided by
|
||||
+ the user. So we need to rebuild the array dimensions for printing it
|
||||
+ correctly.
|
||||
+ Starting from right to left in the user input, after we hit the first
|
||||
+ range argument every subsequent argument is also treated as a range.
|
||||
+ E.g.:
|
||||
+ "p ary(3, 7, 2:15)" in Fortran has only 1 dimension, but we calculated 3
|
||||
+ ranges.
|
||||
+ "p ary(3, 7:12, 4)" in Fortran has only 1 dimension, but we calculated 2
|
||||
+ ranges.
|
||||
+ "p ary(2:4, 5, 7)" in Fortran has only 1 dimension, and we calculated 1
|
||||
+ range. */
|
||||
+ if (dim_count > 1)
|
||||
+ {
|
||||
+ struct value *v = NULL;
|
||||
|
||||
- return value_slice (array, low_bound, high_bound - low_bound + 1);
|
||||
+ temp_type = TYPE_TARGET_TYPE (value_type (new_array));
|
||||
+
|
||||
+ /* Every SUBSCRIPT_RANGE in the user input signifies an actual range in
|
||||
+ the output array. So we traverse the SUBSCRIPT_ARRAY again, looking
|
||||
+ for a range entry. When we find one, we use the range info to create
|
||||
+ an additional range_type to set the correct bounds and dimensions for
|
||||
+ the output array. */
|
||||
+ for (i = 0; i < nargs; i++)
|
||||
+ {
|
||||
+ struct subscript_store *index = &subscript_array[i];
|
||||
+
|
||||
+ if (index->kind == SUBSCRIPT_RANGE)
|
||||
+ {
|
||||
+ struct type *range_type, *interim_array_type;
|
||||
+
|
||||
+ range_type
|
||||
+ = create_static_range_type (NULL,
|
||||
+ temp_type,
|
||||
+ 1,
|
||||
+ index->range.high - index->range.low + 1);
|
||||
+
|
||||
+ interim_array_type = create_array_type (NULL,
|
||||
+ temp_type,
|
||||
+ range_type);
|
||||
+
|
||||
+ /* For some reason the type code of the contents is missing, so
|
||||
+ reset it from the original array. */
|
||||
+ TYPE_CODE (interim_array_type)
|
||||
+ = TYPE_CODE (value_type (new_array));
|
||||
+
|
||||
+ v = allocate_value (interim_array_type);
|
||||
+
|
||||
+ temp_type = value_type (v);
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+ value_contents_copy (v, 0, new_array, 0, TYPE_LENGTH (temp_type));
|
||||
+ return v;
|
||||
+ }
|
||||
+
|
||||
+ return new_array;
|
||||
}
|
||||
|
||||
|
||||
@@ -1810,14 +2034,11 @@ evaluate_subexp_standard (struct type *expect_type,
|
||||
switch (code)
|
||||
{
|
||||
case TYPE_CODE_ARRAY:
|
||||
- if (exp->elts[*pos].opcode == OP_F90_RANGE)
|
||||
- return value_f90_subarray (arg1, exp, pos, noside);
|
||||
- else
|
||||
- goto multi_f77_subscript;
|
||||
+ return value_f90_subarray (arg1, exp, pos, nargs, noside);
|
||||
|
||||
case TYPE_CODE_STRING:
|
||||
if (exp->elts[*pos].opcode == OP_F90_RANGE)
|
||||
- return value_f90_subarray (arg1, exp, pos, noside);
|
||||
+ return value_f90_subarray (arg1, exp, pos, 1, noside);
|
||||
else
|
||||
{
|
||||
arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
|
||||
@@ -2222,49 +2443,6 @@ evaluate_subexp_standard (struct type *expect_type,
|
||||
}
|
||||
return (arg1);
|
||||
|
||||
- multi_f77_subscript:
|
||||
- {
|
||||
- LONGEST subscript_array[MAX_FORTRAN_DIMS];
|
||||
- int ndimensions = 1, i;
|
||||
- struct value *array = arg1;
|
||||
-
|
||||
- if (nargs > MAX_FORTRAN_DIMS)
|
||||
- error (_("Too many subscripts for F77 (%d Max)"), MAX_FORTRAN_DIMS);
|
||||
-
|
||||
- ndimensions = calc_f77_array_dims (type);
|
||||
-
|
||||
- if (nargs != ndimensions)
|
||||
- error (_("Wrong number of subscripts"));
|
||||
-
|
||||
- gdb_assert (nargs > 0);
|
||||
-
|
||||
- /* Now that we know we have a legal array subscript expression
|
||||
- let us actually find out where this element exists in the array. */
|
||||
-
|
||||
- /* Take array indices left to right. */
|
||||
- for (i = 0; i < nargs; i++)
|
||||
- {
|
||||
- /* Evaluate each subscript; it must be a legal integer in F77. */
|
||||
- arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
|
||||
-
|
||||
- /* Fill in the subscript array. */
|
||||
-
|
||||
- subscript_array[i] = value_as_long (arg2);
|
||||
- }
|
||||
-
|
||||
- /* Internal type of array is arranged right to left. */
|
||||
- for (i = nargs; i > 0; i--)
|
||||
- {
|
||||
- struct type *array_type = check_typedef (value_type (array));
|
||||
- LONGEST index = subscript_array[i - 1];
|
||||
-
|
||||
- array = value_subscripted_rvalue (array, index,
|
||||
- f77_get_lowerbound (array_type));
|
||||
- }
|
||||
-
|
||||
- return array;
|
||||
- }
|
||||
-
|
||||
case BINOP_LOGICAL_AND:
|
||||
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
||||
if (noside == EVAL_SKIP)
|
||||
@@ -3121,6 +3299,9 @@ calc_f77_array_dims (struct type *array_type)
|
||||
int ndimen = 1;
|
||||
struct type *tmp_type;
|
||||
|
||||
+ if (TYPE_CODE (array_type) == TYPE_CODE_STRING)
|
||||
+ return 1;
|
||||
+
|
||||
if ((TYPE_CODE (array_type) != TYPE_CODE_ARRAY))
|
||||
error (_("Can't get dimensions for a non-array type"));
|
||||
|
||||
diff --git a/gdb/f-exp.y b/gdb/f-exp.y
|
||||
index 4faac32..9343abb 100644
|
||||
--- a/gdb/f-exp.y
|
||||
+++ b/gdb/f-exp.y
|
||||
@@ -308,6 +308,8 @@ arglist : subrange
|
||||
|
||||
arglist : arglist ',' exp %prec ABOVE_COMMA
|
||||
{ arglist_len++; }
|
||||
+ | arglist ',' subrange %prec ABOVE_COMMA
|
||||
+ { arglist_len++; }
|
||||
;
|
||||
|
||||
/* There are four sorts of subrange types in F90. */
|
||||
diff --git a/gdb/valops.c b/gdb/valops.c
|
||||
index 5a244a9..09ea877 100644
|
||||
--- a/gdb/valops.c
|
||||
+++ b/gdb/valops.c
|
||||
@@ -3759,56 +3759,151 @@ value_of_this_silent (const struct language_defn *lang)
|
||||
struct value *
|
||||
value_slice (struct value *array, int lowbound, int length)
|
||||
{
|
||||
+ /* Pass unaltered arguments to VALUE_SLICE_1, plus a CALL_COUNT of '1' as we
|
||||
+ are only considering the highest dimension, or we are working on a one
|
||||
+ dimensional array. So we call VALUE_SLICE_1 exactly once. */
|
||||
+ return value_slice_1 (array, lowbound, length, 1);
|
||||
+}
|
||||
+
|
||||
+/* CALL_COUNT is used to determine if we are calling the function once, e.g.
|
||||
+ we are working on the current dimension of ARRAY, or if we are calling
|
||||
+ the function repeatedly. In the later case we need to take elements
|
||||
+ from the TARGET_TYPE of ARRAY.
|
||||
+ With a CALL_COUNT greater than 1 we calculate the offsets for every element
|
||||
+ that should be in the result array. Then we fetch the contents and then
|
||||
+ copy them into the result array. The result array will have one dimension
|
||||
+ less than the input array, so later on we need to recreate the indices and
|
||||
+ ranges in the calling function. */
|
||||
+
|
||||
+struct value *
|
||||
+value_slice_1 (struct value *array, int lowbound, int length, int call_count)
|
||||
+{
|
||||
struct type *slice_range_type, *slice_type, *range_type;
|
||||
- LONGEST lowerbound, upperbound;
|
||||
- struct value *slice;
|
||||
- struct type *array_type;
|
||||
+ struct type *array_type = check_typedef (value_type (array));
|
||||
+ struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (array_type));
|
||||
+ unsigned int elt_size, elt_offs;
|
||||
+ LONGEST elt_stride, ary_high_bound, ary_low_bound;
|
||||
+ struct value *v;
|
||||
+ int slice_range_size, i = 0, row_count = 1, elem_count = 1;
|
||||
|
||||
- array_type = check_typedef (value_type (array));
|
||||
+ /* Check for legacy code if we are actually dealing with an array or
|
||||
+ string. */
|
||||
if (TYPE_CODE (array_type) != TYPE_CODE_ARRAY
|
||||
&& TYPE_CODE (array_type) != TYPE_CODE_STRING)
|
||||
error (_("cannot take slice of non-array"));
|
||||
|
||||
- range_type = TYPE_INDEX_TYPE (array_type);
|
||||
- if (get_discrete_bounds (range_type, &lowerbound, &upperbound) < 0)
|
||||
- error (_("slice from bad array or bitstring"));
|
||||
+ ary_low_bound = TYPE_LOW_BOUND (TYPE_INDEX_TYPE (array_type));
|
||||
+ ary_high_bound = TYPE_HIGH_BOUND (TYPE_INDEX_TYPE (array_type));
|
||||
+
|
||||
+ /* When we are working on a multi-dimensional array, we need to get the
|
||||
+ attributes of the underlying type. */
|
||||
+ if (call_count > 1)
|
||||
+ {
|
||||
+ elt_type = check_typedef (TYPE_TARGET_TYPE (elt_type));
|
||||
+ row_count = TYPE_LENGTH (array_type)
|
||||
+ / TYPE_LENGTH (TYPE_TARGET_TYPE (array_type));
|
||||
+ }
|
||||
+
|
||||
+ elem_count = length;
|
||||
+ elt_size = TYPE_LENGTH (elt_type);
|
||||
+ elt_offs = longest_to_int (lowbound - ary_low_bound);
|
||||
+ elt_stride = TYPE_LENGTH (TYPE_INDEX_TYPE (array_type));
|
||||
+
|
||||
+ elt_offs *= elt_size;
|
||||
+
|
||||
+ /* Check for valid user input. In case of Fortran this was already done
|
||||
+ in the calling function. */
|
||||
+ if (call_count == 1
|
||||
+ && (!TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type)
|
||||
+ && elt_offs >= TYPE_LENGTH (array_type)))
|
||||
+ error (_("no such vector element"));
|
||||
|
||||
- if (lowbound < lowerbound || length < 0
|
||||
- || lowbound + length - 1 > upperbound)
|
||||
- error (_("slice out of range"));
|
||||
+ /* CALL_COUNT is 1 when we are dealing either with the highest dimension
|
||||
+ of the array, or a one dimensional array. Set RANGE_TYPE accordingly.
|
||||
+ In both cases we calculate how many rows/elements will be in the output
|
||||
+ array by setting slice_range_size. */
|
||||
+ if (call_count == 1)
|
||||
+ {
|
||||
+ range_type = TYPE_INDEX_TYPE (array_type);
|
||||
+ slice_range_size = elem_count;
|
||||
+
|
||||
+ /* Check if the array bounds are valid. */
|
||||
+ if (get_discrete_bounds (range_type, &ary_low_bound, &ary_high_bound) < 0)
|
||||
+ error (_("slice from bad array or bitstring"));
|
||||
+ }
|
||||
+ /* When CALL_COUNT is greater than 1, we are dealing with an array of arrays.
|
||||
+ So we need to get the type below the current one and set the RANGE_TYPE
|
||||
+ accordingly. */
|
||||
+ else
|
||||
+ {
|
||||
+ range_type = TYPE_INDEX_TYPE (TYPE_TARGET_TYPE (array_type));
|
||||
+ slice_range_size = (ary_low_bound + row_count - 1) * (elem_count);
|
||||
+ ary_low_bound = TYPE_LOW_BOUND (range_type);
|
||||
+ }
|
||||
|
||||
/* FIXME-type-allocation: need a way to free this type when we are
|
||||
- done with it. */
|
||||
- slice_range_type = create_static_range_type ((struct type *) NULL,
|
||||
- TYPE_TARGET_TYPE (range_type),
|
||||
- lowbound,
|
||||
- lowbound + length - 1);
|
||||
+ done with it. */
|
||||
|
||||
+ slice_range_type = create_static_range_type (NULL, TYPE_TARGET_TYPE (range_type),
|
||||
+ ary_low_bound, slice_range_size);
|
||||
{
|
||||
- struct type *element_type = TYPE_TARGET_TYPE (array_type);
|
||||
- LONGEST offset
|
||||
- = (lowbound - lowerbound) * TYPE_LENGTH (check_typedef (element_type));
|
||||
+ struct type *element_type;
|
||||
+
|
||||
+ /* When CALL_COUNT equals 1 we can use the legacy code for subarrays. */
|
||||
+ if (call_count == 1)
|
||||
+ {
|
||||
+ element_type = TYPE_TARGET_TYPE (array_type);
|
||||
|
||||
- slice_type = create_array_type ((struct type *) NULL,
|
||||
- element_type,
|
||||
- slice_range_type);
|
||||
- TYPE_CODE (slice_type) = TYPE_CODE (array_type);
|
||||
+ slice_type = create_array_type (NULL, element_type, slice_range_type);
|
||||
+
|
||||
+ TYPE_CODE (slice_type) = TYPE_CODE (array_type);
|
||||
+
|
||||
+ if (VALUE_LVAL (array) == lval_memory && value_lazy (array))
|
||||
+ v = allocate_value_lazy (slice_type);
|
||||
+ else
|
||||
+ {
|
||||
+ v = allocate_value (slice_type);
|
||||
+ value_contents_copy (v,
|
||||
+ value_embedded_offset (v),
|
||||
+ array,
|
||||
+ value_embedded_offset (array) + elt_offs,
|
||||
+ elt_size * longest_to_int (length));
|
||||
+ }
|
||||
|
||||
- if (VALUE_LVAL (array) == lval_memory && value_lazy (array))
|
||||
- slice = allocate_value_lazy (slice_type);
|
||||
+ }
|
||||
+ /* When CALL_COUNT is larger than 1 we are working on a range of ranges.
|
||||
+ So we copy the relevant elements into the new array we return. */
|
||||
else
|
||||
{
|
||||
- slice = allocate_value (slice_type);
|
||||
- value_contents_copy (slice, 0, array, offset,
|
||||
- type_length_units (slice_type));
|
||||
+ LONGEST dst_offset = 0;
|
||||
+ LONGEST src_row_length = TYPE_LENGTH (TYPE_TARGET_TYPE (array_type));
|
||||
+
|
||||
+ element_type = TYPE_TARGET_TYPE (TYPE_TARGET_TYPE (array_type));
|
||||
+ slice_type = create_array_type (NULL, element_type, slice_range_type);
|
||||
+
|
||||
+ TYPE_CODE (slice_type) = TYPE_CODE (TYPE_TARGET_TYPE (array_type));
|
||||
+
|
||||
+ v = allocate_value (slice_type);
|
||||
+ for (i = 0; i < longest_to_int (row_count); i++)
|
||||
+ {
|
||||
+ /* Fetches the contents of ARRAY and copies them into V. */
|
||||
+ value_contents_copy (v,
|
||||
+ dst_offset,
|
||||
+ array,
|
||||
+ elt_offs,
|
||||
+ elt_size * elem_count);
|
||||
+ elt_offs += src_row_length;
|
||||
+ dst_offset += elt_size * elem_count;
|
||||
+ }
|
||||
}
|
||||
|
||||
- set_value_component_location (slice, array);
|
||||
- VALUE_FRAME_ID (slice) = VALUE_FRAME_ID (array);
|
||||
- set_value_offset (slice, value_offset (array) + offset);
|
||||
+ set_value_component_location (v, array);
|
||||
+ VALUE_REGNUM (v) = VALUE_REGNUM (array);
|
||||
+ VALUE_FRAME_ID (v) = VALUE_FRAME_ID (array);
|
||||
+ set_value_offset (v, value_offset (array) + elt_offs);
|
||||
}
|
||||
|
||||
- return slice;
|
||||
+ return v;
|
||||
}
|
||||
|
||||
/* Create a value for a FORTRAN complex number. Currently most of the
|
||||
diff --git a/gdb/value.h b/gdb/value.h
|
||||
index 2eac5ef..3400460 100644
|
||||
--- a/gdb/value.h
|
||||
+++ b/gdb/value.h
|
||||
@@ -1056,6 +1056,8 @@ extern struct value *varying_to_slice (struct value *);
|
||||
|
||||
extern struct value *value_slice (struct value *, int, int);
|
||||
|
||||
+extern struct value *value_slice_1 (struct value *, int, int, int);
|
||||
+
|
||||
extern struct value *value_literal_complex (struct value *, struct value *,
|
||||
struct type *);
|
||||
|
||||
--
|
||||
2.5.0
|
||||
|
@ -1,45 +0,0 @@
|
||||
http://sourceware.org/ml/gdb-patches/2016-02/msg00841.html
|
||||
Subject: [PATCH v2 2/6] fortran: combine subarray and string computation
|
||||
|
||||
From: Christoph Weinmann <christoph.t.weinmann@intel.com>
|
||||
|
||||
Strings only have one dimension, but the element computation is
|
||||
identical to the subarray computation for ranges and indices.
|
||||
|
||||
2013-11-26 Christoph Weinmann <christoph.t.weinmann@intel.com>
|
||||
|
||||
* eval.c (evaluate_subexp_standard): Call
|
||||
value_f90_subarray for print expressions on array and
|
||||
string types.
|
||||
|
||||
|
||||
Signed-off-by: Christoph Weinmann <christoph.t.weinmann@intel.com>
|
||||
---
|
||||
gdb/eval.c | 10 +---------
|
||||
1 file changed, 1 insertion(+), 9 deletions(-)
|
||||
|
||||
diff --git a/gdb/eval.c b/gdb/eval.c
|
||||
index c9f325f..164d7ab 100644
|
||||
--- a/gdb/eval.c
|
||||
+++ b/gdb/eval.c
|
||||
@@ -2034,16 +2034,8 @@ evaluate_subexp_standard (struct type *expect_type,
|
||||
switch (code)
|
||||
{
|
||||
case TYPE_CODE_ARRAY:
|
||||
- return value_f90_subarray (arg1, exp, pos, nargs, noside);
|
||||
-
|
||||
case TYPE_CODE_STRING:
|
||||
- if (exp->elts[*pos].opcode == OP_F90_RANGE)
|
||||
- return value_f90_subarray (arg1, exp, pos, 1, noside);
|
||||
- else
|
||||
- {
|
||||
- arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
|
||||
- return value_subscript (arg1, value_as_long (arg2));
|
||||
- }
|
||||
+ return value_f90_subarray (arg1, exp, pos, nargs, noside);
|
||||
|
||||
case TYPE_CODE_PTR:
|
||||
case TYPE_CODE_FUNC:
|
||||
--
|
||||
2.5.0
|
||||
|
@ -1,162 +0,0 @@
|
||||
http://sourceware.org/ml/gdb-patches/2016-02/msg00845.html
|
||||
Subject: [PATCH v2 3/6] fortran: change subrange enum to bit field
|
||||
|
||||
From: Christoph Weinmann <christoph.t.weinmann@intel.com>
|
||||
|
||||
Change Fortran subrange enum for subrange expressions to
|
||||
represent a bitfield for easier manipulation. Consequently
|
||||
also change occurences and evaluation of said enum. The
|
||||
behaviour of GDB is unchanged.
|
||||
|
||||
2013-11-27 Christoph Weinmann <christoph.t.weinmann@intel.com>
|
||||
|
||||
* eval.c (value_f90_subarray): Change evaluation of the
|
||||
subarray boundaries. Set boundaries to be either user
|
||||
provided (bit in f90_range_type was set) or take the
|
||||
default value if the boundary was not provided by the user.
|
||||
* f-exp.y (subrange): Change rules for subrange expressions
|
||||
to write the relevant bit sequence onto the elt stack.
|
||||
* f-lang.h (f90_range_type): Change the enum to use bit
|
||||
values for each boundary, if set by the user.
|
||||
* parse.c (operator_length_standard): In case of
|
||||
OP_F90_RANGE change the calculation of the number of
|
||||
arguments on the elt stack, depending on the number of
|
||||
boundaries provided by the user.
|
||||
|
||||
|
||||
Signed-off-by: Christoph Weinmann <christoph.t.weinmann@intel.com>
|
||||
---
|
||||
gdb/eval.c | 14 ++++++--------
|
||||
gdb/f-exp.y | 11 ++++++-----
|
||||
gdb/f-lang.h | 6 ++----
|
||||
gdb/parse.c | 21 ++++++++-------------
|
||||
4 files changed, 22 insertions(+), 30 deletions(-)
|
||||
|
||||
diff --git a/gdb/eval.c b/gdb/eval.c
|
||||
index 164d7ab..9b8b051 100644
|
||||
--- a/gdb/eval.c
|
||||
+++ b/gdb/eval.c
|
||||
@@ -480,12 +480,12 @@ value_f90_subarray (struct value *array, struct expression *exp,
|
||||
/* If a lower bound was provided by the user, the bit has been
|
||||
set and we can assign the value from the elt stack. Same for
|
||||
upper bound. */
|
||||
- if ((range->f90_range_type == HIGH_BOUND_DEFAULT)
|
||||
- || range->f90_range_type == NONE_BOUND_DEFAULT)
|
||||
+ if ((range->f90_range_type & SUBARRAY_LOW_BOUND)
|
||||
+ == SUBARRAY_LOW_BOUND)
|
||||
range->low = value_as_long (evaluate_subexp (NULL_TYPE, exp,
|
||||
pos, noside));
|
||||
- if ((range->f90_range_type == LOW_BOUND_DEFAULT)
|
||||
- || range->f90_range_type == NONE_BOUND_DEFAULT)
|
||||
+ if ((range->f90_range_type & SUBARRAY_HIGH_BOUND)
|
||||
+ == SUBARRAY_HIGH_BOUND)
|
||||
range->high = value_as_long (evaluate_subexp (NULL_TYPE, exp,
|
||||
pos, noside));
|
||||
}
|
||||
@@ -526,12 +526,10 @@ value_f90_subarray (struct value *array, struct expression *exp,
|
||||
|
||||
/* If no lower bound was provided by the user, we take the
|
||||
default boundary. Same for the high bound. */
|
||||
- if ((range->f90_range_type == LOW_BOUND_DEFAULT)
|
||||
- || (range->f90_range_type == BOTH_BOUND_DEFAULT))
|
||||
+ if ((range->f90_range_type & SUBARRAY_LOW_BOUND) == 0)
|
||||
range->low = TYPE_LOW_BOUND (index_type);
|
||||
|
||||
- if ((range->f90_range_type == HIGH_BOUND_DEFAULT)
|
||||
- || (range->f90_range_type == BOTH_BOUND_DEFAULT))
|
||||
+ if ((range->f90_range_type & SUBARRAY_HIGH_BOUND) == 0)
|
||||
range->high = TYPE_HIGH_BOUND (index_type);
|
||||
|
||||
/* Both user provided low and high bound have to be inside the
|
||||
diff --git a/gdb/f-exp.y b/gdb/f-exp.y
|
||||
index 9343abb..b1206de 100644
|
||||
--- a/gdb/f-exp.y
|
||||
+++ b/gdb/f-exp.y
|
||||
@@ -315,26 +315,27 @@ arglist : arglist ',' exp %prec ABOVE_COMMA
|
||||
/* There are four sorts of subrange types in F90. */
|
||||
|
||||
subrange: exp ':' exp %prec ABOVE_COMMA
|
||||
- { write_exp_elt_opcode (pstate, OP_F90_RANGE);
|
||||
- write_exp_elt_longcst (pstate, NONE_BOUND_DEFAULT);
|
||||
+ { write_exp_elt_opcode (pstate, OP_F90_RANGE);
|
||||
+ write_exp_elt_longcst (pstate,
|
||||
+ SUBARRAY_LOW_BOUND | SUBARRAY_HIGH_BOUND);
|
||||
write_exp_elt_opcode (pstate, OP_F90_RANGE); }
|
||||
;
|
||||
|
||||
subrange: exp ':' %prec ABOVE_COMMA
|
||||
{ write_exp_elt_opcode (pstate, OP_F90_RANGE);
|
||||
- write_exp_elt_longcst (pstate, HIGH_BOUND_DEFAULT);
|
||||
+ write_exp_elt_longcst (pstate, SUBARRAY_LOW_BOUND);
|
||||
write_exp_elt_opcode (pstate, OP_F90_RANGE); }
|
||||
;
|
||||
|
||||
subrange: ':' exp %prec ABOVE_COMMA
|
||||
{ write_exp_elt_opcode (pstate, OP_F90_RANGE);
|
||||
- write_exp_elt_longcst (pstate, LOW_BOUND_DEFAULT);
|
||||
+ write_exp_elt_longcst (pstate, SUBARRAY_HIGH_BOUND);
|
||||
write_exp_elt_opcode (pstate, OP_F90_RANGE); }
|
||||
;
|
||||
|
||||
subrange: ':' %prec ABOVE_COMMA
|
||||
{ write_exp_elt_opcode (pstate, OP_F90_RANGE);
|
||||
- write_exp_elt_longcst (pstate, BOTH_BOUND_DEFAULT);
|
||||
+ write_exp_elt_longcst (pstate, 0);
|
||||
write_exp_elt_opcode (pstate, OP_F90_RANGE); }
|
||||
;
|
||||
|
||||
diff --git a/gdb/f-lang.h b/gdb/f-lang.h
|
||||
index eeca107..4d56bf7 100644
|
||||
--- a/gdb/f-lang.h
|
||||
+++ b/gdb/f-lang.h
|
||||
@@ -44,10 +44,8 @@ extern void f_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
|
||||
|
||||
enum f90_range_type
|
||||
{
|
||||
- BOTH_BOUND_DEFAULT, /* "(:)" */
|
||||
- LOW_BOUND_DEFAULT, /* "(:high)" */
|
||||
- HIGH_BOUND_DEFAULT, /* "(low:)" */
|
||||
- NONE_BOUND_DEFAULT /* "(low:high)" */
|
||||
+ SUBARRAY_LOW_BOUND = 0x1, /* "(low:)" */
|
||||
+ SUBARRAY_HIGH_BOUND = 0x2 /* "(:high)" */
|
||||
};
|
||||
|
||||
/* A common block. */
|
||||
diff --git a/gdb/parse.c b/gdb/parse.c
|
||||
index 4191fc6..d500279 100644
|
||||
--- a/gdb/parse.c
|
||||
+++ b/gdb/parse.c
|
||||
@@ -1006,22 +1006,17 @@ operator_length_standard (const struct expression *expr, int endpos,
|
||||
|
||||
case OP_F90_RANGE:
|
||||
oplen = 3;
|
||||
+ args = 0;
|
||||
range_type = (enum f90_range_type)
|
||||
longest_to_int (expr->elts[endpos - 2].longconst);
|
||||
|
||||
- switch (range_type)
|
||||
- {
|
||||
- case LOW_BOUND_DEFAULT:
|
||||
- case HIGH_BOUND_DEFAULT:
|
||||
- args = 1;
|
||||
- break;
|
||||
- case BOTH_BOUND_DEFAULT:
|
||||
- args = 0;
|
||||
- break;
|
||||
- case NONE_BOUND_DEFAULT:
|
||||
- args = 2;
|
||||
- break;
|
||||
- }
|
||||
+ /* Increment the argument counter for each argument
|
||||
+ provided by the user. */
|
||||
+ if ((range_type & SUBARRAY_LOW_BOUND) == SUBARRAY_LOW_BOUND)
|
||||
+ args++;
|
||||
+
|
||||
+ if ((range_type & SUBARRAY_HIGH_BOUND) == SUBARRAY_HIGH_BOUND)
|
||||
+ args++;
|
||||
|
||||
break;
|
||||
|
||||
--
|
||||
2.5.0
|
||||
|
@ -1,142 +0,0 @@
|
||||
http://sourceware.org/ml/gdb-patches/2016-02/msg00842.html
|
||||
Subject: [PATCH v2 4/6] fortran: enable parsing of stride parameter for subranges
|
||||
|
||||
From: Christoph Weinmann <christoph.t.weinmann@intel.com>
|
||||
|
||||
Allow the user to provide a stride parameter for Fortran
|
||||
subarrays. The stride parameter can be any integer except
|
||||
'0'. The default stride value is '1'.
|
||||
|
||||
2013-11-27 Christoph Weinmann <christoph.t.weinmann@intel.com>
|
||||
|
||||
* eval.c (value_f90_subarray): Add expression evaluation
|
||||
for a stride parameter in a Fortran range expression.
|
||||
* f-exp.y: Add yacc rules for writing info on the elt stack
|
||||
when the user provided a stride argument.
|
||||
* f-lang.h (F90_RANGE): Add field to enum to show when a
|
||||
stride was provided by the user.
|
||||
* parse.c (operator_length_standard): Check if a stride
|
||||
value was provided, and increment argument counter
|
||||
accordingly.
|
||||
|
||||
|
||||
Signed-off-by: Christoph Weinmann <christoph.t.weinmann@intel.com>
|
||||
---
|
||||
gdb/eval.c | 10 +++++++++-
|
||||
gdb/f-exp.y | 33 +++++++++++++++++++++++++++++++--
|
||||
gdb/f-lang.h | 5 +++--
|
||||
gdb/parse.c | 3 +++
|
||||
4 files changed, 46 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/gdb/eval.c b/gdb/eval.c
|
||||
index 9b8b051..308ada3 100644
|
||||
--- a/gdb/eval.c
|
||||
+++ b/gdb/eval.c
|
||||
@@ -438,7 +438,7 @@ value_f90_subarray (struct value *array, struct expression *exp,
|
||||
struct subscript_range
|
||||
{
|
||||
enum f90_range_type f90_range_type;
|
||||
- LONGEST low, high;
|
||||
+ LONGEST low, high, stride;
|
||||
}
|
||||
range;
|
||||
LONGEST number;
|
||||
@@ -488,6 +488,14 @@ value_f90_subarray (struct value *array, struct expression *exp,
|
||||
== SUBARRAY_HIGH_BOUND)
|
||||
range->high = value_as_long (evaluate_subexp (NULL_TYPE, exp,
|
||||
pos, noside));
|
||||
+
|
||||
+ /* Assign the user's stride value if provided. */
|
||||
+ if ((range->f90_range_type & SUBARRAY_STRIDE) == SUBARRAY_STRIDE)
|
||||
+ range->stride = value_as_long (evaluate_subexp (NULL_TYPE, exp,
|
||||
+ pos, noside));
|
||||
+ /* Assign the default stride value '1'. */
|
||||
+ else
|
||||
+ range->stride = 1;
|
||||
}
|
||||
/* User input is an index. E.g.: "p arry(5)". */
|
||||
else
|
||||
diff --git a/gdb/f-exp.y b/gdb/f-exp.y
|
||||
index b1206de..5151fee 100644
|
||||
--- a/gdb/f-exp.y
|
||||
+++ b/gdb/f-exp.y
|
||||
@@ -316,8 +316,8 @@ arglist : arglist ',' exp %prec ABOVE_COMMA
|
||||
|
||||
subrange: exp ':' exp %prec ABOVE_COMMA
|
||||
{ write_exp_elt_opcode (pstate, OP_F90_RANGE);
|
||||
- write_exp_elt_longcst (pstate,
|
||||
- SUBARRAY_LOW_BOUND | SUBARRAY_HIGH_BOUND);
|
||||
+ write_exp_elt_longcst (pstate, SUBARRAY_LOW_BOUND
|
||||
+ | SUBARRAY_HIGH_BOUND);
|
||||
write_exp_elt_opcode (pstate, OP_F90_RANGE); }
|
||||
;
|
||||
|
||||
@@ -339,6 +339,35 @@ subrange: ':' %prec ABOVE_COMMA
|
||||
write_exp_elt_opcode (pstate, OP_F90_RANGE); }
|
||||
;
|
||||
|
||||
+/* Each subrange type can have a stride argument. */
|
||||
+subrange: exp ':' exp ':' exp %prec ABOVE_COMMA
|
||||
+ { write_exp_elt_opcode (pstate, OP_F90_RANGE);
|
||||
+ write_exp_elt_longcst (pstate, SUBARRAY_LOW_BOUND
|
||||
+ | SUBARRAY_HIGH_BOUND
|
||||
+ | SUBARRAY_STRIDE);
|
||||
+ write_exp_elt_opcode (pstate, OP_F90_RANGE); }
|
||||
+ ;
|
||||
+
|
||||
+subrange: exp ':' ':' exp %prec ABOVE_COMMA
|
||||
+ { write_exp_elt_opcode (pstate, OP_F90_RANGE);
|
||||
+ write_exp_elt_longcst (pstate, SUBARRAY_LOW_BOUND
|
||||
+ | SUBARRAY_STRIDE);
|
||||
+ write_exp_elt_opcode (pstate, OP_F90_RANGE); }
|
||||
+ ;
|
||||
+
|
||||
+subrange: ':' exp ':' exp %prec ABOVE_COMMA
|
||||
+ { write_exp_elt_opcode (pstate, OP_F90_RANGE);
|
||||
+ write_exp_elt_longcst (pstate, SUBARRAY_HIGH_BOUND
|
||||
+ | SUBARRAY_STRIDE);
|
||||
+ write_exp_elt_opcode (pstate, OP_F90_RANGE); }
|
||||
+ ;
|
||||
+
|
||||
+subrange: ':' ':' exp %prec ABOVE_COMMA
|
||||
+ { write_exp_elt_opcode (pstate, OP_F90_RANGE);
|
||||
+ write_exp_elt_longcst (pstate, SUBARRAY_STRIDE);
|
||||
+ write_exp_elt_opcode (pstate, OP_F90_RANGE); }
|
||||
+ ;
|
||||
+
|
||||
complexnum: exp ',' exp
|
||||
{ }
|
||||
;
|
||||
diff --git a/gdb/f-lang.h b/gdb/f-lang.h
|
||||
index 4d56bf7..0ad57af 100644
|
||||
--- a/gdb/f-lang.h
|
||||
+++ b/gdb/f-lang.h
|
||||
@@ -44,8 +44,9 @@ extern void f_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
|
||||
|
||||
enum f90_range_type
|
||||
{
|
||||
- SUBARRAY_LOW_BOUND = 0x1, /* "(low:)" */
|
||||
- SUBARRAY_HIGH_BOUND = 0x2 /* "(:high)" */
|
||||
+ SUBARRAY_LOW_BOUND = 0x1, /* "(low:)" or "(low::)" */
|
||||
+ SUBARRAY_HIGH_BOUND = 0x2, /* "(:high)" or "(:high:)" */
|
||||
+ SUBARRAY_STRIDE = 0x4 /* "(::stride)" */
|
||||
};
|
||||
|
||||
/* A common block. */
|
||||
diff --git a/gdb/parse.c b/gdb/parse.c
|
||||
index d500279..07248c3 100644
|
||||
--- a/gdb/parse.c
|
||||
+++ b/gdb/parse.c
|
||||
@@ -1018,6 +1018,9 @@ operator_length_standard (const struct expression *expr, int endpos,
|
||||
if ((range_type & SUBARRAY_HIGH_BOUND) == SUBARRAY_HIGH_BOUND)
|
||||
args++;
|
||||
|
||||
+ if ((range_type & SUBARRAY_STRIDE) == SUBARRAY_STRIDE)
|
||||
+ args++;
|
||||
+
|
||||
break;
|
||||
|
||||
default:
|
||||
--
|
||||
2.5.0
|
||||
|
@ -1,412 +0,0 @@
|
||||
http://sourceware.org/ml/gdb-patches/2016-02/msg00844.html
|
||||
Subject: [PATCH v2 5/6] fortran: calculate subarray with stride values.
|
||||
|
||||
From: Christoph Weinmann <christoph.t.weinmann@intel.com>
|
||||
|
||||
Calculate elements of a subarray using a provided stride value
|
||||
The stride value can be a positive or negative integer, but may
|
||||
not be zero. If no stride is provided, use the default value
|
||||
1 to print all elements inside the range.
|
||||
|
||||
1| program prog
|
||||
2| integer :: ary(10) = (/ (i, i=1, 10) /)
|
||||
3| end program prog
|
||||
|
||||
(gdb) print ary(1:10:2)
|
||||
$3 = (1, 3, 5, 7, 9)
|
||||
|
||||
2013-11-27 Christoph Weinmann <christoph.t.weinmann>
|
||||
|
||||
* eval.c (value_f90_subarray): Add range size calculation
|
||||
for stride based ranges, and evaluation of user stride
|
||||
parameters. Add check for matching user input to array
|
||||
bounds.
|
||||
* valops.c (value_slice): Add call parameter with default
|
||||
stride value for calling value_slice_1.
|
||||
* valops.c (value_slice_1): Add function parameter for
|
||||
stride length in the return subarray. Calculate array
|
||||
elements based on stride value.
|
||||
* value.h: Add stride parameter to declaration of
|
||||
value_slice_1.
|
||||
|
||||
|
||||
Signed-off-by: Christoph Weinmann <christoph.t.weinmann@intel.com>
|
||||
---
|
||||
gdb/eval.c | 111 ++++++++++++++++++++++++++++++++++++++++++++++-------------
|
||||
gdb/valops.c | 87 +++++++++++++++++++++++++++++++++-------------
|
||||
gdb/value.h | 2 +-
|
||||
3 files changed, 152 insertions(+), 48 deletions(-)
|
||||
|
||||
diff --git a/gdb/eval.c b/gdb/eval.c
|
||||
index 308ada3..d01b579 100644
|
||||
--- a/gdb/eval.c
|
||||
+++ b/gdb/eval.c
|
||||
@@ -437,8 +437,8 @@ value_f90_subarray (struct value *array, struct expression *exp,
|
||||
{
|
||||
struct subscript_range
|
||||
{
|
||||
- enum f90_range_type f90_range_type;
|
||||
- LONGEST low, high, stride;
|
||||
+ enum f90_range_type f90_range_type;
|
||||
+ LONGEST low, high, stride;
|
||||
}
|
||||
range;
|
||||
LONGEST number;
|
||||
@@ -475,7 +475,7 @@ value_f90_subarray (struct value *array, struct expression *exp,
|
||||
range = &index->range;
|
||||
|
||||
*pos += 3;
|
||||
- range->f90_range_type = longest_to_int (exp->elts[pc].longconst);
|
||||
+ range->f90_range_type = exp->elts[pc].longconst;
|
||||
|
||||
/* If a lower bound was provided by the user, the bit has been
|
||||
set and we can assign the value from the elt stack. Same for
|
||||
@@ -484,6 +484,7 @@ value_f90_subarray (struct value *array, struct expression *exp,
|
||||
== SUBARRAY_LOW_BOUND)
|
||||
range->low = value_as_long (evaluate_subexp (NULL_TYPE, exp,
|
||||
pos, noside));
|
||||
+
|
||||
if ((range->f90_range_type & SUBARRAY_HIGH_BOUND)
|
||||
== SUBARRAY_HIGH_BOUND)
|
||||
range->high = value_as_long (evaluate_subexp (NULL_TYPE, exp,
|
||||
@@ -496,6 +497,10 @@ value_f90_subarray (struct value *array, struct expression *exp,
|
||||
/* Assign the default stride value '1'. */
|
||||
else
|
||||
range->stride = 1;
|
||||
+
|
||||
+ /* Check the provided stride value is illegal, aka '0'. */
|
||||
+ if (range->stride == 0)
|
||||
+ error (_("Stride must not be 0"));
|
||||
}
|
||||
/* User input is an index. E.g.: "p arry(5)". */
|
||||
else
|
||||
@@ -512,10 +517,8 @@ value_f90_subarray (struct value *array, struct expression *exp,
|
||||
|
||||
}
|
||||
|
||||
- /* Traverse the array from right to left and evaluate each corresponding
|
||||
- user input. VALUE_SUBSCRIPT is called for every index, until a range
|
||||
- expression is evaluated. After a range expression has been evaluated,
|
||||
- every subsequent expression is also treated as a range. */
|
||||
+ /* Traverse the array from right to left and set the high and low bounds
|
||||
+ for later use. */
|
||||
for (i = nargs - 1; i >= 0; i--)
|
||||
{
|
||||
struct subscript_store *index = &subscript_array[i];
|
||||
@@ -548,6 +551,48 @@ value_f90_subarray (struct value *array, struct expression *exp,
|
||||
|| range->high > TYPE_HIGH_BOUND (index_type))
|
||||
error (_("provided bound(s) outside array bound(s)"));
|
||||
|
||||
+ /* For a negative stride the lower boundary must be larger than the
|
||||
+ upper boundary.
|
||||
+ For a positive stride the lower boundary must be smaller than the
|
||||
+ upper boundary. */
|
||||
+ if ((range->stride < 0 && range->low < range->high)
|
||||
+ || (range->stride > 0 && range->low > range->high))
|
||||
+ error (_("Wrong value provided for stride and boundaries"));
|
||||
+
|
||||
+ }
|
||||
+ break;
|
||||
+
|
||||
+ case SUBSCRIPT_INDEX:
|
||||
+ break;
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ array_type = TYPE_TARGET_TYPE (array_type);
|
||||
+ }
|
||||
+
|
||||
+ /* Reset ARRAY_TYPE before slicing.*/
|
||||
+ array_type = check_typedef (value_type (new_array));
|
||||
+
|
||||
+ /* Traverse the array from right to left and evaluate each corresponding
|
||||
+ user input. VALUE_SUBSCRIPT is called for every index, until a range
|
||||
+ expression is evaluated. After a range expression has been evaluated,
|
||||
+ every subsequent expression is also treated as a range. */
|
||||
+ for (i = nargs - 1; i >= 0; i--)
|
||||
+ {
|
||||
+ struct subscript_store *index = &subscript_array[i];
|
||||
+ struct type *index_type = TYPE_INDEX_TYPE (array_type);
|
||||
+
|
||||
+ switch (index->kind)
|
||||
+ {
|
||||
+ case SUBSCRIPT_RANGE:
|
||||
+ {
|
||||
+
|
||||
+ /* When we hit the first range specified by the user, we must
|
||||
+ treat any subsequent user entry as a range. We simply
|
||||
+ increment DIM_COUNT which tells us how many times we are
|
||||
+ calling VALUE_SLICE_1. */
|
||||
+ struct subscript_range *range = &index->range;
|
||||
+
|
||||
/* DIM_COUNT counts every user argument that is treated as a range.
|
||||
This is necessary for expressions like 'print array(7, 8:9).
|
||||
Here the first argument is a literal, but must be treated as a
|
||||
@@ -555,10 +600,9 @@ value_f90_subarray (struct value *array, struct expression *exp,
|
||||
dim_count++;
|
||||
|
||||
new_array
|
||||
- = value_slice_1 (new_array,
|
||||
- longest_to_int (range->low),
|
||||
- longest_to_int (range->high - range->low + 1),
|
||||
- dim_count);
|
||||
+ = value_slice_1 (new_array, range->low,
|
||||
+ range->high - range->low + 1,
|
||||
+ range->stride, dim_count);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -572,27 +616,38 @@ value_f90_subarray (struct value *array, struct expression *exp,
|
||||
to get the value offset right. */
|
||||
if (dim_count == 0)
|
||||
new_array
|
||||
- = value_subscripted_rvalue (new_array, index->number,
|
||||
+ = value_subscripted_rvalue (new_array, index->number,
|
||||
f77_get_lowerbound (value_type
|
||||
(new_array)));
|
||||
else
|
||||
{
|
||||
- /* Check for valid index input. */
|
||||
+ dim_count++;
|
||||
+
|
||||
+ /* We might end up here, because we have to treat the provided
|
||||
+ index like a range. But now VALUE_SUBSCRIPTED_RVALUE
|
||||
+ cannot do the range checks for us. So we have to make sure
|
||||
+ ourselves that the user provided index is inside the
|
||||
+ array bounds. Throw an error if not. */
|
||||
if (index->number < TYPE_LOW_BOUND (index_type)
|
||||
- || index->number > TYPE_HIGH_BOUND (index_type))
|
||||
- error (_("error no such vector element"));
|
||||
+ && index->number < TYPE_HIGH_BOUND (index_type))
|
||||
+ error (_("provided bound(s) outside array bound(s)"));
|
||||
+
|
||||
+ if (index->number > TYPE_LOW_BOUND (index_type)
|
||||
+ && index->number > TYPE_HIGH_BOUND (index_type))
|
||||
+ error (_("provided bound(s) outside array bound(s)"));
|
||||
|
||||
- dim_count++;
|
||||
new_array = value_slice_1 (new_array,
|
||||
- longest_to_int (index->number),
|
||||
- 1, /* length is '1' element */
|
||||
+ index->number,
|
||||
+ 1, /* COUNT is '1' element */
|
||||
+ 1, /* STRIDE set to '1' */
|
||||
dim_count);
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
- }
|
||||
+ array_type = TYPE_TARGET_TYPE (array_type);
|
||||
+ }
|
||||
|
||||
/* With DIM_COUNT > 1 we currently have a one dimensional array, but expect
|
||||
an array of arrays, depending on how many ranges have been provided by
|
||||
@@ -617,7 +672,9 @@ value_f90_subarray (struct value *array, struct expression *exp,
|
||||
the output array. So we traverse the SUBSCRIPT_ARRAY again, looking
|
||||
for a range entry. When we find one, we use the range info to create
|
||||
an additional range_type to set the correct bounds and dimensions for
|
||||
- the output array. */
|
||||
+ the output array. In addition, we may have a stride value that is not
|
||||
+ '1', forcing us to adjust the number of elements in a range, according
|
||||
+ to the stride value. */
|
||||
for (i = 0; i < nargs; i++)
|
||||
{
|
||||
struct subscript_store *index = &subscript_array[i];
|
||||
@@ -625,12 +682,20 @@ value_f90_subarray (struct value *array, struct expression *exp,
|
||||
if (index->kind == SUBSCRIPT_RANGE)
|
||||
{
|
||||
struct type *range_type, *interim_array_type;
|
||||
+ int new_length;
|
||||
+
|
||||
+ /* The length of a sub-dimension with all elements between the
|
||||
+ bounds plus the start element itself. It may be modified by
|
||||
+ a user provided stride value. */
|
||||
+ new_length = index->range.high - index->range.low;
|
||||
+
|
||||
+ new_length /= index->range.stride;
|
||||
|
||||
range_type
|
||||
= create_static_range_type (NULL,
|
||||
- temp_type,
|
||||
- 1,
|
||||
- index->range.high - index->range.low + 1);
|
||||
+ temp_type,
|
||||
+ index->range.low,
|
||||
+ index->range.low + new_length);
|
||||
|
||||
interim_array_type = create_array_type (NULL,
|
||||
temp_type,
|
||||
diff --git a/gdb/valops.c b/gdb/valops.c
|
||||
index 09ea877..83c8462 100644
|
||||
--- a/gdb/valops.c
|
||||
+++ b/gdb/valops.c
|
||||
@@ -3759,10 +3759,13 @@ value_of_this_silent (const struct language_defn *lang)
|
||||
struct value *
|
||||
value_slice (struct value *array, int lowbound, int length)
|
||||
{
|
||||
- /* Pass unaltered arguments to VALUE_SLICE_1, plus a CALL_COUNT of '1' as we
|
||||
- are only considering the highest dimension, or we are working on a one
|
||||
- dimensional array. So we call VALUE_SLICE_1 exactly once. */
|
||||
- return value_slice_1 (array, lowbound, length, 1);
|
||||
+ /* Pass unaltered arguments to VALUE_SLICE_1, plus a default stride
|
||||
+ value of '1', which returns every element between LOWBOUND and
|
||||
+ (LOWBOUND + LENGTH). We also provide a default CALL_COUNT of '1'
|
||||
+ as we are only considering the highest dimension, or we are
|
||||
+ working on a one dimensional array. So we call VALUE_SLICE_1
|
||||
+ exactly once. */
|
||||
+ return value_slice_1 (array, lowbound, length, 1, 1);
|
||||
}
|
||||
|
||||
/* CALL_COUNT is used to determine if we are calling the function once, e.g.
|
||||
@@ -3776,7 +3779,8 @@ value_slice (struct value *array, int lowbound, int length)
|
||||
ranges in the calling function. */
|
||||
|
||||
struct value *
|
||||
-value_slice_1 (struct value *array, int lowbound, int length, int call_count)
|
||||
+value_slice_1 (struct value *array, int lowbound, int length,
|
||||
+ int stride_length, int call_count)
|
||||
{
|
||||
struct type *slice_range_type, *slice_type, *range_type;
|
||||
struct type *array_type = check_typedef (value_type (array));
|
||||
@@ -3799,14 +3803,24 @@ value_slice_1 (struct value *array, int lowbound, int length, int call_count)
|
||||
attributes of the underlying type. */
|
||||
if (call_count > 1)
|
||||
{
|
||||
+ ary_low_bound = TYPE_LOW_BOUND (TYPE_INDEX_TYPE (elt_type));
|
||||
+ ary_high_bound = TYPE_HIGH_BOUND (TYPE_INDEX_TYPE (elt_type));
|
||||
elt_type = check_typedef (TYPE_TARGET_TYPE (elt_type));
|
||||
row_count = TYPE_LENGTH (array_type)
|
||||
/ TYPE_LENGTH (TYPE_TARGET_TYPE (array_type));
|
||||
}
|
||||
|
||||
- elem_count = length;
|
||||
+ /* With a stride of '1', the number of elements per result row is equal to
|
||||
+ the LENGTH of the subarray. With non-default stride values, we skip
|
||||
+ elements, but have to add the start element to the total number of
|
||||
+ elements per row. */
|
||||
+ if (stride_length == 1)
|
||||
+ elem_count = length;
|
||||
+ else
|
||||
+ elem_count = ((length - 1) / stride_length) + 1;
|
||||
+
|
||||
elt_size = TYPE_LENGTH (elt_type);
|
||||
- elt_offs = longest_to_int (lowbound - ary_low_bound);
|
||||
+ elt_offs = lowbound - ary_low_bound;
|
||||
elt_stride = TYPE_LENGTH (TYPE_INDEX_TYPE (array_type));
|
||||
|
||||
elt_offs *= elt_size;
|
||||
@@ -3825,7 +3839,7 @@ value_slice_1 (struct value *array, int lowbound, int length, int call_count)
|
||||
if (call_count == 1)
|
||||
{
|
||||
range_type = TYPE_INDEX_TYPE (array_type);
|
||||
- slice_range_size = elem_count;
|
||||
+ slice_range_size = ary_low_bound + elem_count - 1;
|
||||
|
||||
/* Check if the array bounds are valid. */
|
||||
if (get_discrete_bounds (range_type, &ary_low_bound, &ary_high_bound) < 0)
|
||||
@@ -3837,7 +3851,7 @@ value_slice_1 (struct value *array, int lowbound, int length, int call_count)
|
||||
else
|
||||
{
|
||||
range_type = TYPE_INDEX_TYPE (TYPE_TARGET_TYPE (array_type));
|
||||
- slice_range_size = (ary_low_bound + row_count - 1) * (elem_count);
|
||||
+ slice_range_size = ary_low_bound + (row_count * elem_count) - 1;
|
||||
ary_low_bound = TYPE_LOW_BOUND (range_type);
|
||||
}
|
||||
|
||||
@@ -3849,8 +3863,9 @@ value_slice_1 (struct value *array, int lowbound, int length, int call_count)
|
||||
{
|
||||
struct type *element_type;
|
||||
|
||||
- /* When CALL_COUNT equals 1 we can use the legacy code for subarrays. */
|
||||
- if (call_count == 1)
|
||||
+ /* When both CALL_COUNT and STRIDE_LENGTH equal 1, we can use the legacy
|
||||
+ code for subarrays. */
|
||||
+ if (call_count == 1 && stride_length == 1)
|
||||
{
|
||||
element_type = TYPE_TARGET_TYPE (array_type);
|
||||
|
||||
@@ -3871,29 +3886,53 @@ value_slice_1 (struct value *array, int lowbound, int length, int call_count)
|
||||
}
|
||||
|
||||
}
|
||||
- /* When CALL_COUNT is larger than 1 we are working on a range of ranges.
|
||||
- So we copy the relevant elements into the new array we return. */
|
||||
+ /* With a CALL_COUNT or STRIDE_LENGTH are greater than 1 we are working
|
||||
+ on a range of ranges. So we copy the relevant elements into the
|
||||
+ new array we return. */
|
||||
else
|
||||
{
|
||||
+ int j, offs_store = elt_offs;
|
||||
LONGEST dst_offset = 0;
|
||||
LONGEST src_row_length = TYPE_LENGTH (TYPE_TARGET_TYPE (array_type));
|
||||
|
||||
- element_type = TYPE_TARGET_TYPE (TYPE_TARGET_TYPE (array_type));
|
||||
+ if (call_count == 1)
|
||||
+ {
|
||||
+ /* When CALL_COUNT is equal to 1 we are working on the current range
|
||||
+ and use these elements directly. */
|
||||
+ element_type = TYPE_TARGET_TYPE (array_type);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ /* Working on an array of arrays, the type of the elements is the type
|
||||
+ of the subarrays' type. */
|
||||
+ element_type = TYPE_TARGET_TYPE (TYPE_TARGET_TYPE (array_type));
|
||||
+ }
|
||||
+
|
||||
slice_type = create_array_type (NULL, element_type, slice_range_type);
|
||||
|
||||
- TYPE_CODE (slice_type) = TYPE_CODE (TYPE_TARGET_TYPE (array_type));
|
||||
+ /* If we have a one dimensional array, we copy its TYPE_CODE. For a
|
||||
+ multi dimensional array we copy the embedded type's TYPE_CODE. */
|
||||
+ if (call_count == 1)
|
||||
+ TYPE_CODE (slice_type) = TYPE_CODE (array_type);
|
||||
+ else
|
||||
+ TYPE_CODE (slice_type) = TYPE_CODE (TYPE_TARGET_TYPE (array_type));
|
||||
|
||||
v = allocate_value (slice_type);
|
||||
- for (i = 0; i < longest_to_int (row_count); i++)
|
||||
+
|
||||
+ /* Iterate through the rows of the outer array and set the new offset
|
||||
+ for each row. */
|
||||
+ for (i = 0; i < row_count; i++)
|
||||
{
|
||||
- /* Fetches the contents of ARRAY and copies them into V. */
|
||||
- value_contents_copy (v,
|
||||
- dst_offset,
|
||||
- array,
|
||||
- elt_offs,
|
||||
- elt_size * elem_count);
|
||||
- elt_offs += src_row_length;
|
||||
- dst_offset += elt_size * elem_count;
|
||||
+ elt_offs = offs_store + i * src_row_length;
|
||||
+
|
||||
+ /* Iterate through the elements in each row to copy only those. */
|
||||
+ for (j = 1; j <= elem_count; j++)
|
||||
+ {
|
||||
+ /* Fetches the contents of ARRAY and copies them into V. */
|
||||
+ value_contents_copy (v, dst_offset, array, elt_offs, elt_size);
|
||||
+ elt_offs += elt_size * stride_length;
|
||||
+ dst_offset += elt_size;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/gdb/value.h b/gdb/value.h
|
||||
index 3400460..c18ef2e 100644
|
||||
--- a/gdb/value.h
|
||||
+++ b/gdb/value.h
|
||||
@@ -1056,7 +1056,7 @@ extern struct value *varying_to_slice (struct value *);
|
||||
|
||||
extern struct value *value_slice (struct value *, int, int);
|
||||
|
||||
-extern struct value *value_slice_1 (struct value *, int, int, int);
|
||||
+extern struct value *value_slice_1 (struct value *, int, int, int, int);
|
||||
|
||||
extern struct value *value_literal_complex (struct value *, struct value *,
|
||||
struct type *);
|
||||
--
|
||||
2.5.0
|
||||
|
@ -1,36 +0,0 @@
|
||||
--- gdb-7.10.50.20160106/gdb/testsuite/gdb.fortran/subrange.exp-orig 2016-01-08 22:45:44.956842553 +0100
|
||||
+++ gdb-7.10.50.20160106/gdb/testsuite/gdb.fortran/subrange.exp 2016-01-08 23:26:05.078554629 +0100
|
||||
@@ -39,27 +39,16 @@ foreach var {a alloc ptr} {
|
||||
set old_prefix $pf_prefix
|
||||
lappend pf_prefix "$var:"
|
||||
|
||||
- setup_kfail "*-*-*" "vlaregression/9999"
|
||||
gdb_test "p $var (2, 2:3)" { = \(22, 32\)}
|
||||
- setup_kfail "*-*-*" "vlaregression/9999"
|
||||
gdb_test "p $var (2:3, 3)" { = \(32, 33\)}
|
||||
- setup_kfail "*-*-*" "vlaregression/9999"
|
||||
gdb_test "p $var (1, 2:)" { = \(21, 31\)}
|
||||
- setup_kfail "*-*-*" "vlaregression/9999"
|
||||
gdb_test "p $var (2, :2)" { = \(12, 22\)}
|
||||
- setup_kfail "*-*-*" "vlaregression/9999"
|
||||
gdb_test "p $var (3, 2:2)" { = \(23\)}
|
||||
- setup_kfail "*-*-*" "vlaregression/9999"
|
||||
gdb_test "ptype $var (3, 2:2)" " = $int4 \\(2:2\\)"
|
||||
- setup_kfail "*-*-*" "vlaregression/9999"
|
||||
gdb_test "p $var (4, :)" { = \(14, 24, 34\)}
|
||||
- setup_kfail "*-*-*" "vlaregression/9999"
|
||||
gdb_test "p $var (:, :)" { = \(\( *11, 12, 13, 14\) \( *21, 22, 23, 24\) \( *31, 32, 33, 34\) *\)}
|
||||
- setup_kfail "*-*-*" "vlaregression/9999"
|
||||
gdb_test "ptype $var (:, :)" " = $int4 \\(4,3\\)"
|
||||
- setup_kfail "*-*-*" "vlaregression/9999"
|
||||
gdb_test "p $var (:)" "Wrong number of subscripts"
|
||||
- setup_kfail "*-*-*" "vlaregression/9999"
|
||||
gdb_test "p $var (:, :, :)" "Wrong number of subscripts"
|
||||
|
||||
set pf_prefix $old_prefix
|
||||
@@ -68,5 +57,4 @@ foreach var {a alloc ptr} {
|
||||
gdb_test_no_output {set $a=a}
|
||||
delete_breakpoints
|
||||
gdb_unload
|
||||
-setup_kfail "*-*-*" "vlaregression/9999"
|
||||
gdb_test {p $a (3, 2:2)} { = \(23\)}
|
@ -1,515 +0,0 @@
|
||||
http://sourceware.org/ml/gdb-patches/2016-02/msg00847.html
|
||||
Subject: [PATCH v2 6/6] fortran: test cases for subarray strides and slices
|
||||
|
||||
From: Christoph Weinmann <christoph.t.weinmann@intel.com>
|
||||
|
||||
Add test cases for subarray creation with range, literal and
|
||||
stride value permutations for one, two, and three dimensional
|
||||
arrays.
|
||||
|
||||
2013-12-04 Christoph Weinmann <christoph.t.weinmann@intel.com>
|
||||
|
||||
testsuite/gdb.fortran/
|
||||
* static-arrays.exp: New test.
|
||||
* static-arrays.f90: New file.
|
||||
|
||||
|
||||
Signed-off-by: Christoph Weinmann <christoph.t.weinmann@intel.com>
|
||||
---
|
||||
gdb/testsuite/gdb.fortran/static-arrays.exp | 421 ++++++++++++++++++++++++++++
|
||||
gdb/testsuite/gdb.fortran/static-arrays.f90 | 55 ++++
|
||||
2 files changed, 476 insertions(+)
|
||||
create mode 100644 gdb/testsuite/gdb.fortran/static-arrays.exp
|
||||
create mode 100644 gdb/testsuite/gdb.fortran/static-arrays.f90
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.fortran/static-arrays.exp b/gdb/testsuite/gdb.fortran/static-arrays.exp
|
||||
new file mode 100644
|
||||
index 0000000..cc9ecc0
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.fortran/static-arrays.exp
|
||||
@@ -0,0 +1,421 @@
|
||||
+# Copyright 2015 Free Software Foundation, Inc.
|
||||
+#
|
||||
+# Contributed by Intel Corp. <christoph.t.weinmann@intel.com>
|
||||
+#
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+standard_testfile static-arrays.f90
|
||||
+
|
||||
+if { [prepare_for_testing $testfile.exp $testfile $srcfile {debug f90}] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if ![runto MAIN__] then {
|
||||
+ perror "couldn't run to breakpoint MAIN__"
|
||||
+ continue
|
||||
+}
|
||||
+
|
||||
+gdb_breakpoint [gdb_get_line_number "BP1"]
|
||||
+gdb_continue_to_breakpoint "BP1" ".*BP1.*"
|
||||
+
|
||||
+# Tests subarrays of one dimensional arrays with subrange variations
|
||||
+gdb_test "print ar1" "\\$\[0-9\]+ = \\(1, 2, 3, 4, 5, 6, 7, 8, 9\\)" \
|
||||
+ "print ar1."
|
||||
+gdb_test "print ar1\(4:7\)" "\\$\[0-9\]+ = \\(4, 5, 6, 7\\)" \
|
||||
+ "print ar1\(4:7\)"
|
||||
+gdb_test "print ar1\(8:\)" "\\$\[0-9\]+ = \\(8, 9\\).*" \
|
||||
+ "print ar1\(8:\)"
|
||||
+gdb_test "print ar1\(:3\)" "\\$\[0-9\]+ = \\(1, 2, 3\\).*" \
|
||||
+ "print ar1\(:3\)"
|
||||
+gdb_test "print ar1\(:\)" "\\$\[0-9\]+ = \\(1, 2, 3, 4, 5, 6, 7, 8, 9\\)" \
|
||||
+ "print ar1\(:\)"
|
||||
+
|
||||
+# Check assignment
|
||||
+gdb_test_no_output "set \$my_ary = ar1\(3:8\)"
|
||||
+gdb_test "print \$my_ary" \
|
||||
+ "\\$\[0-9\]+ = \\(3, 4, 5, 6, 7, 8\\)" \
|
||||
+ "Assignment of subarray to variable"
|
||||
+gdb_test_no_output "set ar1\(5\) = 42"
|
||||
+ gdb_test "print ar1\(3:8\)" \
|
||||
+ "\\$\[0-9\]+ = \\(3, 4, 42, 6, 7, 8\\)" \
|
||||
+ "print ar1\(3:8\) after assignment"
|
||||
+gdb_test "print \$my_ary" \
|
||||
+ "\\$\[0-9\]+ = \\(3, 4, 5, 6, 7, 8\\)" \
|
||||
+ "Assignment of subarray to variable after original array changed"
|
||||
+
|
||||
+# Test for subarrays of one dimensional arrays with literals
|
||||
+ gdb_test "print ar1\(3\)" "\\$\[0-9\]+ = 3" \
|
||||
+ "print ar1\(3\)"
|
||||
+
|
||||
+# Tests for subranges of 2 dimensional arrays with subrange variations
|
||||
+gdb_test "print ar2\(2:3, 3:4\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( 23, 33\\) \\( 24, 34\\) \\)" \
|
||||
+ "print ar2\(2:3, 3:4\)."
|
||||
+gdb_test "print ar2\(8:9,8:\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( 88, 98\\) \\( 89, 99\\) \\)" \
|
||||
+ "print ar2\(8:9,8:\)"
|
||||
+gdb_test "print ar2\(8:9,:2\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( 81, 91\\) \\( 82, 92\\) \\)" \
|
||||
+ "print ar2\(8:9,:2\)"
|
||||
+
|
||||
+gdb_test "print ar2\(8:,8:9\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( 88, 98\\) \\( 89, 99\\) \\)" \
|
||||
+ "print ar2\(8:,8:9\)"
|
||||
+gdb_test "print ar2\(8:,8:\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( 88, 98\\) \\( 89, 99\\) \\)" \
|
||||
+ "print ar2\(8:,8:\)"
|
||||
+gdb_test "print ar2\(8:,:2\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( 81, 91\\) \\( 82, 92\\) \\)" \
|
||||
+ "print ar2\(8:,:2\)"
|
||||
+
|
||||
+gdb_test "print ar2\(:2,2:3\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( 12, 22\\) \\( 13, 23\\) \\)" \
|
||||
+ "print ar2\(:2,2:3\)"
|
||||
+gdb_test "print ar2\(:2,8:\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( 18, 28\\) \\( 19, 29\\) \\)" \
|
||||
+ "print ar2\(:2,8:\)"
|
||||
+gdb_test "print ar2\(:2,:2\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( 11, 21\\) \\( 12, 22\\) \\)" \
|
||||
+ "print ar2\(:2,:2\)"
|
||||
+
|
||||
+# Test subranges of 2 dimensional arrays with literals and subrange variations
|
||||
+gdb_test "print ar2\(7, 3:6\)" \
|
||||
+ "\\$\[0-9\]+ = \\(73, 74, 75, 76\\)" \
|
||||
+ "print ar2\(7, 3:6\)"
|
||||
+gdb_test "print ar2\(7,8:\)" \
|
||||
+ "\\$\[0-9\]+ = \\(78, 79\\)" \
|
||||
+ "print ar2\(7,8:\)"
|
||||
+gdb_test "print ar2\(7,:2\)" \
|
||||
+ "\\$\[0-9\]+ = \\(71, 72\\)" \
|
||||
+ "print ar2\(7,:2\)"
|
||||
+
|
||||
+gdb_test "print ar2\(7:8,4\)" \
|
||||
+ "\\$\[0-9\]+ = \\(74, 84\\)" \
|
||||
+ "print ar2(7:8,4\)"
|
||||
+gdb_test "print ar2\(8:,4\)" \
|
||||
+ "\\$\[0-9\]+ = \\(84, 94\\)" \
|
||||
+ "print ar2\(8:,4\)"
|
||||
+gdb_test "print ar2\(:2,4\)" \
|
||||
+ "\\$\[0-9\]+ = \\(14, 24\\)" \
|
||||
+ "print ar2\(:2,4\)"
|
||||
+gdb_test "print ar2\(3,4\)" \
|
||||
+ "\\$\[0-9\]+ = 34" \
|
||||
+ "print ar2\(3,4\)"
|
||||
+
|
||||
+# Test subarrays of 3 dimensional arrays with literals and subrange variations
|
||||
+gdb_test "print ar3\(2:4,3:4,7:8\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( \\( 237, 337, 437\\) \\( 247, 347, 447\\)\
|
||||
+ \\) \\( \\( 238, 338, 438\\) \\( 248, 348, 448\\) \\) \\)" \
|
||||
+ "print ar3\(2:4,3:4,7:8\)"
|
||||
+gdb_test "print ar3\(2:3,4:5,8:\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( \\( 248, 348\\) \\( 258, 358\\) \\) \\(\
|
||||
+ \\( 249, 349\\) \\( 259, 359\\) \\) \\)" \
|
||||
+ "print ar3\(2:3,4:5,8:\)"
|
||||
+gdb_test "print ar3\(2:3,4:5,:2\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( \\( 241, 341\\) \\( 251, 351\\) \\) \\(\
|
||||
+ \\( 242, 342\\) \\( 252, 352\\) \\) \\)" \
|
||||
+ "print ar3\(2:3,4:5,:2\)"
|
||||
+
|
||||
+gdb_test "print ar3\(2:3,8:,7:8\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( \\( 287, 387\\) \\( 297, 397\\) \\) \\(\
|
||||
+ \\( 288, 388\\) \\( 298, 398\\) \\) \\)" \
|
||||
+ "print ar3\(2:3,8:,7:8\)"
|
||||
+gdb_test "print ar3\(2:3,8:,8:\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( \\( 288, 388\\) \\( 298, 398\\) \\) \\(\
|
||||
+ \\( 289, 389\\) \\( 299, 399\\) \\) \\)" \
|
||||
+ "print ar3\(2:3,8:,8:\)"
|
||||
+gdb_test "print ar3\(2:3,8:,:2\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( \\( 281, 381\\) \\( 291, 391\\) \\) \\(\
|
||||
+ \\( 282, 382\\) \\( 292, 392\\) \\) \\)" \
|
||||
+ "print ar3\(2:3,8:,:2\)"
|
||||
+
|
||||
+gdb_test "print ar3\(2:3,:2,7:8\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( \\( 217, 317\\) \\( 227, 327\\) \\) \\(\
|
||||
+ \\( 218, 318\\) \\( 228, 328\\) \\) \\)" \
|
||||
+ "print ar3\(2:3,:2,7:8\)"
|
||||
+gdb_test "print ar3\(2:3,:2,8:\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( \\( 218, 318\\) \\( 228, 328\\) \\) \\(\
|
||||
+ \\( 219, 319\\) \\( 229, 329\\) \\) \\)" \
|
||||
+ "print ar3\(2:3,:2,8:\)"
|
||||
+gdb_test "print ar3\(2:3,:2,:2\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( \\( 211, 311\\) \\( 221, 321\\) \\) \\(\
|
||||
+ \\( 212, 312\\) \\( 222, 322\\) \\) \\)" \
|
||||
+ "print ar3\(2:3,:2,:2\)"
|
||||
+
|
||||
+gdb_test "print ar3\(8:,3:4,7:8\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( \\( 837, 937\\) \\( 847, 947\\) \\) \\(\
|
||||
+ \\( 838, 938\\) \\( 848, 948\\) \\) \\)" \
|
||||
+ "print ar3\(8:,3:4,7:8\)"
|
||||
+gdb_test "print ar3\(8:,4:5,8:\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( \\( 848, 948\\) \\( 858, 958\\) \\) \\(\
|
||||
+ \\( 849, 949\\) \\( 859, 959\\) \\) \\)" \
|
||||
+ "print ar3\(8:,4:5,8:\)"
|
||||
+gdb_test "print ar3\(8:,4:5,:2\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( \\( 841, 941\\) \\( 851, 951\\) \\) \\(\
|
||||
+ \\( 842, 942\\) \\( 852, 952\\) \\) \\)" \
|
||||
+ "print ar3\(8:,4:5,:2\)"
|
||||
+
|
||||
+gdb_test "print ar3\(8:,8:,7:8\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( \\( 887, 987\\) \\( 897, 997\\) \\) \\(\
|
||||
+ \\( 888, 988\\) \\( 898, 998\\) \\) \\)" \
|
||||
+ "print ar3\(8:,8:,7:8\)"
|
||||
+gdb_test "print ar3\(8:,8:,8:\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( \\( 888, 988\\) \\( 898, 998\\) \\) \\(\
|
||||
+ \\( 889, 989\\) \\( 899, 999\\) \\) \\)" \
|
||||
+ "print ar3\(8:,8:,8:\)"
|
||||
+gdb_test "print ar3\(8:,8:,:2\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( \\( 881, 981\\) \\( 891, 991\\) \\) \\(\
|
||||
+ \\( 882, 982\\) \\( 892, 992\\) \\) \\)" \
|
||||
+ "print ar3\(8:,8:,:2\)"
|
||||
+
|
||||
+gdb_test "print ar3\(8:,:2,7:8\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( \\( 817, 917\\) \\( 827, 927\\) \\) \\(\
|
||||
+ \\( 818, 918\\) \\( 828, 928\\) \\) \\)" \
|
||||
+ "print ar3\(8:,:2,7:8\)"
|
||||
+gdb_test "print ar3\(8:,:2,8:\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( \\( 818, 918\\) \\( 828, 928\\) \\) \\(\
|
||||
+ \\( 819, 919\\) \\( 829, 929\\) \\) \\)" \
|
||||
+ "print ar3\(8:,:2,8:\)"
|
||||
+gdb_test "print ar3\(8:,:2,:2\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( \\( 811, 911\\) \\( 821, 921\\) \\) \\(\
|
||||
+ \\( 812, 912\\) \\( 822, 922\\) \\) \\)" \
|
||||
+ "print ar3\(8:,:2,:2\)"
|
||||
+
|
||||
+
|
||||
+gdb_test "print ar3\(:2,3:4,7:8\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( \\( 137, 237\\) \\( 147, 247\\) \\) \\(\
|
||||
+ \\( 138, 238\\) \\( 148, 248\\) \\) \\)" \
|
||||
+ "print ar3 \(:2,3:4,7:8\)."
|
||||
+gdb_test "print ar3\(:2,3:4,8:\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( \\( 138, 238\\) \\( 148, 248\\) \\) \\(\
|
||||
+ \\( 139, 239\\) \\( 149, 249\\) \\) \\)" \
|
||||
+ "print ar3\(:2,3:4,8:\)"
|
||||
+gdb_test "print ar3\(:2,3:4,:2\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( \\( 131, 231\\) \\( 141, 241\\) \\) \\(\
|
||||
+ \\( 132, 232\\) \\( 142, 242\\) \\) \\)" \
|
||||
+ "print ar3\(:2,3:4,:2\)"
|
||||
+
|
||||
+gdb_test "print ar3\(:2,8:,7:8\)" "\\$\[0-9\]+ = \\(\\( \\( 187, 287\\) \\(\
|
||||
+ 197, 297\\) \\) \\( \\( 188, 288\\) \\( 198, 298\\) \\) \\)" \
|
||||
+ "print ar3\(:2,8:,7:8\)"
|
||||
+gdb_test "print ar3\(:2,8:,8:\)" "\\$\[0-9\]+ = \\(\\( \\( 188, 288\\) \\( 198,\
|
||||
+ 298\\) \\) \\( \\( 189, 289\\) \\( 199, 299\\) \\) \\)" \
|
||||
+ "print ar3\(:2,8:,8:\)"
|
||||
+gdb_test "print ar3\(:2,8:,:2\)" "\\$\[0-9\]+ = \\(\\( \\( 181, 281\\) \\( 191,\
|
||||
+ 291\\) \\) \\( \\( 182, 282\\) \\( 192, 292\\) \\) \\)" \
|
||||
+ "print ar3\(:2,8:,:2\)"
|
||||
+
|
||||
+gdb_test "print ar3\(:2,:2,7:8\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( \\( 117, 217\\) \\( 127, 227\\) \\) \\(\
|
||||
+ \\( 118, 218\\) \\( 128, 228\\) \\) \\)" \
|
||||
+ "print ar3\(:2,:2,7:8\)"
|
||||
+gdb_test "print ar3\(:2,:2,8:\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( \\( 118, 218\\) \\( 128, 228\\) \\) \\(\
|
||||
+ \\( 119, 219\\) \\( 129, 229\\) \\) \\)" \
|
||||
+ "print ar3\(:2,:2,8:\)"
|
||||
+gdb_test "print ar3\(:2,:2,:2\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( \\( 111, 211\\) \\( 121, 221\\) \\) \\(\
|
||||
+ \\( 112, 212\\) \\( 122, 222\\) \\) \\)" \
|
||||
+ "print ar3\(:2,:2,:2\)"
|
||||
+
|
||||
+#Tests for subarrays of 3 dimensional arrays with literals and subranges
|
||||
+gdb_test "print ar3\(3,3:4,7:8\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( 337, 347\\) \\( 338, 348\\) \\)" \
|
||||
+ "print ar3\(3,3:4,7:8\)"
|
||||
+gdb_test "print ar3\(3,4:5,8:\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( 348, 358\\) \\( 349, 359\\) \\)" \
|
||||
+ "print ar3\(3,4:5,8:\)"
|
||||
+gdb_test "print ar3\(3,4:5,:2\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( 341, 351\\) \\( 342, 352\\) \\)" \
|
||||
+ "print ar3\(3,4:5,:2\)"
|
||||
+gdb_test "print ar3\(3,4:5,3\)" \
|
||||
+ "\\$\[0-9\]+ = \\(343, 353\\)" \
|
||||
+ "print ar3\(3,4:5,3\)"
|
||||
+
|
||||
+gdb_test "print ar3\(2,8:,7:8\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( 287, 297\\) \\( 288, 298\\) \\)" \
|
||||
+ "print ar3\(2,8:,7:8\)"
|
||||
+gdb_test "print ar3\(2,8:,8:\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( 288, 298\\) \\( 289, 299\\) \\)" \
|
||||
+ "print ar3\(2,8:,8:\)"
|
||||
+gdb_test "print ar3\(2,8:,:2\)"\
|
||||
+ "\\$\[0-9\]+ = \\(\\( 281, 291\\) \\( 282, 292\\) \\)" \
|
||||
+ "print ar3\(2,8:,:2\)"
|
||||
+gdb_test "print ar3\(2,8:,3\)" \
|
||||
+ "\\$\[0-9\]+ = \\(283, 293\\)" \
|
||||
+ "print ar3\(2,8:,3\)"
|
||||
+
|
||||
+gdb_test "print ar3\(2,:2,7:8\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( 217, 227\\) \\( 218, 228\\) \\)" \
|
||||
+ "print ar3\(2,:2,7:8\)"
|
||||
+gdb_test "print ar3\(2,:2,8:\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( 218, 228\\) \\( 219, 229\\) \\)" \
|
||||
+ "print ar3\(2,:2,8:\)"
|
||||
+gdb_test "print ar3\(2,:2,:2\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( 211, 221\\) \\( 212, 222\\) \\)" \
|
||||
+ "print ar3\(2,:2,:2\)"
|
||||
+gdb_test "print ar3\(2,:2,3\)" \
|
||||
+ "\\$\[0-9\]+ = \\(213, 223\\)" \
|
||||
+ "print ar3\(2,:2,3\)"
|
||||
+
|
||||
+gdb_test "print ar3\(3,4,7:8\)" \
|
||||
+ "\\$\[0-9\]+ = \\(347, 348\\)" \
|
||||
+ "print ar3\(3,4,7:8\)"
|
||||
+gdb_test "print ar3\(3,4,8:\)" \
|
||||
+ "\\$\[0-9\]+ = \\(348, 349\\)" \
|
||||
+i "print ar3\(3,4,8:\)"
|
||||
+gdb_test "print ar3\(3,4,:2\)" \
|
||||
+ "\\$\[0-9\]+ = \\(341, 342\\)" \
|
||||
+ "print ar3\(3,4,:2\)"
|
||||
+gdb_test "print ar3\(5,6,7\)" \
|
||||
+ "\\$\[0-9\]+ = 567" \
|
||||
+ "print ar3\(5,6,7\)"
|
||||
+
|
||||
+gdb_test "print ar3\(3:4,6,7:8\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( 367, 467\\) \\( 368, 468\\) \\)" \
|
||||
+ "print ar3\(3:4,6,7:8\)"
|
||||
+gdb_test "print ar3\(3:4,6,8:\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( 368, 468\\) \\( 369, 469\\) \\)" \
|
||||
+ "print ar3\(3:4,6,8:\)"
|
||||
+gdb_test "print ar3\(3:4,6,:2\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( 361, 461\\) \\( 362, 462\\) \\)" \
|
||||
+ "print ar3\(3:4,6,:2\)"
|
||||
+gdb_test "print ar3\(3:4,6,5\)" \
|
||||
+ "\\$\[0-9\]+ = \\(365, 465\\)" \
|
||||
+ "print ar3\(3:4,6,5\)"
|
||||
+
|
||||
+gdb_test "print ar3\(8:,6,7:8\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( 867, 967\\) \\( 868, 968\\) \\)" \
|
||||
+ "print ar3\(8:,6,7:8\)"
|
||||
+gdb_test "print ar3\(8:,6,8:\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( 868, 968\\) \\( 869, 969\\) \\)" \
|
||||
+ "print ar3\(8:,6,8:\)"
|
||||
+gdb_test "print ar3\(8:,6,:2\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( 861, 961\\) \\( 862, 962\\) \\)" \
|
||||
+ "print ar3\(8:,6,:2\)"
|
||||
+gdb_test "print ar3\(8:,6,5\)" \
|
||||
+ "\\$\[0-9\]+ = \\(865, 965\\)" \
|
||||
+ "print ar3\(8:,6,5\)"
|
||||
+
|
||||
+gdb_test "print ar3\(:2,6,7:8\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( 167, 267\\) \\( 168, 268\\) \\)" \
|
||||
+ "print ar3\(:2,6,7:8\)"
|
||||
+gdb_test "print ar3\(:2,6,8:\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( 168, 268\\) \\( 169, 269\\) \\)" \
|
||||
+ "print ar3\(:2,6,8:\)"
|
||||
+gdb_test "print ar3\(:2,6,:2\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( 161, 261\\) \\( 162, 262\\) \\)" \
|
||||
+ "print ar3\(:2,6,:2\)"
|
||||
+gdb_test "print ar3\(:2,6,5\)" \
|
||||
+ "\\$\[0-9\]+ = \\(165, 265\\)" \
|
||||
+ "print ar3\(:2,6,5\)"
|
||||
+
|
||||
+gdb_test "print ar3\(3:4,5:6,4\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( 354, 454\\) \\( 364, 464\\) \\)" \
|
||||
+ "print ar2\(3:4,5:6,4\)"
|
||||
+gdb_test "print ar3\(8:,5:6,4\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( 854, 954\\) \\( 864, 964\\) \\)" \
|
||||
+ "print ar2\(8:,5:6,4\)"
|
||||
+gdb_test "print ar3\(:2,5:6,4\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( 154, 254\\) \\( 164, 264\\) \\)" \
|
||||
+ "print ar2\(:2,5:6,4\)"
|
||||
+
|
||||
+# Stride > 1
|
||||
+gdb_test "print ar1\(2:6:2\)" \
|
||||
+ "\\$\[0-9\]+ = \\(2, 4, 6\\)" \
|
||||
+ "print ar1\(2:6:2\)"
|
||||
+gdb_test "print ar2\(2:6:2,3:4\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( 23, 43, 63\\) \\( 24, 44, 64\\) \\)" \
|
||||
+ "print ar2\(2:6:2,3:4\)"
|
||||
+gdb_test "print ar2\(2:6:2,3\)" \
|
||||
+ "\\$\[0-9\]+ = \\(23, 43, 63\\)" \
|
||||
+ "print ar2\(2:6:2,3\)"
|
||||
+gdb_test "print ar3\(2:6:2,3:5:2,4:7:3\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( \\( 234, 434, 634\\) \\( 254, 454, 654\\)\
|
||||
+ \\) \\( \\( 237, 437, 637\\) \\( 257, 457, 657\\) \\) \\)" \
|
||||
+ "print ar3\(2:6:2,3:5:2,4:7:3\)"
|
||||
+gdb_test "print ar3\(2:6:2,5,4:7:3\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( 254, 454, 654\\) \\( 257, 457, 657\\)\
|
||||
+ \\)" \
|
||||
+ "print ar3\(2:6:2,5,4:7:3\)"
|
||||
+
|
||||
+# Stride < 0
|
||||
+gdb_test "print ar1\(8:2:-2\)" \
|
||||
+ "\\$\[0-9\]+ = \\(8, 6, 4, 2\\)" \
|
||||
+ "print ar1\(8:2:-2\)"
|
||||
+gdb_test "print ar2\(8:2:-2,3:4\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( 83, 63, 43, 23\\) \\( 84, 64, 44, 24\\)\
|
||||
+ \\)" \
|
||||
+ "print ar2\(8:2:-2,3:4\)"
|
||||
+gdb_test "print ar2\(2:6:2,3\)" \
|
||||
+ "\\$\[0-9\]+ = \\(23, 43, 63\\)" \
|
||||
+ "print ar2\(2:6:2,3\)"
|
||||
+gdb_test "print ar3\(2:3,7:3:-4,4:7:3\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( \\( 274, 374\\) \\( 234, 334\\) \\) \\(\
|
||||
+ \\( 277, 377\\) \\( 237, 337\\) \\) \\)" \
|
||||
+ "print ar3\(2:3,7:3:-4,4:7:3\)"
|
||||
+gdb_test "print ar3\(2:6:2,5,7:4:-3\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( 257, 457, 657\\) \\( 254, 454, 654\\)\
|
||||
+ \\)" \
|
||||
+ "print ar3\(2:6:2,5,7:4:-3\)"
|
||||
+
|
||||
+# Tests with negative and mixed indices
|
||||
+gdb_test "p ar4\(2:4, -2:1, -15:-14\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( \\( 261, 361, 461\\) \\( 271, 371, 471\\)\
|
||||
+ \\( 281, 381, 481\\) \\( 291, 391, 491\\) \\) \\( \\( 262,\
|
||||
+ 362, 462\\) \\( 272, 372, 472\\) \\( 282, 382, 482\\) \\( 292,\
|
||||
+ 392, 492\\) \\) \\)" \
|
||||
+ "print ar4(2:4, -2:1, -15:-14)"
|
||||
+
|
||||
+gdb_test "p ar4\(7,-6:2:3,-7\)" \
|
||||
+ "\\$\[0-9\]+ = \\(729, 759, 789\\)" \
|
||||
+ "print ar4(7,-6:2:3,-7)"
|
||||
+
|
||||
+gdb_test "p ar4\(9:2:-2, -6:2:3, -6:-15:-3\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( \\( 930, 730, 530, 330\\) \\( 960, 760,\
|
||||
+ 560, 360\\) \\( 990, 790, 590, 390\\) \\) \\( \\( 927, 727,\
|
||||
+ 527, 327\\) \\( 957, 757, 557, 357\\) \\( 987, 787, 587,\
|
||||
+ 387\\) \\) \\( \\( 924, 724, 524, 324\\) \\( 954, 754, 554,\
|
||||
+ 354\\) \\( 984, 784, 584, 384\\) \\) \\( \\( 921, 721, 521,\
|
||||
+ 321\\) \\( 951, 751, 551, 351\\) \\( 981, 781, 581, 381\\) \\)\
|
||||
+ \\)" \
|
||||
+ "print ar4(9:2:-2, -6:2:3, -6:-15:-3)"
|
||||
+
|
||||
+gdb_test "p ar4\(:,:,:\)" \
|
||||
+ "\\$\[0-9\]+ = \\(\\( \\( 111, 211, 311, 411, 511, 611, 711,\
|
||||
+ 811, .*" \
|
||||
+ "print ar4(:,:,:)"
|
||||
+
|
||||
+# Provoke error messages for bad user input
|
||||
+gdb_test "print ar1\(0:4\)" \
|
||||
+ "provided bound\\(s\\) outside array bound\\(s\\)" \
|
||||
+ "print ar1\(0:4\)"
|
||||
+gdb_test "print ar1\(8:12\)" \
|
||||
+ "provided bound\\(s\\) outside array bound\\(s\\)" \
|
||||
+ "print ar1\(8:12\)"
|
||||
+gdb_test "print ar1\(8:2:\)" \
|
||||
+ "A syntax error in expression, near `\\)'." \
|
||||
+ "print ar1\(8:2:\)"
|
||||
+gdb_test "print ar1\(8:2:2\)" \
|
||||
+ "Wrong value provided for stride and boundaries" \
|
||||
+ "print ar1\(8:2:2\)"
|
||||
+gdb_test "print ar1\(2:8:-2\)" \
|
||||
+ "Wrong value provided for stride and boundaries" \
|
||||
+ "print ar1\(2:8:-2\)"
|
||||
+gdb_test "print ar1\(2:7:0\)" \
|
||||
+ "Stride must not be 0" \
|
||||
+ "print ar1\(2:7:0\)"
|
||||
+gdb_test "print ar1\(3:7\) = 42" \
|
||||
+ "Invalid cast." \
|
||||
+ "Assignment of value to subarray"
|
||||
diff --git a/gdb/testsuite/gdb.fortran/static-arrays.f90 b/gdb/testsuite/gdb.fortran/static-arrays.f90
|
||||
new file mode 100644
|
||||
index 0000000..f22fcbe
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.fortran/static-arrays.f90
|
||||
@@ -0,0 +1,55 @@
|
||||
+! Copyright 2015 Free Software Foundation, Inc.
|
||||
+!
|
||||
+! Contributed by Intel Corp. <christoph.t.weinmann@intel.com>
|
||||
+!
|
||||
+! This program is free software; you can redistribute it and/or modify
|
||||
+! it under the terms of the GNU General Public License as published by
|
||||
+! the Free Software Foundation; either version 3 of the License, or
|
||||
+! (at your option) any later version.
|
||||
+!
|
||||
+! This program is distributed in the hope that it will be useful,
|
||||
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+! GNU General Public License for more details.
|
||||
+!
|
||||
+! You should have received a copy of the GNU General Public License
|
||||
+! along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+subroutine sub
|
||||
+ integer, dimension(9) :: ar1
|
||||
+ integer, dimension(9,9) :: ar2
|
||||
+ integer, dimension(9,9,9) :: ar3
|
||||
+ integer, dimension(10,-7:3, -15:-5) :: ar4
|
||||
+ integer :: i,j,k
|
||||
+
|
||||
+ ar1 = 1
|
||||
+ ar2 = 1
|
||||
+ ar3 = 1
|
||||
+ ar4 = 4
|
||||
+
|
||||
+ ! Resulting array ar3 looks like ((( 111, 112, 113, 114,...)))
|
||||
+ do i = 1, 9, 1
|
||||
+ ar1(i) = i
|
||||
+ do j = 1, 9, 1
|
||||
+ ar2(i,j) = i*10 + j
|
||||
+ do k = 1, 9, 1
|
||||
+ ar3(i,j,k) = i*100 + j*10 + k
|
||||
+ end do
|
||||
+ end do
|
||||
+ end do
|
||||
+
|
||||
+ do i = 1, 10, 1
|
||||
+ do j = -7, 3, 1
|
||||
+ do k = -15, -5, 1
|
||||
+ ar4(i,j,k) = i*100 + (j+8)*10 + (k+16)
|
||||
+ end do
|
||||
+ end do
|
||||
+ end do
|
||||
+
|
||||
+ ar1(1) = 11 !BP1
|
||||
+ return
|
||||
+end
|
||||
+
|
||||
+program testprog
|
||||
+ call sub
|
||||
+end
|
||||
--
|
||||
2.5.0
|
||||
|
@ -1,68 +0,0 @@
|
||||
http://sourceware.org/ml/gdb-patches/2016-04/msg00181.html
|
||||
Subject: [testsuite patch] Fix 7.11 regression: gdb.dwarf2/dw2-undefined-ret-addr.exp [now with the patch]
|
||||
|
||||
|
||||
--oyUTqETQ0mS9luUI
|
||||
Content-Type: text/plain; charset=us-ascii
|
||||
Content-Disposition: inline
|
||||
|
||||
Hi,
|
||||
|
||||
a038fa3e14a477d4d72a26c2e139fa47d2774be2 is the first bad commit
|
||||
commit a038fa3e14a477d4d72a26c2e139fa47d2774be2
|
||||
Author: Markus Metzger <markus.t.metzger@intel.com>
|
||||
stack: check frame_unwind_caller_id
|
||||
[PATCH v3 2/3] stack: check frame_unwind_caller_id
|
||||
https://sourceware.org/ml/gdb-patches/2016-02/msg00363.html
|
||||
Message-Id: <1455207283-12660-2-git-send-email-markus.t.metzger@intel.com>
|
||||
|
||||
(gdb) PASS: gdb.dwarf2/dw2-undefined-ret-addr.exp: up refuses to go up
|
||||
info frame
|
||||
Stack level 0, frame at 0x0:
|
||||
- rip = 0x40059a in stop_frame (dw2-undefined-ret-addr.c:22); saved rip = <not saved>
|
||||
+ rip = 0x40059a in stop_frame (dw2-undefined-ret-addr.c:22); saved rip = <unavailable>
|
||||
Outermost frame: outermost
|
||||
source language c.
|
||||
Arglist at 0x7fffffffd610, args:
|
||||
Locals at 0x7fffffffd610, Previous frame's sp is 0x7fffffffd620
|
||||
Saved registers:
|
||||
rbp at 0x7fffffffd610
|
||||
-(gdb) PASS: gdb.dwarf2/dw2-undefined-ret-addr.exp: info frame
|
||||
+(gdb) FAIL: gdb.dwarf2/dw2-undefined-ret-addr.exp: info frame
|
||||
|
||||
It happens on normal native Fedora 23 x86_64.
|
||||
|
||||
I am not completely sure about the reasons but it looks to me GDB behavior has
|
||||
just changed.
|
||||
|
||||
OK for check-in?
|
||||
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
--oyUTqETQ0mS9luUI
|
||||
Content-Type: text/plain; charset=us-ascii
|
||||
Content-Disposition: inline; filename=1
|
||||
|
||||
gdb/testsuite/ChangeLog
|
||||
2016-04-08 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.dwarf2/dw2-undefined-ret-addr.exp: Expect <unavailable>.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-undefined-ret-addr.exp b/gdb/testsuite/gdb.dwarf2/dw2-undefined-ret-addr.exp
|
||||
index c666584..e43054b 100644
|
||||
--- a/gdb/testsuite/gdb.dwarf2/dw2-undefined-ret-addr.exp
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/dw2-undefined-ret-addr.exp
|
||||
@@ -48,7 +48,7 @@ gdb_test "up" \
|
||||
# doesn't cause an error, and shows "<not saved>".
|
||||
gdb_test "info frame" [multi_line \
|
||||
"Stack level 0, frame at $hex\:" \
|
||||
- " rip = $hex in stop_frame \\(dw2-undefined-ret-addr\\.c:22\\); saved rip = <not saved>" \
|
||||
+ " rip = $hex in stop_frame \\(dw2-undefined-ret-addr\\.c:22\\); saved rip = <unavailable>" \
|
||||
" Outermost frame: outermost" \
|
||||
" source language c\\." \
|
||||
" Arglist at $hex, args\: " \
|
||||
|
||||
--oyUTqETQ0mS9luUI--
|
||||
|
@ -1,42 +0,0 @@
|
||||
Re: [PATCH 04/23] vla: make dynamic fortran arrays functional.
|
||||
https://sourceware.org/ml/gdb-patches/2014-06/msg00570.html
|
||||
|
||||
Index: gdb-7.10.50.20151027/gdb/valarith.c
|
||||
===================================================================
|
||||
--- gdb-7.10.50.20151027.orig/gdb/valarith.c 2015-11-03 20:41:48.543504999 +0100
|
||||
+++ gdb-7.10.50.20151027/gdb/valarith.c 2015-11-03 20:46:36.995238888 +0100
|
||||
@@ -193,10 +193,17 @@ value_subscripted_rvalue (struct value *
|
||||
struct type *array_type = check_typedef (value_type (array));
|
||||
struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (array_type));
|
||||
unsigned int elt_size = type_length_units (elt_type);
|
||||
- unsigned int elt_offs = longest_to_int (index - lowerbound);
|
||||
+ unsigned int elt_offs;
|
||||
LONGEST elt_stride = TYPE_BYTE_STRIDE (TYPE_INDEX_TYPE (array_type));
|
||||
struct value *v;
|
||||
|
||||
+ if (TYPE_NOT_ASSOCIATED (array_type))
|
||||
+ error (_("no such vector element (vector not associated)"));
|
||||
+ if (TYPE_NOT_ALLOCATED (array_type))
|
||||
+ error (_("no such vector element (vector not allocated)"));
|
||||
+
|
||||
+ elt_offs = longest_to_int (index - lowerbound);
|
||||
+
|
||||
if (elt_stride > 0)
|
||||
elt_offs *= elt_stride;
|
||||
else if (elt_stride < 0)
|
||||
@@ -210,14 +217,7 @@ value_subscripted_rvalue (struct value *
|
||||
|
||||
if (index < lowerbound || (!TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type)
|
||||
&& elt_offs >= type_length_units (array_type)))
|
||||
- {
|
||||
- if (type_not_associated (array_type))
|
||||
- error (_("no such vector element (vector not associated)"));
|
||||
- else if (type_not_allocated (array_type))
|
||||
- error (_("no such vector element (vector not allocated)"));
|
||||
- else
|
||||
- error (_("no such vector element"));
|
||||
- }
|
||||
+ error (_("no such vector element"));
|
||||
|
||||
if (VALUE_LVAL (array) == lval_memory && value_lazy (array))
|
||||
v = allocate_value_lazy (elt_type);
|
@ -1,11 +0,0 @@
|
||||
--- ./gdb/value.c-orig 2015-02-11 15:17:58.413241779 +0100
|
||||
+++ ./gdb/value.c 2015-02-11 15:19:42.068716949 +0100
|
||||
@@ -3074,7 +3074,7 @@ value_primitive_field (struct value *arg
|
||||
}
|
||||
|
||||
if (!TYPE_DATA_LOCATION (type)
|
||||
- || !TYPE_DATA_LOCATION_KIND (type) == PROP_CONST)
|
||||
+ || TYPE_DATA_LOCATION_KIND (type) != PROP_CONST)
|
||||
v->offset = (value_offset (arg1) + offset
|
||||
+ value_embedded_offset (arg1));
|
||||
}
|
1480
gdb-vla-intel.patch
1480
gdb-vla-intel.patch
File diff suppressed because it is too large
Load Diff
64
gdb.changes
64
gdb.changes
@ -14,32 +14,46 @@ Wed Feb 15 15:55:11 UTC 2017 - matz@suse.com
|
||||
- new-ui: create new user interface for GUI clients
|
||||
* (fast) tracepoints on s390x and ppc64le added to gdbserver
|
||||
* New target Andes NDS32
|
||||
- Remove patch gdb-aarch64-v81-hwbreakpoints.diff (upstream)
|
||||
- Remove obsolete patches:
|
||||
gdb-aarch64-v81-hwbreakpoints.diff
|
||||
gdb-bare-DW_TAG_lexical_block-1of2.patch
|
||||
gdb-bare-DW_TAG_lexical_block-2of2.patch
|
||||
gdb-fortran-stride-intel-1of6.patch
|
||||
gdb-fortran-stride-intel-2of6.patch
|
||||
gdb-fortran-stride-intel-3of6.patch
|
||||
gdb-fortran-stride-intel-4of6.patch
|
||||
gdb-fortran-stride-intel-5of6.patch
|
||||
gdb-fortran-stride-intel-6of6-nokfail.patch
|
||||
gdb-fortran-stride-intel-6of6.patch
|
||||
gdb-testsuite-dw2-undefined-ret-addr.patch
|
||||
gdb-vla-intel-04of23-fix.patch
|
||||
gdb-vla-intel-logical-not.patch
|
||||
gdb-vla-intel.patch
|
||||
- Add patches from Fedora package:
|
||||
gdb-6.7-testsuite-stable-results.patch
|
||||
gdb-add-index-chmod.patch
|
||||
gdb-bison-old.patch
|
||||
gdb-container-rh-pkg.patch
|
||||
gdb-libexec-add-index.patch
|
||||
gdb-linux_perf-bundle.patch
|
||||
gdb-physname-pr11734-test.patch
|
||||
gdb-physname-pr12273-test.patch
|
||||
gdb-rhbz1007614-memleak-infpy_read_memory-test.patch
|
||||
gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch
|
||||
gdb-rhbz1149205-catch-syscall-after-fork-test.patch
|
||||
gdb-rhbz1156192-recursive-dlopen-test.patch
|
||||
gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch
|
||||
gdb-rhbz1350436-type-printers-error.patch
|
||||
gdb-test-ivy-bridge.patch
|
||||
gdb-testsuite-casts.patch
|
||||
gdb-testsuite-m-static.patch
|
||||
gdb-testsuite-morestack-gold.patch
|
||||
gdb-tls-1of2.patch
|
||||
gdb-tls-2of2.patch
|
||||
gdb-upstream.patch
|
||||
gdb-vla-intel-fortran-strides.patch
|
||||
gdb-vla-intel-fortran-vla-strings.patch
|
||||
gdb-vla-intel-tests.patch
|
||||
gdb-6.7-testsuite-stable-results.patch
|
||||
gdb-add-index-chmod.patch
|
||||
gdb-bison-old.patch
|
||||
gdb-container-rh-pkg.patch
|
||||
gdb-libexec-add-index.patch
|
||||
gdb-linux_perf-bundle.patch
|
||||
gdb-physname-pr11734-test.patch
|
||||
gdb-physname-pr12273-test.patch
|
||||
gdb-rhbz1007614-memleak-infpy_read_memory-test.patch
|
||||
gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch
|
||||
gdb-rhbz1149205-catch-syscall-after-fork-test.patch
|
||||
gdb-rhbz1156192-recursive-dlopen-test.patch
|
||||
gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch
|
||||
gdb-rhbz1350436-type-printers-error.patch
|
||||
gdb-test-ivy-bridge.patch
|
||||
gdb-testsuite-casts.patch
|
||||
gdb-testsuite-m-static.patch
|
||||
gdb-testsuite-morestack-gold.patch
|
||||
gdb-tls-1of2.patch
|
||||
gdb-tls-2of2.patch
|
||||
gdb-upstream.patch
|
||||
gdb-vla-intel-fortran-strides.patch
|
||||
gdb-vla-intel-fortran-vla-strings.patch
|
||||
gdb-vla-intel-tests.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Jan 9 15:37:41 UTC 2017 - matz@suse.com
|
||||
|
Loading…
x
Reference in New Issue
Block a user