From 15e4b038571219f458550defab5788f83813e8bc Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: May 03 2018 04:13:36 +0000 Subject: import devtoolset-7-gdb-8.0.1-36.el7 --- diff --git a/SOURCES/gdb-6.3-readnever-20050907.patch b/SOURCES/gdb-6.3-readnever-20050907.patch index 4ce26c0..ef0d18f 100644 --- a/SOURCES/gdb-6.3-readnever-20050907.patch +++ b/SOURCES/gdb-6.3-readnever-20050907.patch @@ -94,3 +94,14 @@ Index: gdb-7.99.90.20170420/gdb/top.h /* Perform _initialize initialization. */ extern void gdb_init (char *); +--- gdb-8.0.1/gdb/gcore.in-orig 2017-06-04 17:51:26.000000000 +0200 ++++ gdb-8.0.1/gdb/gcore.in 2017-09-28 19:46:49.335407827 +0200 +@@ -85,7 +85,7 @@ for pid in $* + do + # ` +To: gdb-patches at sourceware dot org +Subject: [PATCH] Fix GCC PR83906 - [8 Regression] Random FAIL: libstdc++-prettyprinters/80276.cc whatis p4 +Date: Wed, 24 Jan 2018 17:27:22 +0000 +Message-Id: <20180124172722.31553-1-palves@redhat.com> + +GCC PR83906 [1] is about a GCC/libstdc++ GDB/Python type printer +testcase failing randomly, as shown by running (in libstdc++'s +testsuite): + + make check RUNTESTFLAGS=prettyprinters.exp=80276.cc + +in a loop. Sometimes you get this: + + FAIL: libstdc++-prettyprinters/80276.cc whatis p4 + +I.e., this: + type = std::unique_ptr, std::allocator >>[]>>[99]> + +instead of this: + type = std::unique_ptr[]>>[99]> + +Jonathan Wakely tracked it on the printer side to this bit in +libstdc++'s type printer: + + if self.type_obj == type_obj: + return strip_inline_namespaces(self.name) + +This assumes the two types resolve to the same gdb.Type but some times +the comparison unexpectedly fails. + +Running the testcase manually under Valgrind finds the problem in GDB: + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ==6118== Conditional jump or move depends on uninitialised value(s) + ==6118== at 0x4C35CB0: bcmp (vg_replace_strmem.c:1100) + ==6118== by 0x6F773A: check_types_equal(type*, type*, VEC_type_equality_entry_d**) (gdbtypes.c:3515) + ==6118== by 0x6F7B00: check_types_worklist(VEC_type_equality_entry_d**, bcache*) (gdbtypes.c:3618) + ==6118== by 0x6F7C03: types_deeply_equal(type*, type*) (gdbtypes.c:3655) + ==6118== by 0x4D5B06: typy_richcompare(_object*, _object*, int) (py-type.c:1007) + ==6118== by 0x63D7E6C: PyObject_RichCompare (object.c:961) + ==6118== by 0x646EAEC: PyEval_EvalFrameEx (ceval.c:4960) + ==6118== by 0x646DC08: PyEval_EvalFrameEx (ceval.c:4519) + ==6118== by 0x646DC08: PyEval_EvalFrameEx (ceval.c:4519) + ==6118== by 0x646DC08: PyEval_EvalFrameEx (ceval.c:4519) + ==6118== by 0x646DC08: PyEval_EvalFrameEx (ceval.c:4519) + ==6118== by 0x646DC08: PyEval_EvalFrameEx (ceval.c:4519) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +That "bcmp" call is really a memcmp call in check_types_equal. The +problem is that gdb is memcmp'ing two objects that are equal in value: + + (top-gdb) p *TYPE_RANGE_DATA (type1) + $1 = {low = {kind = PROP_CONST, data = {const_val = 0, baton = 0x0}}, high = {kind = PROP_CONST, data = {const_val = 15, baton = 0xf}}, flag_upper_bound_is_count = 0, + flag_bound_evaluated = 0} + (top-gdb) p *TYPE_RANGE_DATA (type2) + $2 = {low = {kind = PROP_CONST, data = {const_val = 0, baton = 0x0}}, high = {kind = PROP_CONST, data = {const_val = 15, baton = 0xf}}, flag_upper_bound_is_count = 0, + flag_bound_evaluated = 0} + +but differ in padding. Notice the 4-byte hole: + + (top-gdb) ptype /o range_bounds + /* offset | size */ type = struct range_bounds { + /* 0 | 16 */ struct dynamic_prop { + /* 0 | 4 */ dynamic_prop_kind kind; + /* XXX 4-byte hole */ + /* 8 | 8 */ union dynamic_prop_data { + /* 8 */ LONGEST const_val; + /* 8 */ void *baton; + + /* total size (bytes): 8 */ + } data; + +which is filled with garbage: + + (top-gdb) x /40bx TYPE_RANGE_DATA (type1) + 0x2fa7ea0: 0x01 0x00 0x00 0x00 0x43 0x01 0x00 0x00 + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 0x2fa7ea8: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 + 0x2fa7eb0: 0x01 0x00 0x00 0x00 0xfe 0x7f 0x00 0x00 + 0x2fa7eb8: 0x0f 0x00 0x00 0x00 0x00 0x00 0x00 0x00 + 0x2fa7ec0: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 + (top-gdb) x /40bx TYPE_RANGE_DATA (type2) + 0x20379b0: 0x01 0x00 0x00 0x00 0xfe 0x7f 0x00 0x00 + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 0x20379b8: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 + 0x20379c0: 0x01 0x00 0x00 0x00 0xfe 0x7f 0x00 0x00 + 0x20379c8: 0x0f 0x00 0x00 0x00 0x00 0x00 0x00 0x00 + 0x20379d0: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 + + (top-gdb) p memcmp (TYPE_RANGE_DATA (type1), TYPE_RANGE_DATA (type2), sizeof (*TYPE_RANGE_DATA (type1))) + $3 = -187 + +In some cases objects of type range_bounds are memset when allocated, +but then their dynamic_prop low/high fields are copied over from some +template dynamic_prop object that wasn't memset. E.g., +create_static_range_type's low/high locals are left with garbage in +the padding, and then that padding is copied over to the range_bounds +object's low/high fields. + +At first, I considered making sure to always memset range_bounds +objects, thinking that maybe type objects are being put in some bcache +instance somewhere. But then I hacked bcache/bcache_full to poison +non-pod types, and made dynamic_prop a non-pod, and GDB still +compiled. + +So given that, it seems safest to not assume padding will always be +memset, and instead treat them as regular value types, implementing +(in)equality operators and using those instead of memcmp. + +This fixes the random FAILs in GCC's testcase. + +[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83906 + +gdb/ChangeLog: +2018-01-24 Pedro Alves + + GCC PR libstdc++/83906 + * gdbtypes.c (operator==(const dynamic_prop &, + const dynamic_prop &)): New. + (operator==(const range_bounds &, const range_bounds &)): New. + (check_types_equal): Use them instead of memcmp. + * gdbtypes.h (operator==(const dynamic_prop &, + const dynamic_prop &)): Declare. + (operator!=(const dynamic_prop &, const dynamic_prop &)): Declare. + (operator==(const range_bounds &, const range_bounds &)): Declare. + (operator!=(const range_bounds &, const range_bounds &)): Declare. +--- + gdb/gdbtypes.c | 41 +++++++++++++++++++++++++++++++++++++++-- + gdb/gdbtypes.h | 20 ++++++++++++++++++++ + 2 files changed, 59 insertions(+), 2 deletions(-) + +Index: gdb-8.0.1/gdb/gdbtypes.c +=================================================================== +--- gdb-8.0.1.orig/gdb/gdbtypes.c ++++ gdb-8.0.1/gdb/gdbtypes.c +@@ -855,6 +855,44 @@ allocate_stub_method (struct type *type) + return mtype; + } + ++/* See gdbtypes.h. */ ++ ++bool ++operator== (const dynamic_prop &l, const dynamic_prop &r) ++{ ++ if (l.kind != r.kind) ++ return false; ++ ++ switch (l.kind) ++ { ++ case PROP_UNDEFINED: ++ return true; ++ case PROP_CONST: ++ return l.data.const_val == r.data.const_val; ++ case PROP_ADDR_OFFSET: ++ case PROP_LOCEXPR: ++ case PROP_LOCLIST: ++ return l.data.baton == r.data.baton; ++ } ++ ++ gdb_assert_not_reached ("unhandled dynamic_prop kind"); ++} ++ ++/* See gdbtypes.h. */ ++ ++bool ++operator== (const range_bounds &l, const range_bounds &r) ++{ ++#define FIELD_EQ(FIELD) (l.FIELD == r.FIELD) ++ ++ return (FIELD_EQ (low) ++ && FIELD_EQ (high) ++ && FIELD_EQ (flag_upper_bound_is_count) ++ && FIELD_EQ (flag_bound_evaluated)); ++ ++#undef FIELD_EQ ++} ++ + /* Create a range type with a dynamic range from LOW_BOUND to + HIGH_BOUND, inclusive. See create_range_type for further details. */ + +@@ -3466,8 +3504,7 @@ check_types_equal (struct type *type1, s + + if (TYPE_CODE (type1) == TYPE_CODE_RANGE) + { +- if (memcmp (TYPE_RANGE_DATA (type1), TYPE_RANGE_DATA (type2), +- sizeof (*TYPE_RANGE_DATA (type1))) != 0) ++ if (*TYPE_RANGE_DATA (type1) != *TYPE_RANGE_DATA (type2)) + return 0; + } + else +Index: gdb-8.0.1/gdb/gdbtypes.h +=================================================================== +--- gdb-8.0.1.orig/gdb/gdbtypes.h ++++ gdb-8.0.1/gdb/gdbtypes.h +@@ -408,6 +408,16 @@ struct dynamic_prop + union dynamic_prop_data data; + }; + ++/* Compare two dynamic_prop objects for equality. dynamic_prop ++ instances are equal iff they have the same type and storage. */ ++extern bool operator== (const dynamic_prop &l, const dynamic_prop &r); ++ ++/* Compare two dynamic_prop objects for inequality. */ ++static inline bool operator!= (const dynamic_prop &l, const dynamic_prop &r) ++{ ++ return !(l == r); ++} ++ + /* * Define a type's dynamic property node kind. */ + enum dynamic_prop_node_kind + { +@@ -568,6 +578,16 @@ struct range_bounds + int flag_bound_evaluated : 1; + }; + ++/* Compare two range_bounds objects for equality. Simply does ++ memberwise comparison. */ ++extern bool operator== (const range_bounds &l, const range_bounds &r); ++ ++/* Compare two range_bounds objects for inequality. */ ++static inline bool operator!= (const range_bounds &l, const range_bounds &r) ++{ ++ return !(l == r); ++} ++ + union type_specific + { + /* * CPLUS_STUFF is for TYPE_CODE_STRUCT. It is initialized to diff --git a/SOURCES/gdb-rhbz1228556-bpt-inlined-func-name-1of2.patch b/SOURCES/gdb-rhbz1228556-bpt-inlined-func-name-1of2.patch new file mode 100644 index 0000000..9a7f67a --- /dev/null +++ b/SOURCES/gdb-rhbz1228556-bpt-inlined-func-name-1of2.patch @@ -0,0 +1,136 @@ +commit 06871ae84096ed1672eb76f44cea4d5dbe79ae24 +Author: Pedro Alves +Date: Wed Sep 20 16:12:54 2017 +0100 + + Make "list ambiguous" show symbol names too + + Currently, with an ambiguous "list first,last", we get: + + (gdb) list bar,main + Specified first line 'bar' is ambiguous: + file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97 + file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98 + + This commit makes gdb's output above a bit clearer by printing the + symbol name as well: + + (gdb) list bar,main + Specified first line 'bar' is ambiguous: + file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97, symbol: "bar(A)" + file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98, symbol: "bar(B)" + + And while at it, makes gdb print the symbol name when actually listing + multiple locations too. I.e., before (with "set listsize 2"): + + (gdb) list bar + file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97 + 96 + 97 int bar (A) { return 11; } + file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98 + 97 int bar (A) { return 11; } + 98 int bar (B) { return 22; } + + After: + + (gdb) list bar + file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97, symbol: "bar(A)" + 96 + 97 int bar (A) { return 11; } + file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98, symbol: "bar(B)" + 97 int bar (A) { return 11; } + 98 int bar (B) { return 22; } + + Currently, the result of decoding a linespec loses information about + the original symbol that was found. All we end up with is an address. + This makes it difficult to find the original symbol again to get at + its print name. Fix that by storing a pointer to the symbol in the + sal. We already store the symtab and obj_section, so it feels like a + natural progression to me. This avoids having to do any extra symbol + lookup too. + + gdb/ChangeLog: + 2017-09-20 Pedro Alves + + * cli/cli-cmds.c (list_command): Use print_sal_location. + (print_sal_location): New function. + (ambiguous_line_spec): Use print_sal_location. + * linespec.c (symbol_to_sal): Record the symbol in the sal. + * symtab.c (find_function_start_sal): Likewise. + * symtab.h (symtab_and_line::symbol): New field. + + gdb/testsuite/ChangeLog: + 2017-09-20 Pedro Alves + + * gdb.base/list-ambiguous.exp (test_list_ambiguous_symbol): Expect + symbol names in gdb's output. + * gdb.cp/overload.exp ("list all overloads"): Likewise. + +### a/gdb/ChangeLog +### b/gdb/ChangeLog +## -1,5 +1,14 @@ + 2017-09-20 Pedro Alves + ++ * cli/cli-cmds.c (list_command): Use print_sal_location. ++ (print_sal_location): New function. ++ (ambiguous_line_spec): Use print_sal_location. ++ * linespec.c (symbol_to_sal): Record the symbol in the sal. ++ * symtab.c (find_function_start_sal): Likewise. ++ * symtab.h (symtab_and_line::symbol): New field. ++ ++2017-09-20 Pedro Alves ++ + * linespec.c (minsym_found): Handle non-text minsyms. + (symbol_to_sal): Record a sal.pc for non-block, non-label symbols. + +Index: gdb-8.0.1/gdb/linespec.c +=================================================================== +--- gdb-8.0.1.orig/gdb/linespec.c 2017-10-20 21:28:18.444609776 +0200 ++++ gdb-8.0.1/gdb/linespec.c 2017-10-20 21:29:12.382094104 +0200 +@@ -3864,6 +3864,7 @@ + { + init_sal (result); + result->symtab = symbol_symtab (sym); ++ result->symbol = sym; + result->line = SYMBOL_LINE (sym); + result->pc = SYMBOL_VALUE_ADDRESS (sym); + result->pspace = SYMTAB_PSPACE (result->symtab); +@@ -3879,6 +3880,7 @@ + /* We know its line number. */ + init_sal (result); + result->symtab = symbol_symtab (sym); ++ result->symbol = sym; + result->line = SYMBOL_LINE (sym); + result->pspace = SYMTAB_PSPACE (result->symtab); + return 1; +Index: gdb-8.0.1/gdb/symtab.c +=================================================================== +--- gdb-8.0.1.orig/gdb/symtab.c 2017-10-20 21:28:18.446609794 +0200 ++++ gdb-8.0.1/gdb/symtab.c 2017-10-20 21:29:51.390444377 +0200 +@@ -3478,6 +3478,7 @@ + fixup_symbol_section (sym, NULL); + section = SYMBOL_OBJ_SECTION (symbol_objfile (sym), sym); + sal = find_pc_sect_line (BLOCK_START (SYMBOL_BLOCK_VALUE (sym)), section, 0); ++ sal.symbol = sym; + + if (funfirstline && sal.symtab != NULL + && (COMPUNIT_LOCATIONS_VALID (SYMTAB_COMPUNIT (sal.symtab)) +@@ -3501,6 +3502,7 @@ + sal.pspace = current_program_space; + sal.pc = BLOCK_START (SYMBOL_BLOCK_VALUE (sym)); + sal.section = section; ++ sal.symbol = sym; + } + + if (funfirstline) +Index: gdb-8.0.1/gdb/symtab.h +=================================================================== +--- gdb-8.0.1.orig/gdb/symtab.h 2017-10-20 21:28:21.205634569 +0200 ++++ gdb-8.0.1/gdb/symtab.h 2017-10-20 21:28:40.933811716 +0200 +@@ -1420,6 +1420,7 @@ + struct program_space *pspace; + + struct symtab *symtab; ++ struct symbol *symbol; + struct obj_section *section; + /* Line number. Line numbers start at 1 and proceed through symtab->nlines. + 0 is never a valid line number; it is used to indicate that line number diff --git a/SOURCES/gdb-rhbz1228556-bpt-inlined-func-name-2of2.patch b/SOURCES/gdb-rhbz1228556-bpt-inlined-func-name-2of2.patch new file mode 100644 index 0000000..31e886d --- /dev/null +++ b/SOURCES/gdb-rhbz1228556-bpt-inlined-func-name-2of2.patch @@ -0,0 +1,212 @@ +commit 4a27f119f59a44395e0a34b1526cee709e1d3fce +Author: Keith Seitz +Date: Fri Oct 27 10:57:23 2017 -0700 + + Use SaL symbol name when reporting breakpoint locations + + Currently, "info break" can show some (perhaps) unexpected results when + setting a breakpoint on an inlined function: + + (gdb) list + 1 #include + 2 + 3 static inline void foo() + 4 { + 5 printf("Hello world\n"); + 6 } + 7 + 8 int main() + 9 { + 10 foo(); + 11 return 0; + 12 } + 13 + (gdb) b foo + Breakpoint 1 at 0x400434: file foo.c, line 5. + (gdb) i b + Num Type Disp Enb Address What + 1 breakpoint keep y 0x0000000000400434 in main at foo.c:5 + + GDB reported that we understood what "foo" was, but we then report that the + breakpoint is actually set in main. While that is literally true, we can + do a little better. + + This is accomplished by copying the symbol for which the breakpoint was set + into the bp_location. From there, print_breakpoint_location can use this + information to print out symbol information (if available) instead of calling + find_pc_sect_function. + + With the patch installed, + + (gdb) i b + Num Type Disp Enb Address What + 1 breakpoint keep y 0x0000000000400434 in foo at foo.c:5 + + gdb/ChangeLog: + + * breakpoint.c (print_breakpoint_location): Use the symbol saved + in the bp_location, falling back to find_pc_sect_function when + needed. + (add_location_to_breakpoint): Save sal->symbol. + * breakpoint.h (struct bp_location) : New field. + * symtab.c (find_function_start_sal): Save the symbol into the SaL. + * symtab.h (struct symtab_and_line) : New field. + + gdb/testsuite/ChangeLog: + + * gdb.opt/inline-break.exp (break_info_1): New procedure. + Test "info break" for every inlined function breakpoint. + +### a/gdb/ChangeLog +### b/gdb/ChangeLog +## -1,3 +1,13 @@ ++2017-10-27 Keith Seitz ++ ++ * breakpoint.c (print_breakpoint_location): Use the symbol saved ++ in the bp_location, falling back to find_pc_sect_function when ++ needed. ++ (add_location_to_breakpoint): Save sal->symbol. ++ * breakpoint.h (struct bp_location) : New field. ++ * symtab.c (find_function_start_sal): Save the symbol into the SaL. ++ * symtab.h (struct symtab_and_line) : New field. ++ + 2017-10-26 Patrick Frants + + PR gdb/13669 +--- a/gdb/breakpoint.c ++++ b/gdb/breakpoint.c +@@ -5956,8 +5956,11 @@ print_breakpoint_location (struct breakpoint *b, + uiout->field_string ("what", event_location_to_string (b->location.get ())); + else if (loc && loc->symtab) + { +- struct symbol *sym +- = find_pc_sect_function (loc->address, loc->section); ++ const struct symbol *sym = loc->symbol; ++ ++ if (sym == NULL) ++ sym = find_pc_sect_function (loc->address, loc->section); ++ + if (sym) + { + uiout->text ("in "); +@@ -8743,6 +8746,7 @@ add_location_to_breakpoint (struct breakpoint *b, + loc->gdbarch = loc_gdbarch; + loc->line_number = sal->line; + loc->symtab = sal->symtab; ++ loc->symbol = sal->symbol; + + set_breakpoint_location_function (loc, + sal->explicit_pc || sal->explicit_line); +--- a/gdb/breakpoint.h ++++ b/gdb/breakpoint.h +@@ -486,6 +486,11 @@ public: + to find the corresponding source file name. */ + + struct symtab *symtab; ++ ++ /* The symbol found by the location parser, if any. This may be used to ++ ascertain when an event location was set at a different location than ++ the one originally selected by parsing, e.g., inlined symbols. */ ++ const struct symbol *symbol = NULL; + }; + + /* The possible return values for print_bpstat, print_it_normal, +### a/gdb/testsuite/ChangeLog +### b/gdb/testsuite/ChangeLog +## -1,3 +1,8 @@ ++2017-10-27 Keith Seitz ++ ++ * gdb.opt/inline-break.exp (break_info_1): New procedure. ++ Test "info break" for every inlined function breakpoint. ++ + 2017-10-27 Yao Qi + + * gdb.arch/insn-reloc.c (can_relocate_bl): Mark "x30" clobbered. +--- a/gdb/testsuite/gdb.opt/inline-break.exp ++++ b/gdb/testsuite/gdb.opt/inline-break.exp +@@ -24,6 +24,62 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile \ + return -1 + } + ++# Return a string that may be used to match the output of "info break NUM". ++# ++# Optional arguments: ++# ++# source - the name of the source file ++# func - the name of the function ++# disp - the event disposition ++# enabled - enable state ++# locs - number of locations ++# line - source line number (ignored without -source) ++ ++proc break_info_1 {num args} { ++ global decimal ++ ++ # Column delimiter ++ set c {[\t ]+} ++ ++ # Row delimiter ++ set end {[\r\n \t]+} ++ ++ # Table header ++ set header "[join [list Num Type Disp Enb Address What] ${c}]" ++ ++ # Get/configure any optional parameters. ++ parse_args [list {source ""} {func ".*"} {disp "keep"} \ ++ {enabled "y"} {locs 1} [list line $decimal] \ ++ {type "breakpoint"}] ++ ++ if {$source != ""} { ++ set source "$source:$line" ++ } ++ ++ # Result starts with the standard header. ++ set result "$header${end}" ++ ++ # Set up for multi-location breakpoint marker. ++ if {$locs == 1} { ++ set multi ".*" ++ } else { ++ set multi "${end}" ++ } ++ append result "[join [list $num $type $disp $enabled $multi] $c]" ++ ++ # Add location info. ++ for {set i 1} {$i <= $locs} {incr i} { ++ if {$locs > 1} { ++ append result "[join [list $num.$i $enabled] $c].*" ++ } ++ ++ # Add function/source file info. ++ append result "in $func at .*$source${end}" ++ } ++ ++ return $result ++} ++ + # + # func1 is a static inlined function that is called once. + # The result should be a single-location breakpoint. +@@ -111,3 +167,22 @@ gdb_test "print func1" \ + # + gdb_test "print func2" \ + "\\\$.* = {int \\(int\\)} .* " ++ ++# Test that "info break" reports the location of the breakpoints "inside" ++# the inlined functions ++ ++set results(1) [break_info_1 1 -source $srcfile -func "func1"] ++set results(2) [break_info_1 2 -locs 2 -source $srcfile -func "func2"] ++set results(3) [break_info_1 3 -source $srcfile -func "func3b"] ++set results(4) [break_info_1 4 -locs 2 -source $srcfile -func "func4b"] ++set results(5) [break_info_1 5 -locs 2 -source $srcfile -func "func5b"] ++set results(6) [break_info_1 6 -locs 3 -source $srcfile -func "func6b"] ++set results(7) [break_info_1 7 -locs 2 -source $srcfile -func "func7b"] ++set results(8) [break_info_1 8 -locs 3 -source $srcfile -func "func8b"] ++ ++for {set i 1} {$i <= [array size results]} {incr i} { ++ send_log "Expecting: $results($i)\n" ++ gdb_test "info break $i" $results($i) ++} ++ ++unset -nocomplain results diff --git a/SOURCES/gdb-rhbz1498758-1of5.patch b/SOURCES/gdb-rhbz1498758-1of5.patch new file mode 100755 index 0000000..5bfff73 --- /dev/null +++ b/SOURCES/gdb-rhbz1498758-1of5.patch @@ -0,0 +1,46 @@ +commit 8fe09d7421db51bc13c9228547d63e6315bd6bd0 +Author: Andreas Arnez +Date: Thu Sep 21 17:45:18 2017 +0200 + + S/390: Fix Elf note swap s390_gs_bc vs. s390_gs_cb + + Fix two typos that resulted in swapping the BFD names for the core note + register sections NT_S390_GS_CB and NT_S390_GS_BC. + + bfd/ChangeLog: + + * elf.c (elfcore_grok_note): For the cases NT_S390_GS_CB and + NT_S390_GS_BC, correct the previously swapped invocations of + elfcore_grok_s390_gs_bc and elfcore_grok_s390_gs_cb. + +### a/bfd/ChangeLog +### b/bfd/ChangeLog +## -1,3 +1,9 @@ ++2017-09-21 Andreas Arnez ++ ++ * elf.c (elfcore_grok_note): For the cases NT_S390_GS_CB and ++ NT_S390_GS_BC, correct the previously swapped invocations of ++ elfcore_grok_s390_gs_bc and elfcore_grok_s390_gs_cb. ++ + 2017-09-19 Alan Modra + + PR 21441 +--- a/bfd/elf.c ++++ b/bfd/elf.c +@@ -9698,14 +9698,14 @@ elfcore_grok_note (bfd *abfd, Elf_Internal_Note *note) + case NT_S390_GS_CB: + if (note->namesz == 6 + && strcmp (note->namedata, "LINUX") == 0) +- return elfcore_grok_s390_gs_bc (abfd, note); ++ return elfcore_grok_s390_gs_cb (abfd, note); + else + return TRUE; + + case NT_S390_GS_BC: + if (note->namesz == 6 + && strcmp (note->namedata, "LINUX") == 0) +- return elfcore_grok_s390_gs_cb (abfd, note); ++ return elfcore_grok_s390_gs_bc (abfd, note); + else + return TRUE; + diff --git a/SOURCES/gdb-rhbz1498758-2of5.patch b/SOURCES/gdb-rhbz1498758-2of5.patch new file mode 100755 index 0000000..0e71e05 --- /dev/null +++ b/SOURCES/gdb-rhbz1498758-2of5.patch @@ -0,0 +1,816 @@ +commit 96235dc1ac3730c4e490d19db2e8287c0a40f307 +Author: Andreas Arnez +Date: Mon Sep 25 16:02:23 2017 +0200 + + S390: Add guarded-storage register definitions and tdescs + + Newer Linux kernel versions offer two new register sets in support of the + z/Architecture's guarded storage facility. This patch adds XML + descriptions and the respective autogenerated .c and .dat files for + s390/s390x targets with this feature. + + gdb/ChangeLog: + + * features/s390-gs-linux64.xml: New file. + * features/s390-gs.xml: New file. + * features/s390-gsbc.xml: New file. + * features/s390x-gs-linux64.xml: New file. + * features/Makefile (WHICH): Add s390-gs-linux64 and + s390x-gs-linux64. + (s390-gs-linux64-expedite, s390x-gs-linux64-expedite): New macros. + (XMLTOC): Add s390-gs-linux64.xml and s390x-linux64.xml. + * features/s390-gs-linux64.c: New generated file. + * features/s390x-gs-linux64.c: New file. + * regformats/s390-gs-linux64.dat: New file. + * regformats/s390x-gs-linux64.dat: New file. + +### a/gdb/ChangeLog +### b/gdb/ChangeLog +## -1,3 +1,18 @@ ++2017-09-25 Andreas Arnez ++ ++ * features/s390-gs-linux64.xml: New file. ++ * features/s390-gs.xml: New file. ++ * features/s390-gsbc.xml: New file. ++ * features/s390x-gs-linux64.xml: New file. ++ * features/Makefile (WHICH): Add s390-gs-linux64 and ++ s390x-gs-linux64. ++ (s390-gs-linux64-expedite, s390x-gs-linux64-expedite): New macros. ++ (XMLTOC): Add s390-gs-linux64.xml and s390x-linux64.xml. ++ * features/s390-gs-linux64.c: New generated file. ++ * features/s390x-gs-linux64.c: New file. ++ * regformats/s390-gs-linux64.dat: New file. ++ * regformats/s390x-gs-linux64.dat: New file. ++ + 2017-09-23 Tom Tromey + + * defs.h (make_cleanup_override_quit_handler): Don't declare. +--- a/gdb/features/Makefile ++++ b/gdb/features/Makefile +@@ -78,6 +78,7 @@ WHICH = aarch64 \ + s390-linux32v2 s390-linux64v2 s390x-linux64v2 \ + s390-te-linux64 s390x-te-linux64 s390-vx-linux64 s390x-vx-linux64 \ + s390-tevx-linux64 s390x-tevx-linux64 \ ++ s390-gs-linux64 s390x-gs-linux64 \ + tic6x-c64xp tic6x-c64x tic6x-c62x \ + tic6x-c64xp-linux tic6x-c64x-linux tic6x-c62x-linux + +@@ -105,12 +106,14 @@ s390-linux64v2-expedite = r14l,r15l,pswa + s390-te-linux64-expedite = r14l,r15l,pswa + s390-vx-linux64-expedite = r14l,r15l,pswa + s390-tevx-linux64-expedite = r14l,r15l,pswa ++s390-gs-linux64-expedite = r14,r15,pswa + s390x-linux64-expedite = r14,r15,pswa + s390x-linux64v1-expedite = r14,r15,pswa + s390x-linux64v2-expedite = r14,r15,pswa + s390x-te-linux64-expedite = r14,r15,pswa + s390x-vx-linux64-expedite = r14,r15,pswa + s390x-tevx-linux64-expedite = r14,r15,pswa ++s390x-gs-linux64-expedite = r14,r15,pswa + tic6x-c64xp-expedite = A15,PC + tic6x-c64x-expedite = A15,PC + tic6x-c62x-expedite = A15,PC +@@ -196,6 +199,8 @@ XMLTOC = \ + s390-vx-linux64.xml \ + s390x-tevx-linux64.xml \ + s390x-vx-linux64.xml \ ++ s390-gs-linux64.xml \ ++ s390x-gs-linux64.xml \ + tic6x-c62x-linux.xml \ + tic6x-c62x.xml \ + tic6x-c64x-linux.xml \ +--- /dev/null ++++ b/gdb/features/s390-gs-linux64.c +@@ -0,0 +1,198 @@ ++/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro: ++ Original: s390-gs-linux64.xml */ ++ ++#include "defs.h" ++#include "osabi.h" ++#include "target-descriptions.h" ++ ++struct target_desc *tdesc_s390_gs_linux64; ++static void ++initialize_tdesc_s390_gs_linux64 (void) ++{ ++ struct target_desc *result = allocate_target_description (); ++ struct tdesc_feature *feature; ++ struct tdesc_type *field_type; ++ struct tdesc_type *type; ++ ++ set_tdesc_architecture (result, bfd_scan_arch ("s390:31-bit")); ++ ++ feature = tdesc_create_feature (result, "org.gnu.gdb.s390.core"); ++ tdesc_create_reg (feature, "pswm", 0, 1, "psw", 32, "uint32"); ++ tdesc_create_reg (feature, "pswa", 1, 1, "psw", 32, "uint32"); ++ tdesc_create_reg (feature, "r0h", 2, 1, "upper", 32, "uint32"); ++ tdesc_create_reg (feature, "r0l", 3, 1, "lower", 32, "uint32"); ++ tdesc_create_reg (feature, "r1h", 4, 1, "upper", 32, "uint32"); ++ tdesc_create_reg (feature, "r1l", 5, 1, "lower", 32, "uint32"); ++ tdesc_create_reg (feature, "r2h", 6, 1, "upper", 32, "uint32"); ++ tdesc_create_reg (feature, "r2l", 7, 1, "lower", 32, "uint32"); ++ tdesc_create_reg (feature, "r3h", 8, 1, "upper", 32, "uint32"); ++ tdesc_create_reg (feature, "r3l", 9, 1, "lower", 32, "uint32"); ++ tdesc_create_reg (feature, "r4h", 10, 1, "upper", 32, "uint32"); ++ tdesc_create_reg (feature, "r4l", 11, 1, "lower", 32, "uint32"); ++ tdesc_create_reg (feature, "r5h", 12, 1, "upper", 32, "uint32"); ++ tdesc_create_reg (feature, "r5l", 13, 1, "lower", 32, "uint32"); ++ tdesc_create_reg (feature, "r6h", 14, 1, "upper", 32, "uint32"); ++ tdesc_create_reg (feature, "r6l", 15, 1, "lower", 32, "uint32"); ++ tdesc_create_reg (feature, "r7h", 16, 1, "upper", 32, "uint32"); ++ tdesc_create_reg (feature, "r7l", 17, 1, "lower", 32, "uint32"); ++ tdesc_create_reg (feature, "r8h", 18, 1, "upper", 32, "uint32"); ++ tdesc_create_reg (feature, "r8l", 19, 1, "lower", 32, "uint32"); ++ tdesc_create_reg (feature, "r9h", 20, 1, "upper", 32, "uint32"); ++ tdesc_create_reg (feature, "r9l", 21, 1, "lower", 32, "uint32"); ++ tdesc_create_reg (feature, "r10h", 22, 1, "upper", 32, "uint32"); ++ tdesc_create_reg (feature, "r10l", 23, 1, "lower", 32, "uint32"); ++ tdesc_create_reg (feature, "r11h", 24, 1, "upper", 32, "uint32"); ++ tdesc_create_reg (feature, "r11l", 25, 1, "lower", 32, "uint32"); ++ tdesc_create_reg (feature, "r12h", 26, 1, "upper", 32, "uint32"); ++ tdesc_create_reg (feature, "r12l", 27, 1, "lower", 32, "uint32"); ++ tdesc_create_reg (feature, "r13h", 28, 1, "upper", 32, "uint32"); ++ tdesc_create_reg (feature, "r13l", 29, 1, "lower", 32, "uint32"); ++ tdesc_create_reg (feature, "r14h", 30, 1, "upper", 32, "uint32"); ++ tdesc_create_reg (feature, "r14l", 31, 1, "lower", 32, "uint32"); ++ tdesc_create_reg (feature, "r15h", 32, 1, "upper", 32, "uint32"); ++ tdesc_create_reg (feature, "r15l", 33, 1, "lower", 32, "uint32"); ++ ++ feature = tdesc_create_feature (result, "org.gnu.gdb.s390.acr"); ++ tdesc_create_reg (feature, "acr0", 34, 1, "access", 32, "uint32"); ++ tdesc_create_reg (feature, "acr1", 35, 1, "access", 32, "uint32"); ++ tdesc_create_reg (feature, "acr2", 36, 1, "access", 32, "uint32"); ++ tdesc_create_reg (feature, "acr3", 37, 1, "access", 32, "uint32"); ++ tdesc_create_reg (feature, "acr4", 38, 1, "access", 32, "uint32"); ++ tdesc_create_reg (feature, "acr5", 39, 1, "access", 32, "uint32"); ++ tdesc_create_reg (feature, "acr6", 40, 1, "access", 32, "uint32"); ++ tdesc_create_reg (feature, "acr7", 41, 1, "access", 32, "uint32"); ++ tdesc_create_reg (feature, "acr8", 42, 1, "access", 32, "uint32"); ++ tdesc_create_reg (feature, "acr9", 43, 1, "access", 32, "uint32"); ++ tdesc_create_reg (feature, "acr10", 44, 1, "access", 32, "uint32"); ++ tdesc_create_reg (feature, "acr11", 45, 1, "access", 32, "uint32"); ++ tdesc_create_reg (feature, "acr12", 46, 1, "access", 32, "uint32"); ++ tdesc_create_reg (feature, "acr13", 47, 1, "access", 32, "uint32"); ++ tdesc_create_reg (feature, "acr14", 48, 1, "access", 32, "uint32"); ++ tdesc_create_reg (feature, "acr15", 49, 1, "access", 32, "uint32"); ++ ++ feature = tdesc_create_feature (result, "org.gnu.gdb.s390.fpr"); ++ tdesc_create_reg (feature, "fpc", 50, 1, "float", 32, "uint32"); ++ tdesc_create_reg (feature, "f0", 51, 1, "float", 64, "ieee_double"); ++ tdesc_create_reg (feature, "f1", 52, 1, "float", 64, "ieee_double"); ++ tdesc_create_reg (feature, "f2", 53, 1, "float", 64, "ieee_double"); ++ tdesc_create_reg (feature, "f3", 54, 1, "float", 64, "ieee_double"); ++ tdesc_create_reg (feature, "f4", 55, 1, "float", 64, "ieee_double"); ++ tdesc_create_reg (feature, "f5", 56, 1, "float", 64, "ieee_double"); ++ tdesc_create_reg (feature, "f6", 57, 1, "float", 64, "ieee_double"); ++ tdesc_create_reg (feature, "f7", 58, 1, "float", 64, "ieee_double"); ++ tdesc_create_reg (feature, "f8", 59, 1, "float", 64, "ieee_double"); ++ tdesc_create_reg (feature, "f9", 60, 1, "float", 64, "ieee_double"); ++ tdesc_create_reg (feature, "f10", 61, 1, "float", 64, "ieee_double"); ++ tdesc_create_reg (feature, "f11", 62, 1, "float", 64, "ieee_double"); ++ tdesc_create_reg (feature, "f12", 63, 1, "float", 64, "ieee_double"); ++ tdesc_create_reg (feature, "f13", 64, 1, "float", 64, "ieee_double"); ++ tdesc_create_reg (feature, "f14", 65, 1, "float", 64, "ieee_double"); ++ tdesc_create_reg (feature, "f15", 66, 1, "float", 64, "ieee_double"); ++ ++ feature = tdesc_create_feature (result, "org.gnu.gdb.s390.linux"); ++ tdesc_create_reg (feature, "orig_r2", 67, 1, "system", 32, "uint32"); ++ tdesc_create_reg (feature, "last_break", 68, 0, "system", 32, "code_ptr"); ++ tdesc_create_reg (feature, "system_call", 69, 1, "system", 32, "uint32"); ++ ++ feature = tdesc_create_feature (result, "org.gnu.gdb.s390.tdb"); ++ tdesc_create_reg (feature, "tdb0", 70, 1, "tdb", 64, "uint64"); ++ tdesc_create_reg (feature, "tac", 71, 1, "tdb", 64, "uint64"); ++ tdesc_create_reg (feature, "tct", 72, 1, "tdb", 64, "uint64"); ++ tdesc_create_reg (feature, "atia", 73, 1, "tdb", 64, "uint64"); ++ tdesc_create_reg (feature, "tr0", 74, 1, "tdb", 64, "uint64"); ++ tdesc_create_reg (feature, "tr1", 75, 1, "tdb", 64, "uint64"); ++ tdesc_create_reg (feature, "tr2", 76, 1, "tdb", 64, "uint64"); ++ tdesc_create_reg (feature, "tr3", 77, 1, "tdb", 64, "uint64"); ++ tdesc_create_reg (feature, "tr4", 78, 1, "tdb", 64, "uint64"); ++ tdesc_create_reg (feature, "tr5", 79, 1, "tdb", 64, "uint64"); ++ tdesc_create_reg (feature, "tr6", 80, 1, "tdb", 64, "uint64"); ++ tdesc_create_reg (feature, "tr7", 81, 1, "tdb", 64, "uint64"); ++ tdesc_create_reg (feature, "tr8", 82, 1, "tdb", 64, "uint64"); ++ tdesc_create_reg (feature, "tr9", 83, 1, "tdb", 64, "uint64"); ++ tdesc_create_reg (feature, "tr10", 84, 1, "tdb", 64, "uint64"); ++ tdesc_create_reg (feature, "tr11", 85, 1, "tdb", 64, "uint64"); ++ tdesc_create_reg (feature, "tr12", 86, 1, "tdb", 64, "uint64"); ++ tdesc_create_reg (feature, "tr13", 87, 1, "tdb", 64, "uint64"); ++ tdesc_create_reg (feature, "tr14", 88, 1, "tdb", 64, "uint64"); ++ tdesc_create_reg (feature, "tr15", 89, 1, "tdb", 64, "uint64"); ++ ++ feature = tdesc_create_feature (result, "org.gnu.gdb.s390.vx"); ++ field_type = tdesc_named_type (feature, "ieee_single"); ++ tdesc_create_vector (feature, "v4f", field_type, 4); ++ ++ field_type = tdesc_named_type (feature, "ieee_double"); ++ tdesc_create_vector (feature, "v2d", field_type, 2); ++ ++ field_type = tdesc_named_type (feature, "int8"); ++ tdesc_create_vector (feature, "v16i8", field_type, 16); ++ ++ field_type = tdesc_named_type (feature, "int16"); ++ tdesc_create_vector (feature, "v8i16", field_type, 8); ++ ++ field_type = tdesc_named_type (feature, "int32"); ++ tdesc_create_vector (feature, "v4i32", field_type, 4); ++ ++ field_type = tdesc_named_type (feature, "int64"); ++ tdesc_create_vector (feature, "v2i64", field_type, 2); ++ ++ type = tdesc_create_union (feature, "vec128"); ++ field_type = tdesc_named_type (feature, "v4f"); ++ tdesc_add_field (type, "v4_float", field_type); ++ field_type = tdesc_named_type (feature, "v2d"); ++ tdesc_add_field (type, "v2_double", field_type); ++ field_type = tdesc_named_type (feature, "v16i8"); ++ tdesc_add_field (type, "v16_int8", field_type); ++ field_type = tdesc_named_type (feature, "v8i16"); ++ tdesc_add_field (type, "v8_int16", field_type); ++ field_type = tdesc_named_type (feature, "v4i32"); ++ tdesc_add_field (type, "v4_int32", field_type); ++ field_type = tdesc_named_type (feature, "v2i64"); ++ tdesc_add_field (type, "v2_int64", field_type); ++ field_type = tdesc_named_type (feature, "uint128"); ++ tdesc_add_field (type, "uint128", field_type); ++ ++ tdesc_create_reg (feature, "v0l", 90, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "v1l", 91, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "v2l", 92, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "v3l", 93, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "v4l", 94, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "v5l", 95, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "v6l", 96, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "v7l", 97, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "v8l", 98, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "v9l", 99, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "v10l", 100, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "v11l", 101, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "v12l", 102, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "v13l", 103, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "v14l", 104, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "v15l", 105, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "v16", 106, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "v17", 107, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "v18", 108, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "v19", 109, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "v20", 110, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "v21", 111, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "v22", 112, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "v23", 113, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "v24", 114, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "v25", 115, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "v26", 116, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "v27", 117, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "v28", 118, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "v29", 119, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "v30", 120, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "v31", 121, 1, NULL, 128, "vec128"); ++ ++ feature = tdesc_create_feature (result, "org.gnu.gdb.s390.gs"); ++ tdesc_create_reg (feature, "gsd", 122, 1, "gs", 64, "uint64"); ++ tdesc_create_reg (feature, "gssm", 123, 1, "gs", 64, "uint64"); ++ tdesc_create_reg (feature, "gsepla", 124, 1, "gs", 64, "data_ptr"); ++ ++ feature = tdesc_create_feature (result, "org.gnu.gdb.s390.gsbc"); ++ tdesc_create_reg (feature, "bc_gsd", 125, 1, "gs", 64, "uint64"); ++ tdesc_create_reg (feature, "bc_gssm", 126, 1, "gs", 64, "uint64"); ++ tdesc_create_reg (feature, "bc_gsepla", 127, 1, "gs", 64, "data_ptr"); ++ ++ tdesc_s390_gs_linux64 = result; ++} +--- /dev/null ++++ b/gdb/features/s390-gs-linux64.xml +@@ -0,0 +1,28 @@ ++ ++ ++ ++ ++ ++ ++ ++ s390:31-bit ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +--- /dev/null ++++ b/gdb/features/s390-gs.xml +@@ -0,0 +1,13 @@ ++ ++ ++ ++ ++ ++ ++ ++ ++ +--- /dev/null ++++ b/gdb/features/s390-gsbc.xml +@@ -0,0 +1,13 @@ ++ ++ ++ ++ ++ ++ ++ ++ ++ +--- /dev/null ++++ b/gdb/features/s390x-gs-linux64.c +@@ -0,0 +1,182 @@ ++/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro: ++ Original: s390x-gs-linux64.xml */ ++ ++#include "defs.h" ++#include "osabi.h" ++#include "target-descriptions.h" ++ ++struct target_desc *tdesc_s390x_gs_linux64; ++static void ++initialize_tdesc_s390x_gs_linux64 (void) ++{ ++ struct target_desc *result = allocate_target_description (); ++ struct tdesc_feature *feature; ++ struct tdesc_type *field_type; ++ struct tdesc_type *type; ++ ++ set_tdesc_architecture (result, bfd_scan_arch ("s390:64-bit")); ++ ++ feature = tdesc_create_feature (result, "org.gnu.gdb.s390.core"); ++ tdesc_create_reg (feature, "pswm", 0, 1, "psw", 64, "uint64"); ++ tdesc_create_reg (feature, "pswa", 1, 1, "psw", 64, "uint64"); ++ tdesc_create_reg (feature, "r0", 2, 1, "general", 64, "uint64"); ++ tdesc_create_reg (feature, "r1", 3, 1, "general", 64, "uint64"); ++ tdesc_create_reg (feature, "r2", 4, 1, "general", 64, "uint64"); ++ tdesc_create_reg (feature, "r3", 5, 1, "general", 64, "uint64"); ++ tdesc_create_reg (feature, "r4", 6, 1, "general", 64, "uint64"); ++ tdesc_create_reg (feature, "r5", 7, 1, "general", 64, "uint64"); ++ tdesc_create_reg (feature, "r6", 8, 1, "general", 64, "uint64"); ++ tdesc_create_reg (feature, "r7", 9, 1, "general", 64, "uint64"); ++ tdesc_create_reg (feature, "r8", 10, 1, "general", 64, "uint64"); ++ tdesc_create_reg (feature, "r9", 11, 1, "general", 64, "uint64"); ++ tdesc_create_reg (feature, "r10", 12, 1, "general", 64, "uint64"); ++ tdesc_create_reg (feature, "r11", 13, 1, "general", 64, "uint64"); ++ tdesc_create_reg (feature, "r12", 14, 1, "general", 64, "uint64"); ++ tdesc_create_reg (feature, "r13", 15, 1, "general", 64, "uint64"); ++ tdesc_create_reg (feature, "r14", 16, 1, "general", 64, "uint64"); ++ tdesc_create_reg (feature, "r15", 17, 1, "general", 64, "uint64"); ++ ++ feature = tdesc_create_feature (result, "org.gnu.gdb.s390.acr"); ++ tdesc_create_reg (feature, "acr0", 18, 1, "access", 32, "uint32"); ++ tdesc_create_reg (feature, "acr1", 19, 1, "access", 32, "uint32"); ++ tdesc_create_reg (feature, "acr2", 20, 1, "access", 32, "uint32"); ++ tdesc_create_reg (feature, "acr3", 21, 1, "access", 32, "uint32"); ++ tdesc_create_reg (feature, "acr4", 22, 1, "access", 32, "uint32"); ++ tdesc_create_reg (feature, "acr5", 23, 1, "access", 32, "uint32"); ++ tdesc_create_reg (feature, "acr6", 24, 1, "access", 32, "uint32"); ++ tdesc_create_reg (feature, "acr7", 25, 1, "access", 32, "uint32"); ++ tdesc_create_reg (feature, "acr8", 26, 1, "access", 32, "uint32"); ++ tdesc_create_reg (feature, "acr9", 27, 1, "access", 32, "uint32"); ++ tdesc_create_reg (feature, "acr10", 28, 1, "access", 32, "uint32"); ++ tdesc_create_reg (feature, "acr11", 29, 1, "access", 32, "uint32"); ++ tdesc_create_reg (feature, "acr12", 30, 1, "access", 32, "uint32"); ++ tdesc_create_reg (feature, "acr13", 31, 1, "access", 32, "uint32"); ++ tdesc_create_reg (feature, "acr14", 32, 1, "access", 32, "uint32"); ++ tdesc_create_reg (feature, "acr15", 33, 1, "access", 32, "uint32"); ++ ++ feature = tdesc_create_feature (result, "org.gnu.gdb.s390.fpr"); ++ tdesc_create_reg (feature, "fpc", 34, 1, "float", 32, "uint32"); ++ tdesc_create_reg (feature, "f0", 35, 1, "float", 64, "ieee_double"); ++ tdesc_create_reg (feature, "f1", 36, 1, "float", 64, "ieee_double"); ++ tdesc_create_reg (feature, "f2", 37, 1, "float", 64, "ieee_double"); ++ tdesc_create_reg (feature, "f3", 38, 1, "float", 64, "ieee_double"); ++ tdesc_create_reg (feature, "f4", 39, 1, "float", 64, "ieee_double"); ++ tdesc_create_reg (feature, "f5", 40, 1, "float", 64, "ieee_double"); ++ tdesc_create_reg (feature, "f6", 41, 1, "float", 64, "ieee_double"); ++ tdesc_create_reg (feature, "f7", 42, 1, "float", 64, "ieee_double"); ++ tdesc_create_reg (feature, "f8", 43, 1, "float", 64, "ieee_double"); ++ tdesc_create_reg (feature, "f9", 44, 1, "float", 64, "ieee_double"); ++ tdesc_create_reg (feature, "f10", 45, 1, "float", 64, "ieee_double"); ++ tdesc_create_reg (feature, "f11", 46, 1, "float", 64, "ieee_double"); ++ tdesc_create_reg (feature, "f12", 47, 1, "float", 64, "ieee_double"); ++ tdesc_create_reg (feature, "f13", 48, 1, "float", 64, "ieee_double"); ++ tdesc_create_reg (feature, "f14", 49, 1, "float", 64, "ieee_double"); ++ tdesc_create_reg (feature, "f15", 50, 1, "float", 64, "ieee_double"); ++ ++ feature = tdesc_create_feature (result, "org.gnu.gdb.s390.linux"); ++ tdesc_create_reg (feature, "orig_r2", 51, 1, "system", 64, "uint64"); ++ tdesc_create_reg (feature, "last_break", 52, 0, "system", 64, "code_ptr"); ++ tdesc_create_reg (feature, "system_call", 53, 1, "system", 32, "uint32"); ++ ++ feature = tdesc_create_feature (result, "org.gnu.gdb.s390.tdb"); ++ tdesc_create_reg (feature, "tdb0", 54, 1, "tdb", 64, "uint64"); ++ tdesc_create_reg (feature, "tac", 55, 1, "tdb", 64, "uint64"); ++ tdesc_create_reg (feature, "tct", 56, 1, "tdb", 64, "uint64"); ++ tdesc_create_reg (feature, "atia", 57, 1, "tdb", 64, "uint64"); ++ tdesc_create_reg (feature, "tr0", 58, 1, "tdb", 64, "uint64"); ++ tdesc_create_reg (feature, "tr1", 59, 1, "tdb", 64, "uint64"); ++ tdesc_create_reg (feature, "tr2", 60, 1, "tdb", 64, "uint64"); ++ tdesc_create_reg (feature, "tr3", 61, 1, "tdb", 64, "uint64"); ++ tdesc_create_reg (feature, "tr4", 62, 1, "tdb", 64, "uint64"); ++ tdesc_create_reg (feature, "tr5", 63, 1, "tdb", 64, "uint64"); ++ tdesc_create_reg (feature, "tr6", 64, 1, "tdb", 64, "uint64"); ++ tdesc_create_reg (feature, "tr7", 65, 1, "tdb", 64, "uint64"); ++ tdesc_create_reg (feature, "tr8", 66, 1, "tdb", 64, "uint64"); ++ tdesc_create_reg (feature, "tr9", 67, 1, "tdb", 64, "uint64"); ++ tdesc_create_reg (feature, "tr10", 68, 1, "tdb", 64, "uint64"); ++ tdesc_create_reg (feature, "tr11", 69, 1, "tdb", 64, "uint64"); ++ tdesc_create_reg (feature, "tr12", 70, 1, "tdb", 64, "uint64"); ++ tdesc_create_reg (feature, "tr13", 71, 1, "tdb", 64, "uint64"); ++ tdesc_create_reg (feature, "tr14", 72, 1, "tdb", 64, "uint64"); ++ tdesc_create_reg (feature, "tr15", 73, 1, "tdb", 64, "uint64"); ++ ++ feature = tdesc_create_feature (result, "org.gnu.gdb.s390.vx"); ++ field_type = tdesc_named_type (feature, "ieee_single"); ++ tdesc_create_vector (feature, "v4f", field_type, 4); ++ ++ field_type = tdesc_named_type (feature, "ieee_double"); ++ tdesc_create_vector (feature, "v2d", field_type, 2); ++ ++ field_type = tdesc_named_type (feature, "int8"); ++ tdesc_create_vector (feature, "v16i8", field_type, 16); ++ ++ field_type = tdesc_named_type (feature, "int16"); ++ tdesc_create_vector (feature, "v8i16", field_type, 8); ++ ++ field_type = tdesc_named_type (feature, "int32"); ++ tdesc_create_vector (feature, "v4i32", field_type, 4); ++ ++ field_type = tdesc_named_type (feature, "int64"); ++ tdesc_create_vector (feature, "v2i64", field_type, 2); ++ ++ type = tdesc_create_union (feature, "vec128"); ++ field_type = tdesc_named_type (feature, "v4f"); ++ tdesc_add_field (type, "v4_float", field_type); ++ field_type = tdesc_named_type (feature, "v2d"); ++ tdesc_add_field (type, "v2_double", field_type); ++ field_type = tdesc_named_type (feature, "v16i8"); ++ tdesc_add_field (type, "v16_int8", field_type); ++ field_type = tdesc_named_type (feature, "v8i16"); ++ tdesc_add_field (type, "v8_int16", field_type); ++ field_type = tdesc_named_type (feature, "v4i32"); ++ tdesc_add_field (type, "v4_int32", field_type); ++ field_type = tdesc_named_type (feature, "v2i64"); ++ tdesc_add_field (type, "v2_int64", field_type); ++ field_type = tdesc_named_type (feature, "uint128"); ++ tdesc_add_field (type, "uint128", field_type); ++ ++ tdesc_create_reg (feature, "v0l", 74, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "v1l", 75, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "v2l", 76, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "v3l", 77, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "v4l", 78, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "v5l", 79, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "v6l", 80, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "v7l", 81, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "v8l", 82, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "v9l", 83, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "v10l", 84, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "v11l", 85, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "v12l", 86, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "v13l", 87, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "v14l", 88, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "v15l", 89, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "v16", 90, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "v17", 91, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "v18", 92, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "v19", 93, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "v20", 94, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "v21", 95, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "v22", 96, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "v23", 97, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "v24", 98, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "v25", 99, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "v26", 100, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "v27", 101, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "v28", 102, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "v29", 103, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "v30", 104, 1, NULL, 128, "vec128"); ++ tdesc_create_reg (feature, "v31", 105, 1, NULL, 128, "vec128"); ++ ++ feature = tdesc_create_feature (result, "org.gnu.gdb.s390.gs"); ++ tdesc_create_reg (feature, "gsd", 106, 1, "gs", 64, "uint64"); ++ tdesc_create_reg (feature, "gssm", 107, 1, "gs", 64, "uint64"); ++ tdesc_create_reg (feature, "gsepla", 108, 1, "gs", 64, "data_ptr"); ++ ++ feature = tdesc_create_feature (result, "org.gnu.gdb.s390.gsbc"); ++ tdesc_create_reg (feature, "bc_gsd", 109, 1, "gs", 64, "uint64"); ++ tdesc_create_reg (feature, "bc_gssm", 110, 1, "gs", 64, "uint64"); ++ tdesc_create_reg (feature, "bc_gsepla", 111, 1, "gs", 64, "data_ptr"); ++ ++ tdesc_s390x_gs_linux64 = result; ++} +--- /dev/null ++++ b/gdb/features/s390x-gs-linux64.xml +@@ -0,0 +1,27 @@ ++ ++ ++ ++ ++ ++ ++ ++ s390:64-bit ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +--- /dev/null ++++ b/gdb/regformats/s390-gs-linux64.dat +@@ -0,0 +1,133 @@ ++# THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi :set ro: ++# Generated from: s390-gs-linux64.xml ++name:s390_gs_linux64 ++xmltarget:s390-gs-linux64.xml ++expedite:r14,r15,pswa ++32:pswm ++32:pswa ++32:r0h ++32:r0l ++32:r1h ++32:r1l ++32:r2h ++32:r2l ++32:r3h ++32:r3l ++32:r4h ++32:r4l ++32:r5h ++32:r5l ++32:r6h ++32:r6l ++32:r7h ++32:r7l ++32:r8h ++32:r8l ++32:r9h ++32:r9l ++32:r10h ++32:r10l ++32:r11h ++32:r11l ++32:r12h ++32:r12l ++32:r13h ++32:r13l ++32:r14h ++32:r14l ++32:r15h ++32:r15l ++32:acr0 ++32:acr1 ++32:acr2 ++32:acr3 ++32:acr4 ++32:acr5 ++32:acr6 ++32:acr7 ++32:acr8 ++32:acr9 ++32:acr10 ++32:acr11 ++32:acr12 ++32:acr13 ++32:acr14 ++32:acr15 ++32:fpc ++64:f0 ++64:f1 ++64:f2 ++64:f3 ++64:f4 ++64:f5 ++64:f6 ++64:f7 ++64:f8 ++64:f9 ++64:f10 ++64:f11 ++64:f12 ++64:f13 ++64:f14 ++64:f15 ++32:orig_r2 ++32:last_break ++32:system_call ++64:tdb0 ++64:tac ++64:tct ++64:atia ++64:tr0 ++64:tr1 ++64:tr2 ++64:tr3 ++64:tr4 ++64:tr5 ++64:tr6 ++64:tr7 ++64:tr8 ++64:tr9 ++64:tr10 ++64:tr11 ++64:tr12 ++64:tr13 ++64:tr14 ++64:tr15 ++64:v0l ++64:v1l ++64:v2l ++64:v3l ++64:v4l ++64:v5l ++64:v6l ++64:v7l ++64:v8l ++64:v9l ++64:v10l ++64:v11l ++64:v12l ++64:v13l ++64:v14l ++64:v15l ++128:v16 ++128:v17 ++128:v18 ++128:v19 ++128:v20 ++128:v21 ++128:v22 ++128:v23 ++128:v24 ++128:v25 ++128:v26 ++128:v27 ++128:v28 ++128:v29 ++128:v30 ++128:v31 ++64:gsd ++64:gssm ++64:gsepla ++64:bc_gsd ++64:bc_gssm ++64:bc_gsepla +--- /dev/null ++++ b/gdb/regformats/s390x-gs-linux64.dat +@@ -0,0 +1,117 @@ ++# THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi :set ro: ++# Generated from: s390x-gs-linux64.xml ++name:s390x_gs_linux64 ++xmltarget:s390x-gs-linux64.xml ++expedite:r14,r15,pswa ++64:pswm ++64:pswa ++64:r0 ++64:r1 ++64:r2 ++64:r3 ++64:r4 ++64:r5 ++64:r6 ++64:r7 ++64:r8 ++64:r9 ++64:r10 ++64:r11 ++64:r12 ++64:r13 ++64:r14 ++64:r15 ++32:acr0 ++32:acr1 ++32:acr2 ++32:acr3 ++32:acr4 ++32:acr5 ++32:acr6 ++32:acr7 ++32:acr8 ++32:acr9 ++32:acr10 ++32:acr11 ++32:acr12 ++32:acr13 ++32:acr14 ++32:acr15 ++32:fpc ++64:f0 ++64:f1 ++64:f2 ++64:f3 ++64:f4 ++64:f5 ++64:f6 ++64:f7 ++64:f8 ++64:f9 ++64:f10 ++64:f11 ++64:f12 ++64:f13 ++64:f14 ++64:f15 ++64:orig_r2 ++64:last_break ++32:system_call ++64:tdb0 ++64:tac ++64:tct ++64:atia ++64:tr0 ++64:tr1 ++64:tr2 ++64:tr3 ++64:tr4 ++64:tr5 ++64:tr6 ++64:tr7 ++64:tr8 ++64:tr9 ++64:tr10 ++64:tr11 ++64:tr12 ++64:tr13 ++64:tr14 ++64:tr15 ++64:v0l ++64:v1l ++64:v2l ++64:v3l ++64:v4l ++64:v5l ++64:v6l ++64:v7l ++64:v8l ++64:v9l ++64:v10l ++64:v11l ++64:v12l ++64:v13l ++64:v14l ++64:v15l ++128:v16 ++128:v17 ++128:v18 ++128:v19 ++128:v20 ++128:v21 ++128:v22 ++128:v23 ++128:v24 ++128:v25 ++128:v26 ++128:v27 ++128:v28 ++128:v29 ++128:v30 ++128:v31 ++64:gsd ++64:gssm ++64:gsepla ++64:bc_gsd ++64:bc_gssm ++64:bc_gsepla diff --git a/SOURCES/gdb-rhbz1498758-3of5.patch b/SOURCES/gdb-rhbz1498758-3of5.patch new file mode 100755 index 0000000..bcd76a7 --- /dev/null +++ b/SOURCES/gdb-rhbz1498758-3of5.patch @@ -0,0 +1,385 @@ +commit 1b63490c9173f8c9770b7885def720516aa9b9f8 +Author: Andreas Arnez +Date: Mon Sep 25 16:02:23 2017 +0200 + + S390: Add guarded-storage register support to GDB + + Recognize targets with the new guarded-storage feature and then present + the guarded-storage registers and the Linux-specific guarded-storage + broadcast control block appropriately. + + gdb/ChangeLog: + + * s390-linux-nat.c (have_regset_gs): New static variable. + (s390_linux_fetch_inferior_registers): Handle guarded-storage + control block and guarded-storage broadcast control regsets. + (s390_read_description): Detect whether the target has + guarded-storage support, return appropriate tdesc. + * s390-linux-tdep.c (features/s390-gs-linux64.c): New include. + (features/s390x-gs-linux64.c): Likewise. + (struct gdbarch_tdep) : New field. + (s390_regmap_gs, s390_regmap_gsbc, s390_gs_regset) + (s390_gsbc_regset): New variables. + (s390_iterate_over_regset_sections): Iterate over s390_gs_regset + and s390_gsbc_regset, if applicable. + (s390_core_read_description): Check whether core file was from a + target with guarded-storage support; include appropriate regsets. + (s390_gdbarch_init): Add registers for guarded-storage support. + (_initialize_s390_tdep): Initialize new target descriptions that + include registers for guarded-storage support. + * s390-linux-tdep.h (HWCAP_S390_GS, S390_GSD_REGNUM) + (S390_GSSM_REGNUM, S390_GSEPLA_REGNUM) + (S390_BC_GSD_REGNUM, S390_BC_GSSM_REGNUM): New defines. + (S390_NUM_REGS): Adjust macro definition. + (s390_gs_regset, s390_gsbc_regset, tdesc_s390_gs_linux64) + (tdesc_s390x_gs_linux64): New declarations. + +### a/gdb/ChangeLog +### b/gdb/ChangeLog +## -1,5 +1,31 @@ + 2017-09-25 Andreas Arnez + ++ * s390-linux-nat.c (have_regset_gs): New static variable. ++ (s390_linux_fetch_inferior_registers): Handle guarded-storage ++ control block and guarded-storage broadcast control regsets. ++ (s390_read_description): Detect whether the target has ++ guarded-storage support, return appropriate tdesc. ++ * s390-linux-tdep.c (features/s390-gs-linux64.c): New include. ++ (features/s390x-gs-linux64.c): Likewise. ++ (struct gdbarch_tdep) : New field. ++ (s390_regmap_gs, s390_regmap_gsbc, s390_gs_regset) ++ (s390_gsbc_regset): New variables. ++ (s390_iterate_over_regset_sections): Iterate over s390_gs_regset ++ and s390_gsbc_regset, if applicable. ++ (s390_core_read_description): Check whether core file was from a ++ target with guarded-storage support; include appropriate regsets. ++ (s390_gdbarch_init): Add registers for guarded-storage support. ++ (_initialize_s390_tdep): Initialize new target descriptions that ++ include registers for guarded-storage support. ++ * s390-linux-tdep.h (HWCAP_S390_GS, S390_GSD_REGNUM) ++ (S390_GSSM_REGNUM, S390_GSEPLA_REGNUM) ++ (S390_BC_GSD_REGNUM, S390_BC_GSSM_REGNUM): New defines. ++ (S390_NUM_REGS): Adjust macro definition. ++ (s390_gs_regset, s390_gsbc_regset, tdesc_s390_gs_linux64) ++ (tdesc_s390x_gs_linux64): New declarations. ++ ++2017-09-25 Andreas Arnez ++ + * features/s390-gs-linux64.xml: New file. + * features/s390-gs.xml: New file. + * features/s390-gsbc.xml: New file. +--- a/gdb/s390-linux-nat.c ++++ b/gdb/s390-linux-nat.c +@@ -54,6 +54,7 @@ static int have_regset_last_break = 0; + static int have_regset_system_call = 0; + static int have_regset_tdb = 0; + static int have_regset_vxrs = 0; ++static int have_regset_gs = 0; + + /* Register map for 32-bit executables running under a 64-bit + kernel. */ +@@ -406,6 +407,18 @@ s390_linux_fetch_inferior_registers (struct target_ops *ops, + fetch_regset (regcache, tid, NT_S390_VXRS_HIGH, 16 * 16, + &s390_vxrs_high_regset); + } ++ ++ if (have_regset_gs) ++ { ++ if (regnum == -1 || (regnum >= S390_GSD_REGNUM ++ && regnum <= S390_GSEPLA_REGNUM)) ++ fetch_regset (regcache, tid, NT_S390_GS_CB, 4 * 8, ++ &s390_gs_regset); ++ if (regnum == -1 || (regnum >= S390_BC_GSD_REGNUM ++ && regnum <= S390_BC_GSEPLA_REGNUM)) ++ fetch_regset (regcache, tid, NT_S390_GS_BC, 4 * 8, ++ &s390_gsbc_regset); ++ } + } + + /* Store register REGNUM back into the child process. If REGNUM is +@@ -974,8 +987,13 @@ s390_read_description (struct target_ops *ops) + && check_regset (tid, NT_S390_VXRS_LOW, 16 * 8) + && check_regset (tid, NT_S390_VXRS_HIGH, 16 * 16); + ++ have_regset_gs = (hwcap & HWCAP_S390_GS) ++ && check_regset (tid, NT_S390_GS_CB, 4 * 8) ++ && check_regset (tid, NT_S390_GS_BC, 4 * 8); ++ + if (s390_target_wordsize () == 8) +- return (have_regset_vxrs ? ++ return (have_regset_gs ? tdesc_s390x_gs_linux64 : ++ have_regset_vxrs ? + (have_regset_tdb ? tdesc_s390x_tevx_linux64 : + tdesc_s390x_vx_linux64) : + have_regset_tdb ? tdesc_s390x_te_linux64 : +@@ -984,7 +1002,8 @@ s390_read_description (struct target_ops *ops) + tdesc_s390x_linux64); + + if (hwcap & HWCAP_S390_HIGH_GPRS) +- return (have_regset_vxrs ? ++ return (have_regset_gs ? tdesc_s390_gs_linux64 : ++ have_regset_vxrs ? + (have_regset_tdb ? tdesc_s390_tevx_linux64 : + tdesc_s390_vx_linux64) : + have_regset_tdb ? tdesc_s390_te_linux64 : +--- a/gdb/s390-linux-tdep.c ++++ b/gdb/s390-linux-tdep.c +@@ -69,12 +69,14 @@ + #include "features/s390-te-linux64.c" + #include "features/s390-vx-linux64.c" + #include "features/s390-tevx-linux64.c" ++#include "features/s390-gs-linux64.c" + #include "features/s390x-linux64.c" + #include "features/s390x-linux64v1.c" + #include "features/s390x-linux64v2.c" + #include "features/s390x-te-linux64.c" + #include "features/s390x-vx-linux64.c" + #include "features/s390x-tevx-linux64.c" ++#include "features/s390x-gs-linux64.c" + + #define XML_SYSCALL_FILENAME_S390 "syscalls/s390-linux.xml" + #define XML_SYSCALL_FILENAME_S390X "syscalls/s390x-linux.xml" +@@ -113,6 +115,7 @@ struct gdbarch_tdep + int have_linux_v1; + int have_linux_v2; + int have_tdb; ++ bool have_gs; + }; + + +@@ -834,6 +837,24 @@ static const struct regcache_map_entry s390_regmap_vxrs_high[] = + { 0 } + }; + ++static const struct regcache_map_entry s390_regmap_gs[] = ++ { ++ { 1, REGCACHE_MAP_SKIP, 8 }, ++ { 1, S390_GSD_REGNUM, 8 }, ++ { 1, S390_GSSM_REGNUM, 8 }, ++ { 1, S390_GSEPLA_REGNUM, 8 }, ++ { 0 } ++ }; ++ ++static const struct regcache_map_entry s390_regmap_gsbc[] = ++ { ++ { 1, REGCACHE_MAP_SKIP, 8 }, ++ { 1, S390_BC_GSD_REGNUM, 8 }, ++ { 1, S390_BC_GSSM_REGNUM, 8 }, ++ { 1, S390_BC_GSEPLA_REGNUM, 8 }, ++ { 0 } ++ }; ++ + + /* Supply the TDB regset. Like regcache_supply_regset, but invalidate + the TDB registers unless the TDB format field is valid. */ +@@ -905,6 +926,18 @@ const struct regset s390_vxrs_high_regset = { + regcache_collect_regset + }; + ++const struct regset s390_gs_regset = { ++ s390_regmap_gs, ++ regcache_supply_regset, ++ regcache_collect_regset ++}; ++ ++const struct regset s390_gsbc_regset = { ++ s390_regmap_gsbc, ++ regcache_supply_regset, ++ regcache_collect_regset ++}; ++ + /* Iterate over supported core file register note sections. */ + + static void +@@ -951,6 +984,23 @@ s390_iterate_over_regset_sections (struct gdbarch *gdbarch, + cb (".reg-s390-vxrs-high", 16 * 16, &s390_vxrs_high_regset, + "s390 vector registers 16-31", cb_data); + } ++ ++ /* Iterate over the guarded-storage regsets if in "read" mode, or if ++ their registers are available. */ ++ if (tdep->have_gs) ++ { ++ if (regcache == NULL ++ || REG_VALID == regcache_register_status (regcache, ++ S390_GSD_REGNUM)) ++ cb (".reg-s390-gs-cb", 4 * 8, &s390_gs_regset, ++ "s390 guarded-storage registers", cb_data); ++ ++ if (regcache == NULL ++ || REG_VALID == regcache_register_status (regcache, ++ S390_BC_GSD_REGNUM)) ++ cb (".reg-s390-gs-bc", 4 * 8, &s390_gsbc_regset, ++ "s390 guarded-storage broadcast control", cb_data); ++ } + } + + static const struct target_desc * +@@ -959,7 +1009,7 @@ s390_core_read_description (struct gdbarch *gdbarch, + { + asection *section = bfd_get_section_by_name (abfd, ".reg"); + CORE_ADDR hwcap = 0; +- int high_gprs, v1, v2, te, vx; ++ bool high_gprs, v1, v2, te, vx, gs; + + target_auxv_search (target, AT_HWCAP, &hwcap); + if (!section) +@@ -971,12 +1021,14 @@ s390_core_read_description (struct gdbarch *gdbarch, + v2 = (bfd_get_section_by_name (abfd, ".reg-s390-system-call") != NULL); + vx = (hwcap & HWCAP_S390_VX); + te = (hwcap & HWCAP_S390_TE); ++ gs = (hwcap & HWCAP_S390_GS); + + switch (bfd_section_size (abfd, section)) + { + case s390_sizeof_gregset: + if (high_gprs) +- return (te && vx ? tdesc_s390_tevx_linux64 : ++ return (gs ? tdesc_s390_gs_linux64 : ++ te && vx ? tdesc_s390_tevx_linux64 : + vx ? tdesc_s390_vx_linux64 : + te ? tdesc_s390_te_linux64 : + v2 ? tdesc_s390_linux64v2 : +@@ -986,7 +1038,8 @@ s390_core_read_description (struct gdbarch *gdbarch, + v1 ? tdesc_s390_linux32v1 : tdesc_s390_linux32); + + case s390x_sizeof_gregset: +- return (te && vx ? tdesc_s390x_tevx_linux64 : ++ return (gs ? tdesc_s390x_gs_linux64 : ++ te && vx ? tdesc_s390x_tevx_linux64 : + vx ? tdesc_s390x_vx_linux64 : + te ? tdesc_s390x_te_linux64 : + v2 ? tdesc_s390x_linux64v2 : +@@ -7767,6 +7820,7 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) + int have_linux_v2 = 0; + int have_tdb = 0; + int have_vx = 0; ++ int have_gs = 0; + int first_pseudo_reg, last_pseudo_reg; + static const char *const stap_register_prefixes[] = { "%", NULL }; + static const char *const stap_register_indirection_prefixes[] = { "(", +@@ -7834,6 +7888,12 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) + "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", "v24", + "v25", "v26", "v27", "v28", "v29", "v30", "v31", + }; ++ static const char *const gs_cb[] = { ++ "gsd", "gssm", "gsepla", ++ }; ++ static const char *const gs_bc[] = { ++ "bc_gsd", "bc_gssm", "bc_gsepla", ++ }; + const struct tdesc_feature *feature; + int i, valid_p = 1; + +@@ -7937,6 +7997,29 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) + have_vx = 1; + } + ++ /* Guarded-storage registers. */ ++ feature = tdesc_find_feature (tdesc, "org.gnu.gdb.s390.gs"); ++ if (feature) ++ { ++ for (i = 0; i < 3; i++) ++ valid_p &= tdesc_numbered_register (feature, tdesc_data, ++ S390_GSD_REGNUM + i, ++ gs_cb[i]); ++ have_gs = 1; ++ } ++ ++ /* Guarded-storage broadcast control. */ ++ feature = tdesc_find_feature (tdesc, "org.gnu.gdb.s390.gsbc"); ++ if (feature) ++ { ++ valid_p &= have_gs; ++ ++ for (i = 0; i < 3; i++) ++ valid_p &= tdesc_numbered_register (feature, tdesc_data, ++ S390_BC_GSD_REGNUM + i, ++ gs_bc[i]); ++ } ++ + if (!valid_p) + { + tdesc_data_cleanup (tdesc_data); +@@ -7970,6 +8053,8 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) + continue; + if ((tdep->gpr_full_regnum != -1) != have_upper) + continue; ++ if (tdep->have_gs != have_gs) ++ continue; + if (tdesc_data != NULL) + tdesc_data_cleanup (tdesc_data); + return arches->gdbarch; +@@ -7982,6 +8067,7 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) + tdep->have_linux_v1 = have_linux_v1; + tdep->have_linux_v2 = have_linux_v2; + tdep->have_tdb = have_tdb; ++ tdep->have_gs = have_gs; + gdbarch = gdbarch_alloc (&info, tdep); + + set_gdbarch_believe_pcc_promotion (gdbarch, 0); +@@ -8157,10 +8243,12 @@ _initialize_s390_tdep (void) + initialize_tdesc_s390_te_linux64 (); + initialize_tdesc_s390_vx_linux64 (); + initialize_tdesc_s390_tevx_linux64 (); ++ initialize_tdesc_s390_gs_linux64 (); + initialize_tdesc_s390x_linux64 (); + initialize_tdesc_s390x_linux64v1 (); + initialize_tdesc_s390x_linux64v2 (); + initialize_tdesc_s390x_te_linux64 (); + initialize_tdesc_s390x_vx_linux64 (); + initialize_tdesc_s390x_tevx_linux64 (); ++ initialize_tdesc_s390x_gs_linux64 (); + } +--- a/gdb/s390-linux-tdep.h ++++ b/gdb/s390-linux-tdep.h +@@ -33,6 +33,10 @@ + #define HWCAP_S390_VX 2048 + #endif + ++#ifndef HWCAP_S390_GS ++#define HWCAP_S390_GS 16384 ++#endif ++ + /* Register information. */ + + /* Program Status Word. */ +@@ -166,8 +170,14 @@ + #define S390_V29_REGNUM 119 + #define S390_V30_REGNUM 120 + #define S390_V31_REGNUM 121 ++#define S390_GSD_REGNUM 122 ++#define S390_GSSM_REGNUM 123 ++#define S390_GSEPLA_REGNUM 124 ++#define S390_BC_GSD_REGNUM 125 ++#define S390_BC_GSSM_REGNUM 126 ++#define S390_BC_GSEPLA_REGNUM 127 + /* Total. */ +-#define S390_NUM_REGS 122 ++#define S390_NUM_REGS 128 + + /* Special register usage. */ + #define S390_SP_REGNUM S390_R15_REGNUM +@@ -198,6 +208,8 @@ extern const struct regset s390_tdb_regset; + #define s390_sizeof_tdbregset 0x100 + extern const struct regset s390_vxrs_low_regset; + extern const struct regset s390_vxrs_high_regset; ++extern const struct regset s390_gs_regset; ++extern const struct regset s390_gsbc_regset; + + /* GNU/Linux target descriptions. */ + extern struct target_desc *tdesc_s390_linux32; +@@ -209,11 +221,13 @@ extern struct target_desc *tdesc_s390_linux64v2; + extern struct target_desc *tdesc_s390_te_linux64; + extern struct target_desc *tdesc_s390_vx_linux64; + extern struct target_desc *tdesc_s390_tevx_linux64; ++extern struct target_desc *tdesc_s390_gs_linux64; + extern struct target_desc *tdesc_s390x_linux64; + extern struct target_desc *tdesc_s390x_linux64v1; + extern struct target_desc *tdesc_s390x_linux64v2; + extern struct target_desc *tdesc_s390x_te_linux64; + extern struct target_desc *tdesc_s390x_vx_linux64; + extern struct target_desc *tdesc_s390x_tevx_linux64; ++extern struct target_desc *tdesc_s390x_gs_linux64; + + #endif diff --git a/SOURCES/gdb-rhbz1498758-4of5.patch b/SOURCES/gdb-rhbz1498758-4of5.patch new file mode 100755 index 0000000..ec698bc --- /dev/null +++ b/SOURCES/gdb-rhbz1498758-4of5.patch @@ -0,0 +1,275 @@ +commit ad3396348e0ebb61fdf71cff307bac08175ed366 +Author: Andreas Arnez +Date: Mon Sep 25 16:02:23 2017 +0200 + + S390: Add guarded-storage register support to gdbserver + + Enable gdbserver to deal with the new guarded-storage register sets. + + gdb/gdbserver/ChangeLog: + + * configure.srv (s390*-*-linux*): Add s390-gs-linux64.o and + s390x-gs-linux64.o to srv_regobj. Add s390-gs-linux64.xml, + s390x-gs-linux64.xml, s390-gs.xml, and s390-gsbc.xml to + srv_xmlfiles. Add s390-gs-linux64-ipa.o and + s390x-gs-linux64-ipa.o to ipa_obj. + * linux-s390-low.c (HWCAP_S390_GS): New define. + (s390_fill_gs, s390_store_gs, s390_fill_gsbc, s390_store_gsbc): + New functions. + (s390_regsets): Add regsets for NT_S390_GS_CB and NT_S390_GS_BC. + (s390_arch_setup): Check for guarded-storage support and choose + appropriate tdesc. + (initialize_low_arch): Invoke init_registers_s390_gs_linux64 and + init_registers_s390x_gs_linux64. + * linux-s390-tdesc.h (enum s390_linux_tdesc) : New + enum value. + (init_registers_s390x_gs_linux64, tdesc_s390x_gs_linux64) + (init_registers_s390_gs_linux64, tdesc_s390_gs_linux64): Declare. + +### a/gdb/gdbserver/ChangeLog +### b/gdb/gdbserver/ChangeLog +## -1,3 +1,23 @@ ++2017-09-25 Andreas Arnez ++ ++ * configure.srv (s390*-*-linux*): Add s390-gs-linux64.o and ++ s390x-gs-linux64.o to srv_regobj. Add s390-gs-linux64.xml, ++ s390x-gs-linux64.xml, s390-gs.xml, and s390-gsbc.xml to ++ srv_xmlfiles. Add s390-gs-linux64-ipa.o and ++ s390x-gs-linux64-ipa.o to ipa_obj. ++ * linux-s390-low.c (HWCAP_S390_GS): New define. ++ (s390_fill_gs, s390_store_gs, s390_fill_gsbc, s390_store_gsbc): ++ New functions. ++ (s390_regsets): Add regsets for NT_S390_GS_CB and NT_S390_GS_BC. ++ (s390_arch_setup): Check for guarded-storage support and choose ++ appropriate tdesc. ++ (initialize_low_arch): Invoke init_registers_s390_gs_linux64 and ++ init_registers_s390x_gs_linux64. ++ * linux-s390-tdesc.h (enum s390_linux_tdesc) : New ++ enum value. ++ (init_registers_s390x_gs_linux64, tdesc_s390x_gs_linux64) ++ (init_registers_s390_gs_linux64, tdesc_s390_gs_linux64): Declare. ++ + 2017-09-22 Simon Marchi + + * win32-i386-low.c (i386_arch_setup): Call init_target_desc. +--- a/gdb/gdbserver/configure.srv ++++ b/gdb/gdbserver/configure.srv +@@ -285,12 +285,14 @@ case "${target}" in + srv_regobj="${srv_regobj} s390-te-linux64.o" + srv_regobj="${srv_regobj} s390-vx-linux64.o" + srv_regobj="${srv_regobj} s390-tevx-linux64.o" ++ srv_regobj="${srv_regobj} s390-gs-linux64.o" + srv_regobj="${srv_regobj} s390x-linux64.o" + srv_regobj="${srv_regobj} s390x-linux64v1.o" + srv_regobj="${srv_regobj} s390x-linux64v2.o" + srv_regobj="${srv_regobj} s390x-te-linux64.o" + srv_regobj="${srv_regobj} s390x-vx-linux64.o" + srv_regobj="${srv_regobj} s390x-tevx-linux64.o" ++ srv_regobj="${srv_regobj} s390x-gs-linux64.o" + srv_tgtobj="$srv_linux_obj linux-s390-low.o" + srv_xmlfiles="s390-linux32.xml" + srv_xmlfiles="${srv_xmlfiles} s390-linux32v1.xml" +@@ -301,12 +303,14 @@ case "${target}" in + srv_xmlfiles="${srv_xmlfiles} s390-te-linux64.xml" + srv_xmlfiles="${srv_xmlfiles} s390-vx-linux64.xml" + srv_xmlfiles="${srv_xmlfiles} s390-tevx-linux64.xml" ++ srv_xmlfiles="${srv_xmlfiles} s390-gs-linux64.xml" + srv_xmlfiles="${srv_xmlfiles} s390x-linux64.xml" + srv_xmlfiles="${srv_xmlfiles} s390x-linux64v1.xml" + srv_xmlfiles="${srv_xmlfiles} s390x-linux64v2.xml" + srv_xmlfiles="${srv_xmlfiles} s390x-te-linux64.xml" + srv_xmlfiles="${srv_xmlfiles} s390x-vx-linux64.xml" + srv_xmlfiles="${srv_xmlfiles} s390x-tevx-linux64.xml" ++ srv_xmlfiles="${srv_xmlfiles} s390x-gs-linux64.xml" + srv_xmlfiles="${srv_xmlfiles} s390-core32.xml" + srv_xmlfiles="${srv_xmlfiles} s390-core64.xml" + srv_xmlfiles="${srv_xmlfiles} s390x-core64.xml" +@@ -314,6 +318,8 @@ case "${target}" in + srv_xmlfiles="${srv_xmlfiles} s390-fpr.xml" + srv_xmlfiles="${srv_xmlfiles} s390-tdb.xml" + srv_xmlfiles="${srv_xmlfiles} s390-vx.xml" ++ srv_xmlfiles="${srv_xmlfiles} s390-gs.xml" ++ srv_xmlfiles="${srv_xmlfiles} s390-gsbc.xml" + srv_linux_usrregs=yes + srv_linux_regsets=yes + srv_linux_thread_db=yes +@@ -327,12 +333,14 @@ case "${target}" in + ipa_obj="${ipa_obj} s390-vx-linux64-ipa.o" + ipa_obj="${ipa_obj} s390-te-linux64-ipa.o" + ipa_obj="${ipa_obj} s390-tevx-linux64-ipa.o" ++ ipa_obj="${ipa_obj} s390-gs-linux64-ipa.o" + ipa_obj="${ipa_obj} s390x-linux64-ipa.o" + ipa_obj="${ipa_obj} s390x-linux64v1-ipa.o" + ipa_obj="${ipa_obj} s390x-linux64v2-ipa.o" + ipa_obj="${ipa_obj} s390x-vx-linux64-ipa.o" + ipa_obj="${ipa_obj} s390x-te-linux64-ipa.o" + ipa_obj="${ipa_obj} s390x-tevx-linux64-ipa.o" ++ ipa_obj="${ipa_obj} s390x-gs-linux64-ipa.o" + ;; + sh*-*-linux*) srv_regobj=reg-sh.o + srv_tgtobj="$srv_linux_obj linux-sh-low.o" +--- a/gdb/gdbserver/linux-s390-low.c ++++ b/gdb/gdbserver/linux-s390-low.c +@@ -45,6 +45,10 @@ + #define HWCAP_S390_VX 2048 + #endif + ++#ifndef HWCAP_S390_GS ++#define HWCAP_S390_GS 16384 ++#endif ++ + #define s390_num_regs 52 + + static int s390_regmap[] = { +@@ -370,6 +374,46 @@ s390_store_vxrs_high (struct regcache *regcache, const void *buf) + supply_register (regcache, v16 + i, (const char *) buf + 16 * i); + } + ++static void ++s390_fill_gs (struct regcache *regcache, void *buf) ++{ ++ int gsd = find_regno (regcache->tdesc, "gsd"); ++ int i; ++ ++ for (i = 0; i < 3; i++) ++ collect_register (regcache, gsd + i, (char *) buf + 8 * (i + 1)); ++} ++ ++static void ++s390_store_gs (struct regcache *regcache, const void *buf) ++{ ++ int gsd = find_regno (regcache->tdesc, "gsd"); ++ int i; ++ ++ for (i = 0; i < 3; i++) ++ supply_register (regcache, gsd + i, (const char *) buf + 8 * (i + 1)); ++} ++ ++static void ++s390_fill_gsbc (struct regcache *regcache, void *buf) ++{ ++ int bc_gsd = find_regno (regcache->tdesc, "bc_gsd"); ++ int i; ++ ++ for (i = 0; i < 3; i++) ++ collect_register (regcache, bc_gsd + i, (char *) buf + 8 * (i + 1)); ++} ++ ++static void ++s390_store_gsbc (struct regcache *regcache, const void *buf) ++{ ++ int bc_gsd = find_regno (regcache->tdesc, "bc_gsd"); ++ int i; ++ ++ for (i = 0; i < 3; i++) ++ supply_register (regcache, bc_gsd + i, (const char *) buf + 8 * (i + 1)); ++} ++ + static struct regset_info s390_regsets[] = { + { 0, 0, 0, 0, GENERAL_REGS, s390_fill_gregset, NULL }, + #ifndef __s390x__ +@@ -388,6 +432,10 @@ static struct regset_info s390_regsets[] = { + EXTENDED_REGS, s390_fill_vxrs_low, s390_store_vxrs_low }, + { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_S390_VXRS_HIGH, 0, + EXTENDED_REGS, s390_fill_vxrs_high, s390_store_vxrs_high }, ++ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_S390_GS_CB, 0, ++ EXTENDED_REGS, s390_fill_gs, s390_store_gs }, ++ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_S390_GS_BC, 0, ++ EXTENDED_REGS, s390_fill_gsbc, s390_store_gsbc }, + NULL_REGSET + }; + +@@ -501,6 +549,8 @@ s390_arch_setup (void) + int have_regset_tdb = s390_check_regset (pid, NT_S390_TDB, 256); + int have_regset_vxrs = s390_check_regset (pid, NT_S390_VXRS_LOW, 128) + && s390_check_regset (pid, NT_S390_VXRS_HIGH, 256); ++ int have_regset_gs = s390_check_regset (pid, NT_S390_GS_CB, 32) ++ && s390_check_regset (pid, NT_S390_GS_BC, 32); + + /* Assume 31-bit inferior process. */ + if (have_regset_system_call) +@@ -529,8 +579,13 @@ s390_arch_setup (void) + if (have_regset_vxrs) + have_regset_vxrs = + (s390_get_hwcap (tdesc_s390x_linux64v2) & HWCAP_S390_VX) != 0; ++ if (have_regset_gs) ++ have_regset_gs = ++ (s390_get_hwcap (tdesc_s390x_linux64v2) & HWCAP_S390_GS) != 0; + +- if (have_regset_vxrs) ++ if (have_regset_gs) ++ tdesc = tdesc_s390x_gs_linux64; ++ else if (have_regset_vxrs) + tdesc = (have_regset_tdb ? tdesc_s390x_tevx_linux64 : + tdesc_s390x_vx_linux64); + else if (have_regset_tdb) +@@ -554,8 +609,12 @@ s390_arch_setup (void) + have_regset_tdb = (s390_get_hwcap (tdesc) & HWCAP_S390_TE) != 0; + if (have_regset_vxrs) + have_regset_vxrs = (s390_get_hwcap (tdesc) & HWCAP_S390_VX) != 0; ++ if (have_regset_gs) ++ have_regset_gs = (s390_get_hwcap (tdesc) & HWCAP_S390_GS) != 0; + +- if (have_regset_vxrs) ++ if (have_regset_gs) ++ tdesc = tdesc_s390_gs_linux64; ++ else if (have_regset_vxrs) + tdesc = (have_regset_tdb ? tdesc_s390_tevx_linux64 : + tdesc_s390_vx_linux64); + else if (have_regset_tdb) +@@ -596,6 +655,9 @@ s390_arch_setup (void) + case NT_S390_VXRS_HIGH: + regset->size = have_regset_vxrs ? 256 : 0; + break; ++ case NT_S390_GS_CB: ++ case NT_S390_GS_BC: ++ regset->size = have_regset_gs ? 32 : 0; + default: + break; + } +@@ -2797,6 +2859,7 @@ initialize_low_arch (void) + init_registers_s390_te_linux64 (); + init_registers_s390_vx_linux64 (); + init_registers_s390_tevx_linux64 (); ++ init_registers_s390_gs_linux64 (); + #ifdef __s390x__ + init_registers_s390x_linux64 (); + init_registers_s390x_linux64v1 (); +@@ -2804,6 +2867,7 @@ initialize_low_arch (void) + init_registers_s390x_te_linux64 (); + init_registers_s390x_vx_linux64 (); + init_registers_s390x_tevx_linux64 (); ++ init_registers_s390x_gs_linux64 (); + #endif + + initialize_regsets_info (&s390_regsets_info); +--- a/gdb/gdbserver/linux-s390-tdesc.h ++++ b/gdb/gdbserver/linux-s390-tdesc.h +@@ -31,6 +31,7 @@ enum s390_linux_tdesc { + S390_TDESC_TE, + S390_TDESC_VX, + S390_TDESC_TEVX, ++ S390_TDESC_GS, + }; + + #ifdef __s390x__ +@@ -59,6 +60,10 @@ extern const struct target_desc *tdesc_s390x_vx_linux64; + void init_registers_s390x_tevx_linux64 (void); + extern const struct target_desc *tdesc_s390x_tevx_linux64; + ++/* Defined in auto-generated file s390x-gs-linux64.c. */ ++void init_registers_s390x_gs_linux64 (void); ++extern const struct target_desc *tdesc_s390x_gs_linux64; ++ + #endif + + #if !defined __s390x__ || !defined IN_PROCESS_AGENT +@@ -99,4 +104,8 @@ extern const struct target_desc *tdesc_s390_vx_linux64; + void init_registers_s390_tevx_linux64 (void); + extern const struct target_desc *tdesc_s390_tevx_linux64; + ++/* Defined in auto-generated file s390-gs-linux64.c. */ ++void init_registers_s390_gs_linux64 (void); ++extern const struct target_desc *tdesc_s390_gs_linux64; ++ + #endif diff --git a/SOURCES/gdb-rhbz1498758-5of5.patch b/SOURCES/gdb-rhbz1498758-5of5.patch new file mode 100644 index 0000000..1b59121 --- /dev/null +++ b/SOURCES/gdb-rhbz1498758-5of5.patch @@ -0,0 +1,63 @@ +commit 289e23aa03084b22c73ebdcf18371f1e6666ead0 +Author: Andreas Arnez +Date: Mon Sep 25 16:02:24 2017 +0200 + + S390: Document guarded-storage register support + + This documents the newly added support for guarded-storage registers on + IBM z. + + gdb/ChangeLog: + + * NEWS: Advertise support for guarded-storage registers on IBM z. + + gdb/doc/ChangeLog: + + * gdb.texinfo (S/390 and System z Features): Document the new + features org.gnu.gdb.s390.gs and org.gnu.gdb.s390.gsbc. + +### a/gdb/ChangeLog +### b/gdb/ChangeLog +## -1,5 +1,9 @@ + 2017-09-25 Andreas Arnez + ++ * NEWS: Advertise support for guarded-storage registers on IBM z. ++ ++2017-09-25 Andreas Arnez ++ + * s390-linux-nat.c (have_regset_gs): New static variable. + (s390_linux_fetch_inferior_registers): Handle guarded-storage + control block and guarded-storage broadcast control regsets. +Index: gdb-8.0.1/gdb/NEWS +=================================================================== +--- gdb-8.0.1.orig/gdb/NEWS 2017-10-07 15:54:48.649165644 +0200 ++++ gdb-8.0.1/gdb/NEWS 2017-10-07 15:55:01.006264129 +0200 +@@ -3,6 +3,9 @@ + + * Fortran: Support pointers to dynamic types. + ++* GDB now supports access to the guarded-storage-control registers and the ++ software-based guarded-storage broadcast control registers on IBM z14. ++ + *** Changes in GDB 8.0 + + * GDB now supports access to the PKU register on GNU/Linux. The register is +Index: gdb-8.0.1/gdb/doc/gdb.texinfo +=================================================================== +--- gdb-8.0.1.orig/gdb/doc/gdb.texinfo 2017-10-07 15:54:44.891135692 +0200 ++++ gdb-8.0.1/gdb/doc/gdb.texinfo 2017-10-07 15:54:48.660165731 +0200 +@@ -41512,6 +41512,14 @@ + contain the 128-bit wide vector registers @samp{v16} through + @samp{v31}. + ++The @samp{org.gnu.gdb.s390.gs} feature is optional. It should contain ++the 64-bit wide guarded-storage-control registers @samp{gsd}, ++@samp{gssm}, and @samp{gsepla}. ++ ++The @samp{org.gnu.gdb.s390.gsbc} feature is optional. It should contain ++the 64-bit wide guarded-storage broadcast control registers ++@samp{bc_gsd}, @samp{bc_gssm}, and @samp{bc_gsepla}. ++ + @node Sparc Features + @subsection Sparc Features + @cindex target descriptions, sparc32 features diff --git a/SOURCES/gdb-rhbz1542149-spawn-default-signal-handlers-regression.patch b/SOURCES/gdb-rhbz1542149-spawn-default-signal-handlers-regression.patch new file mode 100644 index 0000000..a8c5164 --- /dev/null +++ b/SOURCES/gdb-rhbz1542149-spawn-default-signal-handlers-regression.patch @@ -0,0 +1,320 @@ +commit e379cee61f3890e535e995828e8846b020ef2a32 +Author: Pedro Alves +Date: Fri Jan 5 18:26:18 2018 +0000 + + Fix regression: cannot start with LD_PRELOAD=libSegFault.so (PR gdb/18653#c7) + + At https://sourceware.org/bugzilla/show_bug.cgi?id=18653#c7, Andrew + reports that the fix for PR gdb/18653 made GDB useless if you preload + libSegFault.so, because GDB internal-errors on startup: + + $ LD_PRELOAD=libSegFault.so gdb + src/gdb/common/signals-state-save-restore.c:64: internal-error: unexpected signal handler + A problem internal to GDB has been detected, + further debugging may prove unreliable. + Aborted (core dumped) + $ + + The internal error comes from the code saving the signal dispositions + inherited from gdb's parent: + + (top-gdb) bt + #0 0x000000000056b001 in internal_error(char const*, int, char const*, ...) (file=0xaf5f38 "src/gdb/common/signals-state-save-restore.c", line=64, fmt=0xaf5f18 "unexpected signal handler") at src/gdb/common/errors.c:54 + #1 0x00000000005752c9 in save_original_signals_state() () at src/gdb/common/signals-state-save-restore.c:64 + #2 0x00000000007425de in captured_main_1(captured_main_args*) (context=0x7fffffffd860) + at src/gdb/main.c:509 + #3 0x0000000000743622 in captured_main(void*) (data=0x7fffffffd860) at src/gdb/main.c:1145 + During symbol reading, cannot get low and high bounds for subprogram DIE at 24065. + #4 0x00000000007436f9 in gdb_main(captured_main_args*) (args=0x7fffffffd860) at src/gdb/main.c:1171 + #5 0x0000000000413acd in main(int, char**) (argc=1, argv=0x7fffffffd968) at src/gdb/gdb.c:32 + + This commit downgrades the internal error to a warning. You'll get + instead: + + ~~~ + $ LD_PRELOAD=libSegFault.so gdb + warning: Found custom handler for signal 11 (Segmentation fault) preinstalled. + Some signal dispositions inherited from the environment (SIG_DFL/SIG_IGN) + won't be propagated to spawned programs. + GNU gdb (GDB) 8.0.50.20171213-git + Copyright (C) 2017 Free Software Foundation, Inc. + License GPLv3+: GNU GPL version 3 or later + This is free software: you are free to change and redistribute it. + There is NO WARRANTY, to the extent permitted by law. Type "show copying" + and "show warranty" for details. + This GDB was configured as "x86_64-pc-linux-gnu". + Type "show configuration" for configuration details. + For bug reporting instructions, please see: + . + Find the GDB manual and other documentation resources online at: + . + For help, type "help". + Type "apropos word" to search for commands related to "word"... + (gdb) + ~~~ + + This also moves the location where save_original_signals_state is + called a bit further below (to after option processing), so that "-q" + disables the warning: + + ~~~ + $ LD_PRELOAD=libSegFault.so gdb -q + (gdb) + ~~~ + + New testcase included. + + gdb/ChangeLog: + 2018-01-05 Pedro Alves + + PR gdb/18653 + * common/signals-state-save-restore.c + (save_original_signals_state): New parameter 'quiet'. Warn if we + find a custom handler preinstalled, instead of internal erroring. + But only warn if !quiet. + * common/signals-state-save-restore.h + (save_original_signals_state): New parameter 'quiet'. + * main.c (captured_main_1): Move save_original_signals_state call + after option handling, and pass QUIET. + + gdb/gdbserver/ChangeLog: + 2018-01-05 Pedro Alves + + PR gdb/18653 + * server.c (captured_main): Pass quiet=false to + save_original_signals_state. + + gdb/testsuite/ChangeLog: + 2018-01-05 Pedro Alves + + PR gdb/18653 + * gdb.base/libsegfault.exp: New. + +### a/gdb/ChangeLog +### b/gdb/ChangeLog +## -1,3 +1,15 @@ ++2018-01-05 Pedro Alves ++ ++ PR gdb/18653 ++ * common/signals-state-save-restore.c ++ (save_original_signals_state): New parameter 'quiet'. Warn if we ++ find a custom handler preinstalled, instead of internal erroring. ++ But only warn if !quiet. ++ * common/signals-state-save-restore.h ++ (save_original_signals_state): New parameter 'quiet'. ++ * main.c (captured_main_1): Move save_original_signals_state call ++ after option handling, and pass QUIET. ++ + 2018-01-05 Pedro Alves + + * spu-tdep.c (spu_catch_start): Pass +--- a/gdb/common/signals-state-save-restore.c ++++ b/gdb/common/signals-state-save-restore.c +@@ -35,7 +35,7 @@ static sigset_t original_signal_mask; + /* See signals-state-save-restore.h. */ + + void +-save_original_signals_state (void) ++save_original_signals_state (bool quiet) + { + #ifdef HAVE_SIGACTION + int i; +@@ -45,6 +45,8 @@ save_original_signals_state (void) + if (res == -1) + perror_with_name (("sigprocmask")); + ++ bool found_preinstalled = false; ++ + for (i = 1; i < NSIG; i++) + { + struct sigaction *oldact = &original_signal_actions[i]; +@@ -59,9 +61,31 @@ save_original_signals_state (void) + perror_with_name (("sigaction")); + + /* If we find a custom signal handler already installed, then +- this function was called too late. */ +- if (oldact->sa_handler != SIG_DFL && oldact->sa_handler != SIG_IGN) +- internal_error (__FILE__, __LINE__, _("unexpected signal handler")); ++ this function was called too late. This is a warning instead ++ of an internal error because this can also happen if you ++ LD_PRELOAD a library that installs a signal handler early via ++ __attribute__((constructor)), like libSegFault.so. */ ++ if (!quiet ++ && oldact->sa_handler != SIG_DFL ++ && oldact->sa_handler != SIG_IGN) ++ { ++ found_preinstalled = true; ++ ++ /* Use raw fprintf here because we're being called in early ++ startup, because GDB's filtered streams are are ++ created. */ ++ fprintf (stderr, ++ _("warning: Found custom handler for signal " ++ "%d (%s) preinstalled.\n"), i, ++ strsignal (i)); ++ } ++ } ++ ++ if (found_preinstalled) ++ { ++ fprintf (stderr, _("\ ++Some signal dispositions inherited from the environment (SIG_DFL/SIG_IGN)\n\ ++won't be propagated to spawned programs.\n")); + } + #endif + } +--- a/gdb/common/signals-state-save-restore.h ++++ b/gdb/common/signals-state-save-restore.h +@@ -28,9 +28,10 @@ + back to what was originally inherited from gdb/gdbserver's parent, + just before execing the target program to debug. */ + +-/* Save the signal state of all signals. */ ++/* Save the signal state of all signals. If !QUIET, warn if we detect ++ a custom signal handler preinstalled. */ + +-extern void save_original_signals_state (void); ++extern void save_original_signals_state (bool quiet); + + /* Restore the signal state of all signals. */ + +### a/gdb/gdbserver/ChangeLog +### b/gdb/gdbserver/ChangeLog +## -1,3 +1,9 @@ ++2018-01-05 Pedro Alves ++ ++ PR gdb/18653 ++ * server.c (captured_main): Pass quiet=false to ++ save_original_signals_state. ++ + 2018-01-01 Joel Brobecker + + * gdbreplay.c (gdbreplay_version): Update copyright year in +--- a/gdb/gdbserver/server.c ++++ b/gdb/gdbserver/server.c +@@ -3712,7 +3712,7 @@ captured_main (int argc, char *argv[]) + opened by remote_prepare. */ + notice_open_fds (); + +- save_original_signals_state (); ++ save_original_signals_state (false); + + /* We need to know whether the remote connection is stdio before + starting the inferior. Inferiors created in this scenario have +--- a/gdb/main.c ++++ b/gdb/main.c +@@ -506,7 +506,6 @@ captured_main_1 (struct captured_main_args *context) + + bfd_init (); + notice_open_fds (); +- save_original_signals_state (); + + saved_command_line = (char *) xstrdup (""); + +@@ -849,6 +848,8 @@ captured_main_1 (struct captured_main_args *context) + quiet = 1; + } + ++ save_original_signals_state (quiet); ++ + /* Try to set up an alternate signal stack for SIGSEGV handlers. */ + setup_alternate_signal_stack (); + +### a/gdb/testsuite/ChangeLog +### b/gdb/testsuite/ChangeLog +## -1,3 +1,8 @@ ++2018-01-05 Pedro Alves ++ ++ PR gdb/18653 ++ * gdb.base/libsegfault.exp: New. ++ + 2018-01-05 Joel Brobecker + + PR gdb/22670 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/libsegfault.exp +@@ -0,0 +1,84 @@ ++# Copyright 2017-2018 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 . ++ ++# This file is part of the gdb testsuite. ++ ++# Test that GDB tolerates being started with libSegFault.so preloaded ++# with LD_PRELOAD, and that GDB warns about a custom SIGSEGV custom ++# handler. See PR gdb/18653 ++# . ++ ++# We cannot expect remote hosts to see environment variables set on ++# the local machine. ++if { [is_remote host] } { ++ unsupported "can't set environment variables on remote host" ++ return -1 ++} ++ ++# Spawn GDB with LIB preloaded with LD_PRELOAD. CMDLINE_OPTS are ++# command line options passed to GDB. ++ ++proc gdb_spawn_with_ld_preload {lib cmdline_opts} { ++ global env ++ ++ save_vars { env(LD_PRELOAD) } { ++ if { ![info exists env(LD_PRELOAD) ] ++ || $env(LD_PRELOAD) == "" } { ++ set env(LD_PRELOAD) "$lib" ++ } else { ++ append env(LD_PRELOAD) ":$lib" ++ } ++ ++ gdb_spawn_with_cmdline_opts $cmdline_opts ++ } ++} ++ ++proc test_libsegfault {} { ++ global gdb_prompt ++ ++ set libsegfault "libSegFault.so" ++ ++ # When started normally, if libSegFault.so is preloaded, GDB ++ # should warn about not being able to propagate the signal ++ # disposition of SIGSEGV. ++ gdb_exit ++ gdb_spawn_with_ld_preload $libsegfault "" ++ ++ set test "gdb emits custom handler warning" ++ gdb_test_multiple "" $test { ++ -re "cannot be preloaded.*\r\n$gdb_prompt $" { ++ # Glibc 2.22 outputs: ++ # ERROR: ld.so: object 'libSegFault.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored. ++ untested "cannot preload libSegFault.so" ++ return ++ } ++ -re "Found custom handler.*won't be propagated.*\r\n$gdb_prompt $" { ++ pass $test ++ } ++ } ++ ++ # "-q" should disable the warning, though. ++ gdb_exit ++ gdb_spawn_with_ld_preload $libsegfault "-q" ++ ++ set test "quiet suppresses custom handler warning" ++ gdb_test_multiple "" $test { ++ -re "^$gdb_prompt $" { ++ pass $test ++ } ++ } ++} ++ ++test_libsegfault diff --git a/SOURCES/gdb-upstream.patch b/SOURCES/gdb-upstream.patch index aa48ef0..ae20090 100644 --- a/SOURCES/gdb-upstream.patch +++ b/SOURCES/gdb-upstream.patch @@ -74,3 +74,461 @@ Date: Wed Aug 9 05:01:55 2017 -0700 || attr->form == DW_FORM_GNU_strp_alt) str = DW_STRING (attr); else + + + +commit f24b864960e61f9a91f8c168c1afe12a6676ad7a +Author: Walfred Tedeschi +Date: Mon Oct 16 08:59:38 2017 +0200 + + PR22137: gdbserver crashes on host with pkru register. + + This patch adds missing backslash on a makefile and regenerate the + files created via the xml files. Those were not in sync with the xml file. + + gdb/ChangeLog: + + 2017-10-16 Walfred Tedeschi + + * features/Makefile (i386-avx-mpx-avx512-pku.dat): Add backslash + at the end of the line. + * regformats/i386/amd64-avx-mpx-avx512-pku-linux.dat: Regenerate. + * regformats/i386/amd64-avx-mpx-avx512-pku.dat: Regenerate. + +### a/gdb/ChangeLog +### b/gdb/ChangeLog +## -1,3 +1,10 @@ ++2017-10-16 Walfred Tedeschi ++ ++ * features/Makefile (i386-avx-mpx-avx512-pku.dat): Add backslash ++ at the end of the line. ++ * regformats/i386/amd64-avx-mpx-avx512-pku-linux.dat: Regenerate. ++ * regformats/i386/amd64-avx-mpx-avx512-pku.dat: Regenerate. ++ + 2017-09-07 Joel Brobecker + + * version.in: Set GDB version number to 8.0.1.DATE-git. +--- a/gdb/features/Makefile ++++ b/gdb/features/Makefile +@@ -281,7 +281,7 @@ $(outdir)/i386/i386-avx-avx512.dat: i386/32bit-core.xml i386/32bit-avx.xml \ + i386/32bit-avx512.xml + $(outdir)/i386/i386-avx-avx512-linux.dat: i386/32bit-core.xml i386/32bit-avx.xml \ + i386/32bit-linux.xml i386/32bit-avx512.xml +-$(outdir)/i386/i386-avx-mpx-avx512-pku.dat: i386/32bit-core.xml ++$(outdir)/i386/i386-avx-mpx-avx512-pku.dat: i386/32bit-core.xml \ + i386/32bit-avx.xml i386/32bit-mpx.xml i386/32bit-avx512.xml \ + i386/32bit-pkeys.xml + $(outdir)/i386/i386-avx-mpx-avx512-pku-linux.dat: i386/32bit-core.xml \ +--- a/gdb/regformats/i386/amd64-avx-mpx-avx512-pku-linux.dat ++++ b/gdb/regformats/i386/amd64-avx-mpx-avx512-pku-linux.dat +@@ -157,3 +157,4 @@ expedite:rbp,rsp,rip + 256:zmm29h + 256:zmm30h + 256:zmm31h ++32:pkru +--- a/gdb/regformats/i386/amd64-avx-mpx-avx512-pku.dat ++++ b/gdb/regformats/i386/amd64-avx-mpx-avx512-pku.dat +@@ -60,9 +60,6 @@ expedite:rbp,rsp,rip + 128:xmm14 + 128:xmm15 + 32:mxcsr +-64:orig_rax +-64:fs_base +-64:gs_base + 128:ymm0h + 128:ymm1h + 128:ymm2h + + + +commit 50a1fdd59c1777672a9be0e81fe2301c2a115fce +Author: Pedro Alves +Date: Mon Dec 4 15:59:20 2017 +0000 + + Fix displaced-stepping RIP-relative VEX-encoded instructions (AVX) (PR gdb/22499) + + PR gdb/22499 is about a latent bug exposed by the switch to "maint set + target-non-stop on" by default on x86-64 GNU/Linux, a while ago. With + that on, GDB is also preferring to use displaced-stepping by default. + + The testcase in the bug is failing because GDB ends up incorrectly + displaced-stepping over a RIP-relative VEX-encoded instruction, like + this: + + 0x00000000004007f5 <+15>: c5 fb 10 05 8b 01 00 00 vmovsd 0x18b(%rip),%xmm0 # 0x400988 + + While RIP-relative instructions need adjustment when relocated to the + scratch pad, GDB ends up just copying VEX-encoded instructions to the + scratch pad unmodified, with the end result that the inferior ends up + executing an instruction that fetches/writes memory from the wrong + address... + + This patch teaches GDB about the VEX-encoding prefixes, fixing the + problem, and adds a testcase that fails without the GDB fix. + + I think we may need a similar treatment for EVEX-encoded instructions, + but I didn't address that simply because I couldn't find any + EVEX-encoded RIP-relative instruction in the gas testsuite. In any + case, this commit is forward progress as-is already. + + gdb/ChangeLog: + 2017-12-04 Pedro Alves + + PR gdb/22499 + * amd64-tdep.c (amd64_insn::rex_offset): Rename to... + (amd64_insn::enc_prefix_offset): ... this, and tweak comment. + (vex2_prefix_p, vex3_prefix_p): New functions. + (amd64_get_insn_details): Adjust to rename. Also skip VEX2 and + VEX3 prefixes. + (fixup_riprel): Set VEX3.!B. + + gdb/testsuite/ChangeLog: + 2017-12-04 Pedro Alves + + PR gdb/22499 + * gdb.arch/amd64-disp-step-avx.S: New file. + * gdb.arch/amd64-disp-step-avx.exp: New file. + +### a/gdb/ChangeLog +### b/gdb/ChangeLog +## -1,3 +1,13 @@ ++2017-12-04 Pedro Alves ++ ++ PR gdb/22499 ++ * amd64-tdep.c (amd64_insn::rex_offset): Rename to... ++ (amd64_insn::enc_prefix_offset): ... this, and tweak comment. ++ (vex2_prefix_p, vex3_prefix_p): New functions. ++ (amd64_get_insn_details): Adjust to rename. Also skip VEX2 and ++ VEX3 prefixes. ++ (fixup_riprel): Set VEX3.!B. ++ + 2017-12-03 Simon Marchi + + * target.h (mem_region_vector): Remove. +--- a/gdb/amd64-tdep.c ++++ b/gdb/amd64-tdep.c +@@ -1037,8 +1037,9 @@ struct amd64_insn + { + /* The number of opcode bytes. */ + int opcode_len; +- /* The offset of the rex prefix or -1 if not present. */ +- int rex_offset; ++ /* The offset of the REX/VEX instruction encoding prefix or -1 if ++ not present. */ ++ int enc_prefix_offset; + /* The offset to the first opcode byte. */ + int opcode_offset; + /* The offset to the modrm byte or -1 if not present. */ +@@ -1124,6 +1125,22 @@ rex_prefix_p (gdb_byte pfx) + return REX_PREFIX_P (pfx); + } + ++/* True if PFX is the start of the 2-byte VEX prefix. */ ++ ++static bool ++vex2_prefix_p (gdb_byte pfx) ++{ ++ return pfx == 0xc5; ++} ++ ++/* True if PFX is the start of the 3-byte VEX prefix. */ ++ ++static bool ++vex3_prefix_p (gdb_byte pfx) ++{ ++ return pfx == 0xc4; ++} ++ + /* Skip the legacy instruction prefixes in INSN. + We assume INSN is properly sentineled so we don't have to worry + about falling off the end of the buffer. */ +@@ -1242,19 +1259,30 @@ amd64_get_insn_details (gdb_byte *insn, struct amd64_insn *details) + details->raw_insn = insn; + + details->opcode_len = -1; +- details->rex_offset = -1; ++ details->enc_prefix_offset = -1; + details->opcode_offset = -1; + details->modrm_offset = -1; + + /* Skip legacy instruction prefixes. */ + insn = amd64_skip_prefixes (insn); + +- /* Skip REX instruction prefix. */ ++ /* Skip REX/VEX instruction encoding prefixes. */ + if (rex_prefix_p (*insn)) + { +- details->rex_offset = insn - start; ++ details->enc_prefix_offset = insn - start; + ++insn; + } ++ else if (vex2_prefix_p (*insn)) ++ { ++ /* Don't record the offset in this case because this prefix has ++ no REX.B equivalent. */ ++ insn += 2; ++ } ++ else if (vex3_prefix_p (*insn)) ++ { ++ details->enc_prefix_offset = insn - start; ++ insn += 3; ++ } + + details->opcode_offset = insn - start; + +@@ -1329,10 +1357,22 @@ fixup_riprel (struct gdbarch *gdbarch, amd64_displaced_step_closure *dsc, + arch_tmp_regno = amd64_get_unused_input_int_reg (insn_details); + tmp_regno = amd64_arch_reg_to_regnum (arch_tmp_regno); + +- /* REX.B should be unset as we were using rip-relative addressing, +- but ensure it's unset anyway, tmp_regno is not r8-r15. */ +- if (insn_details->rex_offset != -1) +- dsc->insn_buf[insn_details->rex_offset] &= ~REX_B; ++ /* Position of the not-B bit in the 3-byte VEX prefix (in byte 1). */ ++ static constexpr gdb_byte VEX3_NOT_B = 0x20; ++ ++ /* REX.B should be unset (VEX.!B set) as we were using rip-relative ++ addressing, but ensure it's unset (set for VEX) anyway, tmp_regno ++ is not r8-r15. */ ++ if (insn_details->enc_prefix_offset != -1) ++ { ++ gdb_byte *pfx = &dsc->insn_buf[insn_details->enc_prefix_offset]; ++ if (rex_prefix_p (pfx[0])) ++ pfx[0] &= ~REX_B; ++ else if (vex3_prefix_p (pfx[0])) ++ pfx[1] |= VEX3_NOT_B; ++ else ++ gdb_assert_not_reached ("unhandled prefix"); ++ } + + regcache_cooked_read_unsigned (regs, tmp_regno, &orig_value); + dsc->tmp_regno = tmp_regno; +### a/gdb/testsuite/ChangeLog +### b/gdb/testsuite/ChangeLog +## -1,3 +1,9 @@ ++2017-12-04 Pedro Alves ++ ++ PR gdb/22499 ++ * gdb.arch/amd64-disp-step-avx.S: New file. ++ * gdb.arch/amd64-disp-step-avx.exp: New file. ++ + 2017-12-03 Pedro Alves + + * gdb.threads/process-dies-while-detaching.c: Include +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/amd64-disp-step-avx.S +@@ -0,0 +1,70 @@ ++/* Copyright 2009-2017 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 . ++ ++ This file is part of the gdb testsuite. ++ ++ Test displaced stepping over VEX-encoded RIP-relative AVX ++ instructions. */ ++ ++ .text ++ ++ .global main ++main: ++ nop ++ ++/***********************************************/ ++ ++/* Test a VEX2-encoded RIP-relative instruction. */ ++ ++ .global test_rip_vex2 ++test_rip_vex2: ++ vmovsd ro_var(%rip),%xmm0 ++ .global test_rip_vex2 ++test_rip_vex2_end: ++ nop ++ ++/* Test a VEX3-encoded RIP-relative instruction. */ ++ ++ .global test_rip_vex3 ++test_rip_vex3: ++ vextractf128 $0x0,%ymm0,var128(%rip) ++ .global test_rip_vex3 ++test_rip_vex3_end: ++ nop ++ ++ /* skip over test data */ ++ jmp done ++ ++/* RIP-relative ro-data for VEX2 test above. */ ++ ++ro_var: ++ .8byte 0x1122334455667788 ++ .8byte 0x8877665544332211 ++ ++/***********************************************/ ++ ++/* All done. */ ++ ++done: ++ mov $0,%rdi ++ call exit ++ hlt ++ ++/* RIP-relative data for VEX3 test above. */ ++ ++.data ++var128: ++ .8byte 0xaa55aa55aa55aa55 ++ .8byte 0x55aa55aa55aa55aa +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/amd64-disp-step-avx.exp +@@ -0,0 +1,141 @@ ++# Copyright 2009-2017 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 . ++ ++# This file is part of the gdb testsuite. ++ ++# Test displaced stepping over VEX-encoded RIP-relative AVX ++# instructions. ++ ++if { ![istarget x86_64-*-* ] || ![is_lp64_target] } { ++ verbose "Skipping x86_64 displaced stepping tests." ++ return ++} ++ ++standard_testfile .S ++ ++set additional_flags "-Wa,-g" ++ ++if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ ++ [list debug $additional_flags]] } { ++ return -1 ++} ++ ++# Get things started. ++ ++gdb_test "set displaced-stepping on" "" ++gdb_test "show displaced-stepping" ".* displaced stepping .* is on.*" ++ ++if ![runto_main] then { ++ fail "can't run to main" ++ return 0 ++} ++ ++# GDB picks a spare register from this list to hold the RIP-relative ++# address. ++set rip_regs { "rax" "rbx" "rcx" "rdx" "rbp" "rsi" "rdi" } ++ ++# Assign VAL to all the RIP_REGS. ++ ++proc set_regs { val } { ++ global gdb_prompt ++ global rip_regs ++ ++ foreach reg ${rip_regs} { ++ gdb_test_no_output "set \$${reg} = ${val}" ++ } ++} ++ ++# Verify all RIP_REGS print as HEX_VAL_RE in hex. ++ ++proc verify_regs { hex_val_re } { ++ global rip_regs ++ ++ foreach reg ${rip_regs} { ++ gdb_test "p /x \$${reg}" " = ${hex_val_re}" "${reg} expected value" ++ } ++} ++ ++# Set a break at FUNC, which starts with a RIP-relative instruction ++# that we want to displaced-step over, and then continue over the ++# breakpoint, forcing a displaced-stepping sequence. ++ ++proc disp_step_func { func } { ++ global srcfile ++ ++ set test_start_label "${func}" ++ set test_end_label "${func}_end" ++ ++ gdb_test "break ${test_start_label}" \ ++ "Breakpoint.*at.* file .*$srcfile, line.*" \ ++ "break ${test_start_label}" ++ gdb_test "break ${test_end_label}" \ ++ "Breakpoint.*at.* file .*$srcfile, line.*" \ ++ "break ${test_end_label}" ++ ++ gdb_test "continue" \ ++ "Continuing.*Breakpoint.*, ${test_start_label} ().*" \ ++ "continue to ${test_start_label}" ++ ++ # GDB picks a spare register to hold the RIP-relative address. ++ # Ensure the spare register value is restored properly (rax-rdi, ++ # sans rsp). ++ set value "0xdeadbeefd3adb33f" ++ set_regs $value ++ ++ gdb_test "continue" \ ++ "Continuing.*Breakpoint.*, ${test_end_label} ().*" \ ++ "continue to ${test_end_label}" ++ ++ verify_regs $value ++} ++ ++# Test a VEX2-encoded RIP-relative instruction. ++with_test_prefix "vex2" { ++ # This case writes to the 'xmm0' register. Confirm the register's ++ # value is what we believe it is before the AVX instruction runs. ++ # Fedora: 0* for missing: https://sourceware.org/bugzilla/show_bug.cgi?id=16225 ++ gdb_test "p /x \$xmm0.uint128" " = 0x00*" \ ++ "xmm0 has expected value before" ++ ++ disp_step_func "test_rip_vex2" ++ ++ # Confirm the instruction's expected side effects. It should have ++ # modified xmm0. ++ # Fedora: 0* for missing: https://sourceware.org/bugzilla/show_bug.cgi?id=16225 ++ gdb_test "p /x \$xmm0.uint128" " = 0x0*1122334455667788" \ ++ "xmm0 has expected value after" ++} ++ ++# Test a VEX3-encoded RIP-relative instruction. ++with_test_prefix "vex3" { ++ # This case writes to the 'var128' variable. Confirm the ++ # variable's value is what we believe it is before the AVX ++ # instruction runs. ++ gdb_test "p /x (unsigned long long \[2\]) var128" \ ++ " = \\{0xaa55aa55aa55aa55, 0x55aa55aa55aa55aa\\}" \ ++ "var128 has expected value before" ++ ++ # Run the AVX instruction. ++ disp_step_func "test_rip_vex3" ++ ++ # Confirm the instruction's expected side effects. It should have ++ # modifed the 'var128' variable. ++ gdb_test "p /x (unsigned long long \[2\]) var128" \ ++ " = \\{0x1122334455667788, 0x0\\}" \ ++ "var128 has expected value after" ++} ++ ++# Done, run program to exit. ++gdb_continue_to_end "amd64-disp-step-avx" diff --git a/SPECS/gdb.spec b/SPECS/gdb.spec index d8ec92c..367e582 100644 --- a/SPECS/gdb.spec +++ b/SPECS/gdb.spec @@ -20,13 +20,13 @@ Name: %{?scl_prefix}gdb # Freeze it when GDB gets branched %global snapsrc 20170420 # See timestamp of source gnulib installed into gdb/gnulib/ . -%global snapgnulib 20150822 +%global snapgnulib 20161115 %global tarname gdb-%{version} Version: 8.0.1 # The release always contains a leading reserved number, start it at 1. # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing. -Release: 26%{?dist} +Release: 36%{?dist} License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and LGPLv3+ and BSD and Public Domain and GFDL Group: Development/Debuggers @@ -114,7 +114,7 @@ Recommends: default-yama-scope %if 0%{?el7:1} %global librpmver 3 %else -%if 0%{?fedora} >= 27 +%if 0%{?fedora} >= 27 || 0%{?rhel} > 7 %global librpmver 8 %else %global librpmver 7 @@ -726,6 +726,24 @@ Patch1242: gdb-rhbz1420304-s390x-33of35.patch Patch1243: gdb-rhbz1420304-s390x-34of35.patch Patch1244: gdb-rhbz1420304-s390x-35of35.patch +# [s390x] Backport arch14 guarded-storage register support (RH BZ 1498758). +Patch1255: gdb-rhbz1498758-1of5.patch +Patch1256: gdb-rhbz1498758-2of5.patch +Patch1257: gdb-rhbz1498758-3of5.patch +Patch1258: gdb-rhbz1498758-4of5.patch +Patch1259: gdb-rhbz1498758-5of5.patch + +# Use inlined func name for printing breakpoints (RH BZ 1228556, Keith Seitz). +Patch1261: gdb-rhbz1228556-bpt-inlined-func-name-1of2.patch +Patch1262: gdb-rhbz1228556-bpt-inlined-func-name-2of2.patch + +# Fix random 'FAIL: libstdc++-prettyprinters/80276.cc whatis p4' (GCC +# PR83906) (Pedro Alves). +Patch1263: gdb-random-libstdcpp-prettyprinters-fail.patch + +# Fix signal handlers regression (RH BZ 1542149, Pedro Alves). +Patch1270: gdb-rhbz1542149-spawn-default-signal-handlers-regression.patch + %if 0%{!?rhel:1} || 0%{?rhel} > 6 # RL_STATE_FEDORA_GDB would not be found for: # Patch642: gdb-readline62-ask-more-rh.patch @@ -762,7 +780,7 @@ BuildRequires: texlive-collection-latexrecommended %endif # Permit rebuilding *.[0-9] files even if they are distributed in gdb-*.tar: BuildRequires: /usr/bin/pod2man -%if 0%{!?rhel:1} +%if 0%{!?rhel:1} || 0%{?rhel} > 7 BuildRequires: libbabeltrace-devel%{buildisa} BuildRequires: guile-devel%{buildisa} %endif @@ -831,10 +849,12 @@ BuildRequires: prelink %endif %endif %if 0%{!?rhel:1} || 0%{?rhel} > 7 +%ifarch %{ix86} x86_64 BuildRequires: libmpx%{bits_local} libmpx%{bits_other} +%endif BuildRequires: opencl-headers ocl-icd-devel%{bits_local} ocl-icd-devel%{bits_other} %endif -%if 0%{!?rhel:1} +%if 0%{!?rhel:1} || 0%{?rhel} > 7 # Fedora arm+ppc64le do not yet have fpc built. %ifnarch %{arm} ppc64le BuildRequires: fpc @@ -859,14 +879,10 @@ BuildRequires: libgfortran%{bits_local} libgfortran%{bits_other} # libstdc++-devel of matching bits is required only for g++ -static. BuildRequires: libstdc++%{bits_local} libstdc++%{bits_other} %if 0%{!?rhel:1} || 0%{?rhel} > 6 -%if 0%{!?rhel:1} || 0%{?rhel} > 7 -BuildRequires: libquadmath%{bits_local} libquadmath%{bits_other} -%else %ifarch %{ix86} x86_64 BuildRequires: libquadmath%{bits_local} libquadmath%{bits_other} %endif %endif -%endif BuildRequires: glibc-static%{bits_local} # multilib glibc-static is open Bug 488472: #BuildRequires: glibc-static%{bits_other} @@ -1133,6 +1149,15 @@ done %patch1152 -p1 %patch1153 -p1 %patch1155 -p1 +%patch1255 -p1 +%patch1256 -p1 +%patch1257 -p1 +%patch1258 -p1 +%patch1259 -p1 +%patch1261 -p1 +%patch1262 -p1 +%patch1263 -p1 +%patch1270 -p1 %patch1075 -p1 %if 0%{?rhel:1} && 0%{?rhel} <= 7 @@ -1263,7 +1288,7 @@ export CXXFLAGS="$CFLAGS" --with-separate-debug-dir=/usr/lib/debug \ --disable-sim \ --disable-rpath \ -%if 0%{!?rhel:1} +%if 0%{!?rhel:1} || 0%{?rhel} > 7 --with-babeltrace \ --with-guile \ %else @@ -1596,7 +1621,7 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/stabs* rm -f $RPM_BUILD_ROOT%{_infodir}/dir -%if 0%{?rhel:1} +%if 0%{?rhel:1} && 0%{?rhel} <= 7 # /usr/share/gdb/guile/ gets installed even --without-guile # https://sourceware.org/bugzilla/show_bug.cgi?id=17105 rm -rf $RPM_BUILD_ROOT%{_datadir}/gdb/guile @@ -1715,6 +1740,39 @@ then fi %changelog +* Tue Feb 6 2018 Jan Kratochvil - 8.0.1-36.fc26 +- Fix signal handlers regression (RH BZ 1542149, Pedro Alves). + +* Thu Jan 25 2018 Sergio Durigan Junior - 8.0.1-35.fc26 +- Add %patch directive to the commit below. + +* Wed Jan 24 2018 Sergio Durigan Junior - 8.0.1-34.fc26 +- Fix random 'FAIL: libstdc++-prettyprinters/80276.cc whatis p4' (GCC PR83906) + (Pedro Alves). + +* Wed Dec 6 2017 Jan Kratochvil - 8.0.1-33.fc26 +- [rhel7] Fix C++ compiler compatibility. + +* Tue Dec 5 2017 Jan Kratochvil - 8.0.1-32.fc26 +- Backport upstream fix for Intel PKRU (Walfred Tedeschi). +- Backport upstream fix AVX instr. single-stepping (RH BZ 1515209, Pedro Alves). +- Fix snapgnulib bundle number. + +* Sat Dec 2 2017 Jan Kratochvil - 8.0.1-31.fc26 +- [testsuite] Fix BuildRequires for non-x86* arches. + +* Fri Oct 27 2017 Jan Kratochvil - 8.0.1-30.fc26 +- Use inlined func name for printing breakpoints (RH BZ 1228556, Keith Seitz). + +* Sat Oct 7 2017 Jan Kratochvil - 8.0.1-29.fc26 +- [s390x] Backport arch14 guarded-storage register support (RH BZ 1498758). + +* Thu Sep 28 2017 Jan Kratochvil - 8.0.1-28.fc26 +- Performance fix of gcore to use --readnever (for RH BZ 1493675). + +* Tue Sep 26 2017 Troy Dawson - 8.0.1-27.fc26 +- Cleanup spec file conditionals + * Tue Sep 12 2017 Jan Kratochvil - 8.0.1-26.fc26 - Rebase to FSF GDB 8.0.1 (8.0 stable branch).