aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2018-09-10(Ada) Cleanup code by using ada_is_access_to_unconstrained_array call.Xavier Roirand4-7/+14
This patch just avoids code duplication by using a function we introduced recently (ada_is_access_to_unconstrained_array). gdb/ChangeLog: * ada-lang.c (ada_is_access_to_unconstrained_array): Remove static declaration. * ada-lang.h: add ada_is_access_to_unconstrained_array prototype. * ada-varobj.c (ada_varobj_get_number_of_children, ada_varobj_describe_child, ada_value_is_changeable_p): Cleanup code. Tested on x86_64-linux. No new testcase provided, as this is just a refactoring.
2018-09-10(Ada) Fix printing of access to unconstrained arraysXavier Roirand7-1/+109
Using this Ada code: type String_Access is access String; type Array_Of_String is array (1 .. 2) of String_Access; Aos : Array_Of_String := (new String'("ab"), new String'("cd")); When debugging with GDB, printing each Aos element displays: (gdb) print Aos(1) $2 = "ab" (gdb) print Aos(2) $3 = "cd" Whereas it should display: (gdb) print Aos(1) $2 = (foo_r118_024.string_access) 0x635018 (gdb) print Aos(2) $3 = (foo_r118_024.string_access) 0x635038 Notice that printing the entire array works: (gdb) print Aos $1 = (0x635018, 0x635038) The problem was located in ada_value_print function and due to the fact that the value_type used in this function was based on value_enclosing_type rather than value_type itself. In our example, the difference between the value_type and the value_enclosing_type of the value is that the value_type contains an additional typedef layer which is not present in the value_enclosing_type. This typedef layer is GNAT's way to specify that the element is, at the source level, an access to the unconstrained array, rather than the unconstrained array. Moreover, the value_enclosing_type is not really needed in that case and the value_type can be used instead in this function, and this patch fixes this. gdb/ChangeLog: * ada-valprint.c (ada_value_print): Use type instead of enclosing type. testsuite/ChangeLog: * gdb.ada/access_to_unbounded_array.exp: New testcase. * gdb.ada/access_to_unbounded_array/foo.adb: New file. * gdb.ada/access_to_unbounded_array/pack.adb: New file. * gdb.ada/access_to_unbounded_array/pack.ads: New file. Tested: x86_64-linux
2018-09-10(Ada/MI) Fix -var-evaluate-expression for access to unconstrained arraysXavier Roirand7-0/+164
Using this Ada code: type String_Access is access String; type Array_Of_String is array (1 .. 2) of String_Access; Aos : Array_Of_String := (new String'("ab"), new String'("cd")); In GDB/MI mode, create a variable which type is Aos, evaluate it: (gdb) -var-create var1 * Aos ^done,name="var1",numchild="2",value="[2]",type="bar.array_of_string",thread-id="1",has_more="0" Now print it: (gdb) -var-list-children 1 var1 ^done,numchild="2",children=[child={name="var1.1",exp="1",numchild="1",value="[2] \"ab\"", type="bar.string_access",thread-id="1"},child={name="var1.2",exp="2",numchild="1",value="[2] \"cd\"", type="bar.string_access",thread-id="1"}],has_more="0" But printed fields "value" are wrong, since it should be: ^done,numchild="2",children=[child={name="var1.1",exp="1",numchild="1",value="0x634018",type="bar.string_access",thread-id="1"},child={name="var1.2",exp="2",numchild="1",value="0x634038",type="bar.string_access",thread-id="1"}],has_more="0"^M Print each child of var1: (gdb) -var-evaluate-expression var1.1 ^done,value="[2] \"ab\"" (gdb) -var-evaluate-expression var1.2 ^done,value="[2] \"cd\"" Whereas it should be (gdb) -var-evaluate-expression var1.1 ^done,value="0x635018" (gdb) -var-evaluate-expression var1.2 ^done,value="0x635038" This patch fixes this. gdb/ChangeLog: * ada-lang.c (ada_value_subscript): Handle case when parameter is an array of access to unconstrained array. testsuite/ChangeLog * gdb.ada/mi_string_access.exp: New testcase. * gdb.ada/mi_string_access/bar.adb: New file. * gdb.ada/mi_string_access/pck.adb: New file. * gdb.ada/mi_string_access/pck.asd: New file. Tested on x86_64-linux.
2018-09-10(Ada) New function ada_is_access_to_unconstrained_arrayXavier Roirand2-3/+17
Add a new function to check if a given type is an access to an unconstrained array. This function contains code that is present only once in the current sources but will be used in a future patch. gdb/ChangeLog: * ada-lang.c (ada_is_access_to_unconstrained_array): New function. (ada_check_typedef): Use it. Tested on x86_64-linux.
2018-09-10(Ada) Fix -var-list-children MI command for union typeXavier Roirand7-2/+139
Using this Ada code: type Union_Type (A : Boolean := False) is record case A is when True => B : Integer; when False => C : Float; end case; end record; pragma Unchecked_Union (Union_Type); Ut : Union_Type := (A => True, B => 3); In GDB/MI mode, once creating a varobj from variable "Ut" as follow: (gdb) -var-create var1 * ut ^done,name="var1",numchild="2",value="{...}",type="foo.union_type",thread-id="1",has_more="0" Printing the list of its children displays: (gdb) -var-list-children 1 var1 ^error,msg="Duplicate variable object name" Whereas it should be (gdb) -var-list-children 1 var1 ^done,numchild="2",children=[child={name="var1.b",exp="b",numchild="0",value="3",type="integer",thread-id="1"},child={name="var1.c",exp="c",numchild="0",value="4.20389539e-45",type="float",thread-id="1"}],has_more="0" The problem occurs because ada_varobj_describe_struct_child wasn't handling unions. This patch fixes this. gdb/ChangeLog: * ada-varobj.c (ada_varobj_describe_struct_child) (ada_varobj_describe_child): Handle union case like struct one. testsuite/ChangeLog * gdb.ada/mi_var_union.exp: New testcase. * gdb.ada/mi_var_union/bar.adb: New file. * gdb.ada/mi_var_union/pck.adb: New file. * gdb.ada/mi_var_union/pck.asd: New file. Tested on x86_64-linux.
2018-09-10Remove periods from Python section titlesTom Tromey2-5/+11
This removes the remaining trailing periods from the Python section titles. I thought these looked weird and I don't this is generally done in the gdb documentation. gdb/doc/ChangeLog 2018-09-10 Tom Tromey <tom@tromey.com> * python.texi (Frames In Python, Blocks In Python) (Symbols In Python, Symbol Tables In Python) (Lazy Strings In Python): Remove periods from section titles.
2018-09-10Swap two sentences in the Pretty Printing API nodeTom Tromey2-3/+6
I thought the start of the Pretty Printing API node read a bit strangely. This patch swaps the first two sentences, which seems better. gdb/doc/ChangeLog 2018-09-10 Tom Tromey <tom@tromey.com> * python.texi (Pretty Printing API): Swap sentence order.
2018-09-10Mention virtual tables in Python dynamic_type documentationTom Tromey2-8/+14
PR python/16461 asks that the Python dynamic_type documentation mention virtual tables; this patch implements that request. gdb/doc/ChangeLog 2018-09-10 Tom Tromey <tom@tromey.com> PR python/16461: * python.texi (Values From Inferior): Mention use of virtual table.
2018-09-10Small typo fix in Basic Python nodeTom Tromey2-1/+6
I noticed that the decode_line documentation did not have parens around the argument: -- Function: gdb.decode_line [expression] This patch fixes this oversight. gdb/doc/ChangeLog 2018-09-10 Tom Tromey <tom@tromey.com> * python.texi (Basic Python): Parenthesize argument to decode_line.
2018-09-10Mention Python versions in the documentationTom Tromey2-4/+7
This updates python.texi to note that gdb can be compiled against either major version of Python. It also removes the "execfile" example, because that is specific to Python 2. gdb/doc/ChangeLog 2018-09-10 Tom Tromey <tom@tromey.com> * python.texi (Python): Mention Python versions. Don't mention execfile.
2018-09-10Update Python unwinder documentationTom Tromey2-9/+53
PR python/19808 points out a few issues in the Python unwinder documentation. This patch update the documentation for create_unwind_info and read_register to address the issues noted, and adds a cautionary note about writing an unwinder. gdb/doc/ChangeLog 2018-09-10 Tom Tromey <tom@tromey.com> PR python/19808: * python.texi (Unwinding Frames in Python): Rewrite create_unwind_info documentation. Update read_register documentation and add a note about unwinder caution.
2018-09-10Fix gdb.events.inferior_call documentationTom Tromey2-6/+20
PR python/18909 points out that the gdb.events.inferior_call documentation was incorrect. This patch brings it in line with the code. gdb/doc/ChangeLog 2018-09-10 Tom Tromey <tom@tromey.com> PR python/18909: * python.texi (Events In Python): Fix inferior_call documentation.
2018-09-10Update Python frame filter documentationTom Tromey2-3/+18
This fixes a few frame filter documentation omissions noted in PR python/17752. gdb/doc/ChangeLog 2018-09-10 Tom Tromey <tom@tromey.com> PR python/17752: * python.texi (Frame Filter API): Remove period from subsection title. Mention 100 as good default priority. (Frame Decorator API): Remove period from subsection title. Mention FrameDecorator module.
2018-09-10Reword gdb.GdbError textTom Tromey2-6/+21
PR python/23108 points out that the gdb.GdbError documentation is somewhat difficult to find. The exception is apparently just mentioned in passing. This patch introduces a new table and adds a bit more text to try to make it more obvious. gdb/doc/ChangeLog 2018-09-10 Tom Tromey <tom@tromey.com> PR python/23108: * python.texi (Exception Handling): Rearrange gdb.GdbError text and add a table.
2018-09-10Avoid warnings from makeinfoTom Tromey3-5/+12
"make info" gives a number of warnings about the use of a "." in @ref-like commands. These come from the ".info" suffix. I think this suffix is redundant, and removing the suffix also removes the warning. gdb/doc/ChangeLog 2018-09-10 Tom Tromey <tom@tromey.com> * gdb.texinfo (Compilation): Use "gcc", not "gcc.info", in @xref. (Machine Code): Use "binutils", not "binutils.info", in @pxref. (Separate Debug Files): Use "ld", not "ld.info", in @ref. * python.texi (Objfiles In Python): Use "ld", not "ld.info", in @ref.
2018-09-10Fix help text for "python" commandTom Tromey2-1/+7
PR python/18380 points out that the example in the "help python" text will only work in Python 2. This changes the example to be valid syntax for both Python 2 and Python 3. gdb/ChangeLog 2018-09-10 Tom Tromey <tom@tromey.com> PR python/18380: * python/python.c (_initialize_python): Make example in "python" help work in Python 3.
2018-09-10Document that Frame.block can throwTom Tromey2-1/+10
PR python/16484 points out that Frame.block can throw an exception, but this is not documented. This patch fixes the documentation. Changing Frame.block to return None would be nice, but I suspect it's too late for that change. gdb/doc/ChangeLog 2018-09-10 Tom Tromey <tom@tromey.com> PR python/16484: * python.texi (Frames In Python): Document that Frame.block can throw.
2018-09-10Fix typo in pretty-printer exampleTom Tromey2-1/+6
PR python/23487 points out that the "disable pretty-printer" example has a typo that makes it incorrect. This patch fixes the typo. gdb/doc/ChangeLog 2018-09-10 Tom Tromey <tom@tromey.com> PR python/23487: * gdb.texinfo (Pretty-Printer Commands): Fix typo in example.
2018-09-10Update Python Block.end documentationTom Tromey2-1/+8
PR python/16033 points out that Block.end doesn't describe whether it is inclusive or exclusive. This patch fixes the documentation. gdb/doc/ChangeLog 2018-09-10 Tom Tromey <tom@tromey.com> PR python/16033: * python.texi (Blocks In Python): Document that Block.end is exclusive.
2018-09-10Fix "make install-strip" failure to install gdb-add-index.shEli Zaretskii2-2/+8
gdb/ChangeLog: 2018-09-10 Eli Zaretskii <eliz@gnu.org> * Makefile.in (transformed_name): Use INSTALL_SCRIPT instead of INSTALL_PROGRAM to install gdb-add-index.sh. Don't append $(EXEEXT) to the script, as it is not a program.
2018-09-10PR23611, objcopy is not removing executable relocatable sectionsAlan Modra4-14/+59
BFD handles ELF relocation sections in an executable differently to relocation sections in a relocatable object. For a relocatable object, BFD carries the relocations as data associated with the section to which they apply; The relocation section doesn't appear as a separate section. For an executable, dynamic relocation sections do appear as separate sections. This means that objcopy needs to use different strategies when dealing with relocations. When --remove-relocations was added to objcopy with commit d3e5f6c8f1e, objcopy lost the ability to remove dynamic relocation sections such as .rela.plt from executables using the option "--remove-section=.rela.plt". This patch reinstates that functionality. I thought it best to keep --remove-relocations as is, rather than extending to handle dynamic relocations as per the patch in the PR, because executables linked with --emit-relocs may have both dynamic and non-dynamic relocations. In that case --remove-relocataions=* is useful to remove all the non-dynamic relocations. PR binutils/23611 * objcopy.c (handle_remove_section_option): Consider .rela and .rel sections for stripping directly as well as attached to the associated section they relocate. * doc/binutils.texi (remove-relocations): Specify that this option removes non-dynamic relocation sections. * testsuite/binutils-all/objcopy.exp (objcopy_remove_relocations_from_executable): New test.
2018-09-10Automatic date update in version.inGDB Administrator1-1/+1
2018-09-09python: Make two functions return gdbpy_ref<>Simon Marchi4-13/+22
I noticed that we release a gdbpy_ref in pretty_print_one_value only to create it again later. This patch fills the gap by returning a gdbpy_ref all the way. gdb/ChangeLog: * python/py-prettyprint.c (pretty_print_one_value): Return gdbpy_ref<>. (print_string_repr): Adjust. (apply_varobj_pretty_printer): Return gdbpy_ref<>. * python/python-internal.h (apply_varobj_pretty_printer): Return gdbpy_ref<>. * varobj.c (varobj_value_get_print_value): Adjust.
2018-09-08Make py-prettyprint.exp test names uniqueTom Tromey2-4/+12
I noticed that the py-prettyprint.exp test names were not unique. This patch fixes the problem via with_test_prefix. gdb/testsuite/ChangeLog 2018-09-08 Tom Tromey <tom@tromey.com> * gdb.python/py-prettyprint.exp: Use with_test_prefix.
2018-09-08Allow a pretty-printer without a to_string methodTom Tromey6-10/+47
PR python/16047 points out that, while the documentation says that the to_string method is optional for a pretty-printer, the code disagrees and throws an exception. This patch fixes the problem. varobj is already ok here. Tested on x86-64 Fedora 26. gdb/ChangeLog 2018-09-08 Tom Tromey <tom@tromey.com> PR python/16047: * python/py-prettyprint.c (pretty_print_one_value): Check for to_string method. gdb/testsuite/ChangeLog 2018-09-08 Tom Tromey <tom@tromey.com> PR python/16047: * gdb.python/py-prettyprint.py (pp_int_typedef3): New class. (register_pretty_printers): Register new printer. * gdb.python/py-prettyprint.exp (run_lang_tests): Add int_type3 test. * gdb.python/py-prettyprint.c (int_type3): New typedef. (an_int_type3): New global.
2018-09-09Automatic date update in version.inGDB Administrator1-1/+1
2018-09-08(Ada) fix handling of expression with parameterless function callJoel Brobecker7-1/+131
Consider the following function, which takes no parameter and returns an integer: function Something return Integer; For the purpose of this discussion, our function has been implemented to always return 124: function Something return Integer is begin return 124; end Something; In Ada, such function can been called without using the parentheses. For instance, in the statement below, variable My_Value is assigned the returned value from the call to Something: My_Value := Something; The Ada expression interpeter in GDB supports this case, as we can see below: (gdb) print something $1 = 124 However, we get fairly strange results when trying to use this feature as part of a larger expression. For instance: (gdb) print something + 1 $2 = 248 The problem occurs while doing the resolution pass of the expression. After prefixying the expression, we obtain the following expression: 0 BINOP_ADD 1 OP_VAR_VALUE Block @0x2021550, symbol @0x20213a0 (pck.something) 5 OP_LONG Type @0x1e3c170 (int), value 1 (0x1) The resolution pass is then expected to remove the OP_VAR_VALUE entry, and replace it with an OP_FUNCALL. This is what the call to replace_operator_with_call in ada-lang.c::resolve_subexp is expected to do: if (deprocedure_p && (TYPE_CODE (SYMBOL_TYPE (exp->elts[pc + 2].symbol)) == TYPE_CODE_FUNC)) { replace_operator_with_call (expp, pc, 0, 0, exp->elts[pc + 2].symbol, exp->elts[pc + 1].block); exp = expp->get (); } The problem is that we're passing OPLEN (zero -- 4th parameter in the call), and so replace_operator_with_call ends up removing zero element from our expression, and inserting the corresponding OP_FUNCALL instead. As a result, instead of having the OP_LONG (1) as the second argument of the BINOP_ADD, it is now the OP_VAR_VALUE that we were meant to replace. That OP_VAR_VALUE then itself gets transformed into an OP_FUNCALL, with the same issue, and eventually, the resolved expression now looks like this: 0 BINOP_ADD 1 OP_FUNCALL Number of args: 0 4 OP_VAR_VALUE Block @0x2021550, symbol @0x20213a0 (pck.something) 8 OP_FUNCALL Number of args: 0 11 OP_VAR_VALUE Block @0x2021550, symbol @0x20213a0 (pck.something) 15 OP_VAR_VALUE Block @0x2021550, symbol @0x20213a0 (pck.something) 19 OP_LONG Type @0x1e3c170 (int), value 1 (0x1) This explains why we get twice the result of the function call instead of its value plus one. The extra entries in the expression at the end are just ignored. This patch fixes the issue by calling replace_operator_with_call with the correct OPLEN equal to the size of an OP_VAR_VALUE (4). gdb/ChangeLog: * ada-lang.c (resolve_subexp): Pass correct OPLEN in call to replace_operator_with_call. gdb/testsuite/ChangeLog: * gdb.ada/expr_with_funcall: New testcase.
2018-09-08ada-lang.c::ada_value_cast: remove unnecessary parenthesesJoel Brobecker2-1/+5
No other code change. gdb/ChangeLog: * ada-lang.c (ada_value_cast): Remove unnecessary parentheses.
2018-09-08(Ada) slightly incorrect bounds for type of array indexed by enumJoel Brobecker2-7/+7
Consider the following code: type Enumerated is (Enum_A, Enum_B, Enum_C, Enum_Last); type Table is array (Enumerated) of Integer; -- Declare a variable of type Table to make sure the compiler -- does emit the debugging information for that type. V : Table := (others => 1); Trying to print the type description of type Table, or of variable V yields: (gdb) ptype v type = array (0 .. 3) of integer (gdb) ptype example.table type = array (0 .. 3) of integer The compiler generates an XA type for the bounds... <1><cf6>: Abbrev Number: 13 (DW_TAG_structure_type) <cf7> DW_AT_name : example__table___XA ... whose member is described as being as: <2><cfe>: Abbrev Number: 14 (DW_TAG_member) <cff> DW_AT_name : example__enumerated <d05> DW_AT_type : <0xc69> This leads us to DIE 0xc69, which is our enumeration type: <2><c69>: Abbrev Number: 4 (DW_TAG_enumeration_type) <c6a> DW_AT_name : example__enumerated Normally, for arrays, we expect a range type, rather than an enumerated type. However, for a situation like this, where the range of the array index is the full enumeration type, it seems like a waste to require an extra range layer. Instead, looking at print_range, we see that we print the bounds of our range using the target type: target_type = TYPE_TARGET_TYPE (type); if (target_type == NULL) target_type = type; [...] ada_print_scalar (target_type, lo, stream); fprintf_filtered (stream, " .. "); ada_print_scalar (target_type, hi, stream); In this case, this causes us to use the enumerated type's subtype, which is a plain integer type, hence the output we get. However, there is no reason for using the target type, even in the TYPE_CODE_RANGE situation. So this patch fixes the issue by simply printing the bounds using the type being given, instead of its target type. gdb/ChangeLog: * ada-typeprint.c (print_range): Print the bounds using TYPE rather than its TYPE_TARGET_TYPE. A new test for this isn't necessary, as existing tests will demonstrate this issue once a change in the compiler triggering the generation of this type of debugging info gets pushed.
2018-09-08minor reformatting in ada-lang.c::ada_to_fixed_valueJoel Brobecker2-3/+6
The arguments in the call to ada_to_fixed_value_create where improperly aligned. But I also noticed that all the arguments do fit on a single-line (up to 79 characters). So this patch just fixes the code by putting everything on that same line. gdb/ChangeLog: * ada-lang.c (ada_to_fixed_value): Minor reformatting in call to ada_to_fixed_value_create.
2018-09-08Handle PPC64 function descriptor in Ada decodingJerome Guitton2-0/+9
On PPC64, the entry point of the function "FN" is ".FN" when a function descriptor is used. One of the consequences of this is that GDB then presents the name of the function to the user (eg: in backtraces) with the leading dot, which is a low-level internal detail that the user should not be seeing. The Ada decoding should strip it. gdb/ChangeLog: * ada-lang.c (ada_decode): strip dot prefix in symbol name. No testcase added, as a number of existing testcases should already demonstrate that problem.
2018-09-08(Ada) "catch assert" spurious internal errorJoel Brobecker2-8/+10
We noticed while debugging a program compiled without assertions enabled and using an older compiler that inserting a catchpoint on failed assertions would cause an internal error: (gdb) catch assert ../../src/gdb/ada-lang.c:13321: internal-error: ada_exception_sal: Assertion`sym != NULL' failed. A problem internal to GDB has been detected, This is due to a combination of factors: 1. With older versions of the compiler, the function used as a hook was provided by a unit that's different from the unit which provides the hooks for the other exception catchpoints. 2. The program either does not use any assertion, or is compiled without the assertions enabled. With newer versions of the compiler, all such functions are provided by the same unit, so should normally always be available. However, there can still be reasons why this is not the case. Consider, for instance, the case of a runtime compiled with -ffunction-sections, in which case the hook might be eliminated unless assertions are used and enabled. So this patch transforms the internal error into a simple error. gdb/ChangeLog: * ada-lang.c (ada_exception_sal): Replace gdb_assert calls by calls to error. No testcase added, as the existing testcase gdb.ada/catch_ex.exp should trigger it when using an older version of GNAT as the Ada compiler.
2018-09-08(Ada) infinite loop when hitting unhandled exception catchpointJoel Brobecker2-1/+6
When debugging a program compiled with an older version of GNAT, hitting a catchpoint on unhandled exceptions can caused GDB to got into an infinite loop. This happens while trying to find the name of the exception that was raised. For that, it searches for a frame corresponding to a specific function we know gets called during the exeption handling. In our particular case, the compiler was too old, and so GDB never found that frame, and eventually got past the "main" subprogram, all the way to system frames, where no symbol was available. As a result, the code addresses could not be resolved into a function name, leading to the infinite loop because of a misplaced update of our loop variable "fi": while (fi != NULL) { char *func_name; enum language func_lang; find_frame_funname (fi, &func_name, &func_lang, NULL); if (func_name != NULL) { make_cleanup (xfree, func_name); if (strcmp (func_name, data->exception_info->catch_exception_sym) == 0) break; /* We found the frame we were looking for... */ fi = get_prev_frame (fi); } } If FUNC_NAME is NULL, then FI never gets updated ever after! gdb/ChangeLog: * ada-lang.c (ada_unhandled_exception_name_addr_from_raise): Move update of loop variable "fi". No testcase added, as the existing testcase gdb.ada/catch_ex.exp should trigger it when using an older version of GNAT as the Ada compiler.
2018-09-08(Ada) assigning packed array aggregate with variable as componentJoel Brobecker9-5/+175
Consider a variable "PRA" defined as a packed array of packed records as follow: subtype Int is Integer range 0 .. 7; type Packed_Rec is record X, Y : Int; W : Integer; end record; pragma Pack (Packed_Rec); type Packed_RecArr is array (Integer range <>) of Packed_Rec; pragma Pack (Packed_RecArr); PRA : Packed_RecArr (1 .. 3); Consider also a variable "PR", which is a Packed_Rec record, declared as follow: PR : Packed_Rec := (2, 2, 2); Trying to assign a new value to PRA using an aggregate expression where one of the components is our variable PR yields the wrong result on big-endian machines (e.g. on ppc-linux): (gdb) p pra := (pr, (2,2,2), (2,2,2)) $6 = ((x => 1, y => 0, w => 8), [...] On the other hand, replacing "pr" by "(2,2,2)" does work. I tracked the issue down to the bit offset we use to extract the value of "PR" and copy it inside PRA. in value_assign_to_component, we have: if (gdbarch_bits_big_endian (get_type_arch (value_type (container)))) move_bits ([target buffer], [bit offset in target buffer], [source buffer where PR is stored], TYPE_LENGTH (value_type (component)) * TARGET_CHAR_BIT - bits, bits, 1); The issue is with the third-to-last argument, which provides the bit offset where the value of PR is stored relative to its start address, and therefore the bit offset relative to the start of the source buffer passed as the previous argument. In our case, component is a 38bit packed record whose TYPE_LENGTH is 5 bytes, so the bit-offset that gets calculated is 2 (bits). However, that formula only really applies to scalars, whereas in our case, we have a record (struct). The offset in the non-scalar case should be zero. gdb/ChangeLog: * ada-lang.c (value_assign_to_component): In the case of big-endian targets, extract the bits of the given VAL using an src_offset of zero if container is not a scalar. gdb/testsuite/ChangeLog: * gdb.ada/packed_array_assign: New testcase.
2018-09-08gdb: Add builtin types for 24 bit integers.John Darrington3-0/+8
Add int24 and uint24. These are used by the upcoming S12Z target, but will be needed for any arch which features 24 bit registers. * gdb/gdbtypes.h (struct builtin_type): New members builtin_int24 and builtin_uint24; * gdb/gdbtypes.c: Initialize them. * gdb/doc/gdb.texinfo (Predefined Target Types): Mention types int24 and uint24.
2018-09-08S12Z: Make disassebler work for --enable-targets=all config.John Darrington2-0/+5
opcodes/ * disassemble.c (ARCH_s12z): Define if ARCH_all.
2018-09-08Automatic date update in version.inGDB Administrator1-1/+1
2018-09-07gdb/testsuite: Make test names unique in gdb.base/watchpoint.expAndrew Burgess2-24/+33
Extend test names and add test name prefixes to make test names unique. gdb/testsuite/ChangeLog: * gdb.base/watchpoint.exp (test_complex_watchpoint): Extend test names, and add test prefixes to make test names unique.
2018-09-07Automatic date update in version.inGDB Administrator1-1/+1
2018-09-06Generate NT_PROCSTAT_{AUXV,VMMAP,PS_STRINGS} in FreeBSD coredumpsSimon Ser4-0/+126
gcore generates NT_AUXV and NT_FILE notes for Linux targets. On FreeBSD auxv is stored in a NT_PROCSTAT_AUXV section, virtual memory mappings are stored in a NT_PROCSTAT_VMMAP, and both are prefixed with the struct size. In addition, store a NT_PROCSTAT_PS_STRINGS note saving the initial location of the argv[] and environment[] arrays. gdb/ChangeLog: PR gdb/23105 * fbsd-nat.c (fbsd_nat_target::xfer_partial): Add support for TARGET_OBJECT_FREEBSD_VMMAP and TARGET_OBJECT_FREEBSD_PS_STRINGS. * fbsd-tdep.c (fbsd_make_note_desc): New. (fbsd_make_corefile_notes): Write NT_PROCSTAT_AUXV, NT_PROCSTAT_VMMAP and NT_PROCSTAT_PS_STRINGS notes. * target.h (enum target_object) Add FreeBSD-specific TARGET_OBJECT_FREEBSD_VMMAP and TARGET_OBJECT_FREEBSD_PS_STRINGS.
2018-09-06compile: Remove non-const reference parametersSimon Marchi15-86/+132
As mentioned here: https://sourceware.org/gdb/wiki/Internals%20GDB-C-Coding-Standards#Avoid_non-const_reference_parameters.2C_use_pointers_instead we prefer to avoid non-const references. This patch changes the non-const references I could find in the compile/ directory, either by making them rvalue-reference (&&) or changing them to pointers. I'd say all the changes are pretty obvious, except the one in compile_cplus_instance::enter_scope which might require more attention. gdb/ChangeLog: * compile/compile-c.h (generate_c_for_variable_locations): Change reference to pointer. * compile/compile-c-support.c (compile_program) <compute>: Likewise. * compile/compile-c-symbols.c (generate_vla_size): Likewise. (generate_c_for_for_one_variable): Likewise (generate_c_for_variable_locations): Likewise * compile/compile-c-types.c (compile_c_instance::convert_type): Likewise * compile/compile-cplus-symbols.c (convert_one_symbol): std::move the scope passed to enter_scope. * compile/compile-cplus-types.c (compile_cplus_instance::enter_scope): Make parameter rvalue-reference. (compile_cplus_instance::new_scope): Change reference to pointer. (compile_cplus_instance::convert_type): Likewise (compile_cplus_convert_typedef): std::move the scope passed to enter_scope. (compile_cplus_convert_struct_or_union): Likewise. (compile_cplus_convert_enum): Likewise. (compile_cplus_convert_namespace): Likewise. * compile/compile-cplus.h (compile_cplus_instance) <enter_scope>: Make parameter rvalue-reference. * compile/compile-internal.h (compile_instance) <get_cached_type>: Likewise * compile/compile-loc2c.c (push): Likewise (pushf): Likewise (unary): Likewise (binary): Likewise (print_label): Likewise (pushf_register_address): Likewise (pushf_register): Likewise (do_compile_dwarf_expr_to_c): Likewise (compile_dwarf_expr_to_c): Likewise (compile_dwarf_bounds_to_c): Likewise * compile/compile.c (compile_instance::get_cached_type): Likewise * compile/compile.h (compile_dwarf_expr_to_c): Likewise. (compile_dwarf_bounds_to_c): Likewise * dwarf2loc.c (locexpr_generate_c_location): Likewise. (dwarf2_compile_property_to_c): Likewise * dwarf2loc.h (dwarf2_compile_property_to_c): Likewise * symtab.h (struct symbol_computed_ops) <generate_c_location>: Likewise
2018-09-06Remove unused tui_win_element::highlightSimon Marchi3-2/+5
gdb/ChangeLog: * tui/tui-data.h (struct tui_win_element) <highlight>: Remove. * tui/tui-data.c (init_content_element): Don't initialize it.
2018-09-06Remove unused tui_win_info::detail::opaqueSimon Marchi3-4/+6
gdb/ChangeLog: * tui/tui-data.h (struct tui_win_info) <detail::opaque>: Remove. * tui/tui-data.c (init_win_info): Remove assignment.
2018-09-06PR23570, AVR .noinit section defaults to PROGBITSAlan Modra4-19/+18
Revert commit 8744470deab and instead use the standard special_sections support. PR 23570 bfd/ * elf32-avr.c (elf_avr_special_sections): New. (elf_backend_special_sections): Define. gas/ * config/tc-avr.c: Revert 2018-09-03 change.
2018-09-05Make -Wformat-nonliteral work with gccTom Tromey6-3/+50
After looking into why the build failed for Simon but not for me, we found that the underlying cause was due to how gcc treats -Wformat-nonliteral. gcc requires -Wformat to be given first; but warning.m4 was not doing this, so -Wformat-nonliteral was not being used. This patch changes warning.m4 to account gcc's requirement. This then showed that the target-float.c build change in the earlier Makefile patch was also incorrect. Simon didn't see this in his build, but gcc now points it out. So, this patch fixes this problem as well. 2018-09-05 Tom Tromey <tom@tromey.com> * warning.m4 (AM_GDB_WARNINGS): Add -Wformat when testing -Wformat-nonliteral. * target-float.c (host_float_ops<T>::to_string) (host_float_ops<T>::from_string): Use DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL. * configure: Rebuild. gdb/gdbserver/ChangeLog 2018-09-05 Tom Tromey <tom@tromey.com> * configure: Rebuild.
2018-09-05Disable -Wformat-nonliteral in parts of printcmd.cSimon Marchi4-0/+55
commit 3322c5d9a1 ("Remove unneeded explicit .o targets") broke the build with clang, because -Wno-format-nonliteral was in fact needed. This patch fixes the problem by introducing DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL and using it in printcmd.c. This seems preferable to reverting the patch because now the warning suppression is more targeted. gdb/ChangeLog 2018-09-05 Simon Marchi <simon.marchi@ericsson.com> * printcmd.c (printf_c_string): Use DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL. (printf_wide_c_string, printf_pointer, ui_printf): Likewise. include/ChangeLog 2018-09-05 Simon Marchi <simon.marchi@ericsson.com> * diagnostics.h (DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL): New macro.
2018-09-06Automatic date update in version.inGDB Administrator1-1/+1
2018-09-05Remove unnecessary casts from cli-cmds.cTom Tromey2-3/+7
I noticed a couple of unnecessary casts in cli-cmds.c. This patch removes them. Tested by rebuilding. I'm checking this in. gdb/ChangeLog 2018-09-05 Tom Tromey <tom@tromey.com> * cli/cli-cmds.c (shell_escape, edit_command): Remove cast.
2018-09-05[gdb/exp] Handle DW_OP_GNU_variable_value refs to abstract diesTom de Vries7-8/+97
Consider a vla variable 'a' in function f1: ... <2><1a7>: Abbrev Number: 11 (DW_TAG_variable) <1a8> DW_AT_description : a <1aa> DW_AT_abstract_origin: <0x311> ... with abstract origin 'a': ... <2><311>: Abbrev Number: 3 (DW_TAG_variable) <312> DW_AT_name : a <317> DW_AT_type : <0x325> ... and inherited abstract vla type: ... <1><325>: Abbrev Number: 9 (DW_TAG_array_type) <326> DW_AT_type : <0x33a> <2><32e>: Abbrev Number: 10 (DW_TAG_subrange_type) <32f> DW_AT_type : <0x2ea> <333> DW_AT_upper_bound : 5 byte block: fd 1b 3 0 0 (DW_OP_GNU_variable_value: <0x31b>) ... where the upper bound refers to this artificial variable D.1922 without location attribute: ... <2><31b>: Abbrev Number: 8 (DW_TAG_variable) <31c> DW_AT_description : (indirect string, offset: 0x39a): D.1922 <320> DW_AT_type : <0x2ea> <324> DW_AT_artificial : 1 ... Currently, when we execute "p sizeof (a)" in f1, the upper bound is calculated by evaluating the DW_OP_GNU_variable_value expression referring to D.1922, but since that die doesn't have a location attribute, we get: ... value has been optimized out ... However, there's also artificial variable D.4283 that is sibling of vla variable 'a', has artificial variable D.1922 as abstract origin, and has a location attribute: ... <2><1ae>: Abbrev Number: 12 (DW_TAG_variable) <1af> DW_AT_description : (indirect string, offset: 0x1f8): D.4283 <1b3> DW_AT_abstract_origin: <0x31b> <1b7> DW_AT_location : 11 byte block: 75 1 8 20 24 8 20 26 31 1c 9f (DW_OP_breg5 (rdi):1; DW_OP_const1u: 32; DW_OP_shl; DW_OP_const1u: 32; DW_OP_shra; DW_OP_lit1; DW_OP_minus; DW_OP_stack_value) ... The intended behaviour for DW_OP_GNU_variable_value is to find a die that refers to D.1922 as abstract origin, has a location attribute and is 'in scope', so the expected behaviour is: ... $1 = 6 ... The 'in scope' concept can be thought of as variable D.1922 having name attribute "D.1922", and variable D.4283 inheriting that attribute, resulting in D.4283 being declared with name "D.1922" alongside vla a in f1, and when we lookup "DW_OP_GNU_variable_value D.1922", it should work as if we try to find the value of a variable named "D.1922" on the gdb command line using "p D.1922", and we should return the value of D.4283. This patch fixes the case described above, by: - adding a field abstract_to_concrete to struct dwarf2_per_objfile, - using that field to keep track of which concrete dies are instances of an abstract die, and - using that information when getting the value DW_OP_GNU_variable_value. Build and reg-tested on x86_64-linux. 2018-09-05 Tom de Vries <tdevries@suse.de> * dwarf2loc.c (sect_variable_value): Call indirect_synthetic_pointer with resolve_abstract_p == true. (indirect_synthetic_pointer): Add resolve_abstract_p parameter, defaulting to false. Propagate resolve_abstract_p to dwarf2_fetch_die_loc_sect_off. * dwarf2loc.h (dwarf2_fetch_die_loc_sect_off): Add resolve_abstract_p parameter, defaulting to false. * dwarf2read.c (read_variable): Add variable to abstract_to_concrete. (dwarf2_fetch_die_loc_sect_off): Add and handle resolve_abstract_p parameter. * dwarf2read.h (struct die_info): Forward-declare. (die_info_ptr): New typedef. (struct dwarf2_per_objfile): Add abstract_to_concrete field. * gdb.dwarf2/varval.exp: Add test.
2018-09-05Document the GDB 8.2 release in gdb/ChangeLogJoel Brobecker1-0/+4
gdb/ChangeLog: GDB 8.2 released.