binutils-gdb/gdb/ChangeLog

804 lines
28 KiB
Plaintext
Raw Normal View History

2015-01-31 Eli Zaretskii <eliz@gnu.org>
* tui/tui-io.c (tui_expand_tabs): New function.
(tui_puts, tui_redisplay_readline): Expand TABs into the
appropriate number of spaces.
* tui/tui-regs.c: Include tui-io.h.
(tui_register_format): Call tui_expand_tabs to expand TABs into
the appropriate number of spaces.
* tui/tui-io.h: Add prototype for tui_expand_tabs.
2015-01-30 Doug Evans <dje@google.com>
* NEWS: "info source" command now display producer string if present.
* source.c (source_info): Print producer string if present.
2015-01-30 Simon Marchi <simon.marchi@ericsson.com>
* varobj.c (varobj_delete): Fix comment.
2015-01-30 Simon Marchi <simon.marchi@ericsson.com>
* varobj.c (create_child): Modify comment.
Constify some parameters in the varobj code To make it clear that some functions should not modify the variable object, this patch adds the const qualifier where it makes sense to some struct varobj * parameters. Most getters should take a const pointer to guarantee they don't modify the object. Unfortunately, I couldn't add it to some callbacks (such as name_of_child). In the C implementation, they call c_describe_child, which calls varobj_get_path_expr. varobj_get_path_expr needs to modify the object in order to cache the computed value. It therefore can't take a const pointer, and it affects the whole call chain. I suppose that's where you would use a "mutable" in C++. I did that to make sure there was no other cases like the one fixed in the previous patch. I don't think it can hurt. gdb/ChangeLog: * ada-varobj.c (ada_number_of_children): Constify struct varobj * parameter. (ada_name_of_variable): Same. (ada_path_expr_of_child): Same. (ada_value_of_variable): Same. (ada_value_is_changeable_p): Same. (ada_value_has_mutated): Same. * c-varobj.c (varobj_is_anonymous_child): Same. (c_is_path_expr_parent): Same. (c_number_of_children): Same. (c_name_of_variable): Same. (c_path_expr_of_child): Same. (get_type): Same. (c_value_of_variable): Same. (cplus_number_of_children): Same. (cplus_name_of_variable): Same. (cplus_path_expr_of_child): Same. (cplus_value_of_variable): Same. * jv-varobj.c (java_number_of_children): Same. (java_name_of_variable): Same. (java_path_expr_of_child): Same. (java_value_of_variable): Same. * varobj.c (number_of_children): Same. (name_of_variable): Same. (is_root_p): Same. (varobj_ensure_python_env): Same. (varobj_get_objname): Same. (varobj_get_expression): Same. (varobj_get_display_format): Same. (varobj_get_display_hint): Same. (varobj_has_more): Same. (varobj_get_thread_id): Same. (varobj_get_frozen): Same. (dynamic_varobj_has_child_method): Same. (varobj_get_gdb_type): Same. (is_path_expr_parent): Same. (varobj_default_is_path_expr_parent): Same. (varobj_get_language): Same. (varobj_get_attributes): Same. (varobj_is_dynamic_p): Same. (varobj_get_child_range): Same. (varobj_value_has_mutated): Same. (varobj_get_value_type): Same. (number_of_children): Same. (name_of_variable): Same. (check_scope): Same. (varobj_editable_p): Same. (varobj_value_is_changeable_p): Same. (varobj_floating_p): Same. (varobj_default_value_is_changeable_p): Same. * varobj.h (struct lang_varobj_ops): Consitfy some struct varobj * parameters. (varobj_get_objname): Constify struct varobj * parameter. (varobj_get_expression): Same. (varobj_get_thread_id): Same. (varobj_get_frozen): Same. (varobj_get_child_range): Same. (varobj_get_display_hint): Same. (varobj_get_gdb_type): Same. (varobj_get_language): Same. (varobj_get_attributes): Same. (varobj_editable_p): Same. (varobj_floating_p): Same. (varobj_has_more): Same. (varobj_is_dynamic_p): Same. (varobj_ensure_python_env): Same. (varobj_default_value_is_changeable_p): Same. (varobj_value_is_changeable_p): Same. (varobj_get_value_type): Same. (varobj_is_anonymous_child): Same. (varobj_value_get_print_value): Same. (varobj_default_is_path_expr_parent): Same.
2015-01-30 21:07:15 +01:00
2015-01-30 Simon Marchi <simon.marchi@ericsson.com>
* ada-varobj.c (ada_number_of_children): Constify struct varobj *
parameter.
(ada_name_of_variable): Same.
(ada_path_expr_of_child): Same.
(ada_value_of_variable): Same.
(ada_value_is_changeable_p): Same.
(ada_value_has_mutated): Same.
* c-varobj.c (varobj_is_anonymous_child): Same.
(c_is_path_expr_parent): Same.
(c_number_of_children): Same.
(c_name_of_variable): Same.
(c_path_expr_of_child): Same.
(get_type): Same.
(c_value_of_variable): Same.
(cplus_number_of_children): Same.
(cplus_name_of_variable): Same.
(cplus_path_expr_of_child): Same.
(cplus_value_of_variable): Same.
* jv-varobj.c (java_number_of_children): Same.
(java_name_of_variable): Same.
(java_path_expr_of_child): Same.
(java_value_of_variable): Same.
* varobj.c (number_of_children): Same.
(name_of_variable): Same.
(is_root_p): Same.
(varobj_ensure_python_env): Same.
(varobj_get_objname): Same.
(varobj_get_expression): Same.
(varobj_get_display_format): Same.
(varobj_get_display_hint): Same.
(varobj_has_more): Same.
(varobj_get_thread_id): Same.
(varobj_get_frozen): Same.
(dynamic_varobj_has_child_method): Same.
(varobj_get_gdb_type): Same.
(is_path_expr_parent): Same.
(varobj_default_is_path_expr_parent): Same.
(varobj_get_language): Same.
(varobj_get_attributes): Same.
(varobj_is_dynamic_p): Same.
(varobj_get_child_range): Same.
(varobj_value_has_mutated): Same.
(varobj_get_value_type): Same.
(number_of_children): Same.
(name_of_variable): Same.
(check_scope): Same.
(varobj_editable_p): Same.
(varobj_value_is_changeable_p): Same.
(varobj_floating_p): Same.
(varobj_default_value_is_changeable_p): Same.
2015-01-30 Simon Marchi <simon.marchi@ericsson.com>
* varobj.c (varobj_get_path_expr): Set var->path_expr.
* c-varobj.c (c_path_expr_of_child): Set local var instead of
child->path_expr.
(cplus_path_expr_of_child): Same.
2015-01-30 Simon Marchi <simon.marchi@ericsson.com>
* mi-cmd-var.c (print_varobj): Free varobj_get_expression
result.
(mi_cmd_var_info_expression): Same.
* varobj.c (varobj_get_expression): Mention in the comment that
the result must by freed by the caller.
2015-01-30 Simon Marchi <simon.marchi@ericsson.com>
* mi/mi-cmd-var.c (mi_cmd_var_info_type): Free result of
varobj_get_type.
(varobj_update_one): Same.
* varobj.c (update_type_if_necessary): Free curr_type_str and
new_type_str.
(varobj_get_type): Specify in comment that the result needs to be
freed by the caller.
2015-01-29 Doug Evans <dje@google.com>
PR symtab/17890
* dwarf2read.c (dwarf_decode_line_header): Punt if version > 4.
2015-01-25 Mark Wielaard <mjw@redhat.com>
* dwarf2read.c (checkproducer): Call producer_is_gcc.
* utils.c (producer_is_gcc_ge_4): Likewise.
(producer_is_gcc): New function.
* utils.h (producer_is_gcc): New declaration.
gdb/DWARF: Support for arrays whose bound is a discriminant. Consider the following declarations: type Array_Type is array (Integer range <>) of Integer; type Record_Type (N : Integer) is record A : Array_Type (1 .. N); end record; R : Record_Type := Get (10); It defines what Ada programers call a "discriminated record", where "N" is a component of that record called a "discriminant", and where "A" is a component defined as an array type whose upper bound is equal to the value of the discriminant. So far, we rely on a number of fairly complex GNAT-specific encodings to handle this situation. This patch is to enhance GDB to be able to print this record in the case where the compiler has been modified to replace those encodings by pure DWARF constructs. In particular, the debugging information generated for the record above looks like the following. "R" is a record.. .uleb128 0x10 # (DIE (0x13e) DW_TAG_structure_type) .long .LASF17 # DW_AT_name: "foo__record_type" ... whose is is of course dynamic (not our concern here)... .uleb128 0xd # DW_AT_byte_size .byte 0x97 # DW_OP_push_object_address .byte 0x94 # DW_OP_deref_size .byte 0x4 .byte 0x99 # DW_OP_call4 .long 0x19b .byte 0x23 # DW_OP_plus_uconst .uleb128 0x7 .byte 0x9 # DW_OP_const1s .byte 0xfc .byte 0x1a # DW_OP_and .byte 0x1 # DW_AT_decl_file (foo.adb) .byte 0x6 # DW_AT_decl_line ... and then has 2 members, fist "n" (our discriminant); .uleb128 0x11 # (DIE (0x153) DW_TAG_member) .ascii "n\0" # DW_AT_name .byte 0x1 # DW_AT_decl_file (foo.adb) .byte 0x6 # DW_AT_decl_line .long 0x194 # DW_AT_type .byte 0 # DW_AT_data_member_location ... and "A"... .uleb128 0x11 # (DIE (0x181) DW_TAG_member) .ascii "a\0" # DW_AT_name .long 0x15d # DW_AT_type .byte 0x4 # DW_AT_data_member_location ... which is an array ... .uleb128 0x12 # (DIE (0x15d) DW_TAG_array_type) .long .LASF18 # DW_AT_name: "foo__record_type__T4b" .long 0x194 # DW_AT_type ... whose lower bound is implicitly 1, and the upper bound a reference to DIE 0x153 = "N": .uleb128 0x13 # (DIE (0x16a) DW_TAG_subrange_type) .long 0x174 # DW_AT_type .long 0x153 # DW_AT_upper_bound This patch enhanced GDB to understand references to other DIEs where the DIE's address is at an offset of its enclosing type. The difficulty was that the address used to resolve the array's type (R's address + 4 bytes) is different from the address used as the base to compute N's address (an offset to R's address). We're solving this issue by using a stack of addresses rather than a single address when trying to resolve a type. Each address in the stack corresponds to each containing level. For instance, if resolving the field of a struct, the stack should contain the address of the field at the top, and then the address of the struct. That way, if the field makes a reference to an object of the struct, we can retrieve the address of that struct, and properly resolve the dynamic property references that struct. gdb/ChangeLog: * gdbtypes.h (struct dynamic_prop): New PROP_ADDR_OFFSET enum kind. * gdbtypes.c (resolve_dynamic_type_internal): Replace "addr" parameter by "addr_stack" parameter. (resolve_dynamic_range): Replace "addr" parameter by "stack_addr" parameter. Update function documentation. Update code accordingly. (resolve_dynamic_array, resolve_dynamic_union) (resolve_dynamic_struct, resolve_dynamic_type_internal): Likewise. (resolve_dynamic_type): Update code, following the changes made to resolve_dynamic_type_internal's interface. * dwarf2loc.h (struct property_addr_info): New. (dwarf2_evaluate_property): Replace "address" parameter by "addr_stack" parameter. Adjust function documentation. (struct dwarf2_offset_baton): New. (struct dwarf2_property_baton): Update documentation of field "referenced_type" to be more general. New field "offset_info" in union data field. * dwarf2loc.c (dwarf2_evaluate_property): Replace "address" parameter by "addr_stack" parameter. Adjust code accordingly. Add support for PROP_ADDR_OFFSET properties. * dwarf2read.c (attr_to_dynamic_prop): Add support for DW_AT_data_member_location attributes as well. Use case statements instead of if/else condition. gdb/testsuite/ChangeLog: * gdb.ada/disc_arr_bound: New testcase. Tested on x86_64-linux, no regression.
2015-01-05 11:32:36 +01:00
2015-01-29 Joel Brobecker <brobecker@adacore.com>
* gdbtypes.h (struct dynamic_prop): New PROP_ADDR_OFFSET enum
kind.
* gdbtypes.c (resolve_dynamic_type_internal): Replace "addr"
parameter by "addr_stack" parameter.
(resolve_dynamic_range): Replace "addr" parameter by
"stack_addr" parameter. Update function documentation.
Update code accordingly.
(resolve_dynamic_array, resolve_dynamic_union)
(resolve_dynamic_struct, resolve_dynamic_type_internal): Likewise.
(resolve_dynamic_type): Update code, following the changes made
to resolve_dynamic_type_internal's interface.
* dwarf2loc.h (struct property_addr_info): New.
(dwarf2_evaluate_property): Replace "address" parameter
by "addr_stack" parameter. Adjust function documentation.
(struct dwarf2_offset_baton): New.
(struct dwarf2_property_baton): Update documentation of
field "referenced_type" to be more general. New field
"offset_info" in union data field.
* dwarf2loc.c (dwarf2_evaluate_property): Replace "address"
parameter by "addr_stack" parameter. Adjust code accordingly.
Add support for PROP_ADDR_OFFSET properties.
* dwarf2read.c (attr_to_dynamic_prop): Add support for
DW_AT_data_member_location attributes as well. Use case
statements instead of if/else condition.
[Ada/varobj] number of children of null pointer to dynamic array. This is preparation work to avoid a regression in the Ada/varobj. An upcoming patch is going to add support for types in DWARF which have dynamic properties whose value is a reference to another DIE. Consider for instance the following declaration: type Variant_Type (N : Int := 0) is record F : String(1 .. N) := (others => 'x'); end record; type Variant_Type_Access is access all Variant_Type; VTA : Variant_Type_Access := null; This declares a variable "VTA" which is an access (=pointer) to a variant record Variant_Type. This record contains two components, the first being "N" (the discriminant), and the second being "F", an array whose lower bound is 1, and whose upper bound depends on the value of "N" (the discriminant). Of interest to us, here, is that second component ("F"), and in particular its bounds. The debugging info, and in particular the info for the array looks like the following... .uleb128 0x9 # (DIE (0x91) DW_TAG_array_type) .long .LASF16 # DW_AT_name: "bar__variant_type__T2b" .long 0xac # DW_AT_GNAT_descriptive_type .long 0x2cb # DW_AT_type .long 0xac # DW_AT_sibling .uleb128 0xa # (DIE (0xa2) DW_TAG_subrange_type) .long 0xc4 # DW_AT_type .long 0x87 # DW_AT_upper_bound .byte 0 # end of children of DIE 0x91 ... where the upper bound of the array's subrange type is a reference to "n"'s DIE (0x87): .uleb128 0x8 # (DIE (0x87) DW_TAG_member) .ascii "n\0" # DW_AT_name [...] Once the patch to handle this dynamic property gets applied, this is what happens when creating a varobj for variable "VTA" (whose value is null), and then trying to list its children: (gdb) -var-create vta * vta ^done,name="vta",numchild="2",value="0x0", type="bar.variant_type_access",has_more="0" (gdb) -var-list-children 1 vta ^done,numchild="2", children=[child={name="vta.n",[...]}, child={name="vta.f",exp="f", numchild="43877616", <<<<----- value="[43877616]", <<<<----- type="array (1 .. n) of character"}], has_more="0" It has an odd number of children. In this case, we cannot really determine the number of children, since that number depends on the value of a field in a record for which we do not have a value. Up to now, the value we've been displaying is zero - meaning we have an empty array. What happens in this case, is that, because the VTA is a null pointer, we're not able to resolve the pointer's target type, and therefore end up asking ada_varobj_get_array_number_of_children to return the number of elements in that array; for that, it relies blindly on get_array_bounds, which assumes the type is no longer dynamic, and therefore the reads the bound without seeing that it's value is actually a reference rather than a resolved constant. This patch prevents the issue by explicitly handling the case of dynamic arrays, and returning zero child in that case. gdb/ChangeLog: * ada-varobj.c (ada_varobj_get_array_number_of_children): Return zero if PARENT_VALUE is NULL and parent_type's range type is dynamic. gdb/testsuite/ChangeLog: * gdb.ada/mi_var_array: New testcase. Tested on x86_64-linux.
2015-01-14 15:39:24 +01:00
2015-01-29 Joel Brobecker <brobecker@adacore.com>
* ada-varobj.c (ada_varobj_get_array_number_of_children):
Return zero if PARENT_VALUE is NULL and parent_type's
range type is dynamic.
gdb/DWARF: dynamic subrange type of dynamic subrange type. Consider the following code: type Record_Type (N : Integer) is record A : Array_Type (1 .. N); end record; [...] R : Record_Type := Get (10); Trying to print the bounds of the array R.A yielded: (gdb) p r.a'last $4 = cannot find reference address for offset property A slightly different example, but from the same cause: (gdb) ptype r type = <ref> record n: integer; a: array (cannot find reference address for offset property Looking at the debugging info, "A" is described as... .uleb128 0x11 # (DIE (0x181) DW_TAG_member) .ascii "a\0" # DW_AT_name .long 0x15d # DW_AT_type [...] ... which is an array... .uleb128 0x12 # (DIE (0x15d) DW_TAG_array_type) .long .LASF18 # DW_AT_name: "foo__record_type__T4b" .long 0x194 # DW_AT_type .long 0x174 # DW_AT_sibling ... whose bounds are described as: .uleb128 0x13 # (DIE (0x16a) DW_TAG_subrange_type) .long 0x174 # DW_AT_type .long 0x153 # DW_AT_upper_bound .byte 0 # end of children of DIE 0x15d We can see above that the range has an implict lower value of 1, and an upper value which is a reference 0x153="n". All Good. But looking at the array's subrange subtype, we see... .uleb128 0x14 # (DIE (0x174) DW_TAG_subrange_type) .long 0x153 # DW_AT_upper_bound .long .LASF19 # DW_AT_name: "foo__record_type__T3b" .long 0x18d # DW_AT_type ... another subrange type whose bounds are exactly described the same way. So we have a subrange of a subrange, both with one bound that's dynamic. What happens in the case above is that GDB's resolution of "R.A" yields a array whose index type has static bounds. However, the subtype of the array's index type was left untouched, so, when taking the subtype of the array's subrange type, we were left with the unresolved subrange type, triggering the error above. gdb/ChangeLog: * gdbtypes.c (is_dynamic_type_internal) <TYPE_CODE_RANGE>: Return nonzero if the type's subtype is dynamic. (resolve_dynamic_range): Also resolve the range's subtype. Tested on x86_64-linux, no regression.
2015-01-05 15:39:02 +01:00
2015-01-29 Joel Brobecker <brobecker@adacore.com>
* gdbtypes.c (is_dynamic_type_internal) <TYPE_CODE_RANGE>: Return
nonzero if the type's subtype is dynamic.
(resolve_dynamic_range): Also resolve the range's subtype.
2015-01-29 Alexander Klimov <alserkli@inbox.ru> (tiny patch)
Pushed by Joel Brobecker <brobecker@adacore.com>.
* symfile.c (unmap_overlay_command): Initialize sec to NULL.
2015-01-27 Doug Evans <dje@google.com>
* NEWS: Mention gdb.Objfile.username.
* python/py-objfile.c (objfpy_get_username): New function.
(objfile_getset): Add "username".
2015-01-24 Mark Wielaard <mjw@redhat.com>
* stack.c (return_command): Markup warning message with _.
2015-01-24 Doug Evans <xdje42@gmail.com>
* gdbtypes.h (TYPE_TYPE_SPECIFIC): Delete.
Fix 100x slowdown regression on DWZ files Since Fedora started to use DWZ DWARF compressor: http://fedoraproject.org/wiki/Features/DwarfCompressor GDB has slowed down a lot. To make it clear - DWZ is DWARF structure rearrangement, "compressor" does not mean any zlib style data compression. This patch reduces LibreOffice backtrace from 5 minutes to 3 seconds (100x) and it also reduces memory consumption 20x. [ benchmark is at the bottom of this mail ] Example of DWZ output: ------------------------------------------------------------------------------ Compilation Unit @ offset 0xc4: <0><cf>: Abbrev Number: 17 (DW_TAG_partial_unit) <d0> DW_AT_stmt_list : 0x0 <d4> DW_AT_comp_dir : (indirect string, offset: 0x6f): /usr/src/debug/gdb-7.7.1/build-x86_64-redhat-linux-gnu/gdb <1><d8>: Abbrev Number: 9 (DW_TAG_typedef) <d9> DW_AT_name : (indirect string, offset: 0x827dc): size_t <dd> DW_AT_decl_file : 4 <de> DW_AT_decl_line : 212 <df> DW_AT_type : <0xae> Compilation Unit @ offset 0xe4: <0><ef>: Abbrev Number: 13 (DW_TAG_partial_unit) <f0> DW_AT_stmt_list : 0x0 <f4> DW_AT_comp_dir : (indirect string, offset: 0x6f): /usr/src/debug/gdb-7.7.1/build-x86_64-redhat-linux-gnu/gdb <1><f8>: Abbrev Number: 45 (DW_TAG_typedef) <f9> DW_AT_name : (indirect string, offset: 0x251): __off_t <fd> DW_AT_decl_file : 3 <fe> DW_AT_decl_line : 131 <ff> DW_AT_type : <0x68> Compilation Unit @ offset 0x62d9f9: <0><62da04>: Abbrev Number: 20 (DW_TAG_compile_unit) [...] <62da12> DW_AT_low_pc : 0x807e10 <62da1a> DW_AT_high_pc : 134 <62da1c> DW_AT_stmt_list : 0xf557e <1><62da20>: Abbrev Number: 7 (DW_TAG_imported_unit) <62da21> DW_AT_import : <0xcf> [Abbrev Number: 17] ------------------------------------------------------------------------------ One can see all DW_TAG_partial_unit have DW_AT_stmt_list 0x0 which causes repeated decoding of that .debug_line unit on each DW_TAG_imported_unit. This was OK before as each DW_TAG_compile_unit has its own .debug_line unit. But since the introduction of DW_TAG_partial_unit by DWZ one should cache read-in DW_AT_stmt_list .debug_line units. Fortunately one does not need to cache whole struct linetable *symtab->linetable and other data from .debug_line mapping PC<->lines ------------------------------------------------------------------------------ Line Number Statements: Extended opcode 2: set Address to 0x45c880 Advance Line by 25 to 26 Copy ------------------------------------------------------------------------------ as the only part of .debug_line which GDB needs for DW_TAG_partial_unit is: ------------------------------------------------------------------------------ The Directory Table: ../../gdb /usr/include/bits [...] The File Name Table: Entry Dir Time Size Name 1 1 0 0 gdb.c 2 2 0 0 string3.h [...] ------------------------------------------------------------------------------ specifically referenced in GDB for DW_AT_decl_file at a single place: ------------------------------------------------------------------------------ fe = &cu->line_header->file_names[file_index - 1]; SYMBOL_SYMTAB (sym) = fe->symtab; ------------------------------------------------------------------------------ This is because for some reason DW_TAG_partial_unit never contains PC-related DWARF information. I do not know exactly why, the compression ratio is a bit lower due to it but thanksfully currently it is that way: dwz.c: ------------------------------------------------------------------------------ /* These attributes reference code, prevent moving DIEs with them. */ case DW_AT_low_pc: case DW_AT_high_pc: case DW_AT_entry_pc: case DW_AT_ranges: die->die_ck_state = CK_BAD; + /* State of checksum computation. Not computed yet, computed and suitable for moving into partial units, currently being computed and finally determined unsuitable for moving into partial units. */ enum { CK_UNKNOWN, CK_KNOWN, CK_BEING_COMPUTED, CK_BAD } die_ck_state : 2; ------------------------------------------------------------------------------ I have also verified also real-world Fedora debuginfo files really comply with that assumption with dwgrep https://github.com/pmachata/dwgrep using: ------------------------------------------------------------------------------ dwgrep -e 'entry ?DW_TAG_partial_unit child* ( ?DW_AT_low_pc , ?DW_AT_high_pc , ?DW_AT_ranges )' /usr/lib/debug/** ------------------------------------------------------------------------------ BTW I think GDB already does not support the whole DW_TAG_imported_unit and DW_TAG_partial_unit usage possibilities as specified by the DWARF standard. I think GDB would not work if DW_TAG_imported_unit was used in some inner level and not at the CU level (readelf -wi level <1>) - this is how DWZ is using DW_TAG_imported_unit. Therefore I do not think further assumptions about DW_TAG_imported_unit and DW_TAG_partial_unit usage by DWZ are a problem for GDB. One could save the whole .debug_line decoded PC<->lines mapping (and not just the DW_AT_decl_file table) but: * there are some problematic corner cases so one could do it incorrectly * there are no real world data to really test such patch extension * such extension could be done perfectly incrementally on top of this patch ------------------------------------------------------------------------------ benchmark - on Fedora 20 x86_64 and FSF GDB HEAD: echo -e 'thread apply all bt\nset confirm no\nq'|./gdb -p `pidof soffice.bin` -ex 'set pagination off' -ex 'maintenance set per-command space' -ex 'maintenance set per-command symtab' -ex 'maintenance set per-command time' FSF GDB HEAD ("thread apply all bt"): Command execution time: 333.693000 (cpu), 335.587539 (wall) ---sec Space used: 1736404992 (+1477189632 for this command) ----MB vs. THIS PATCH ("thread apply all bt"): Command execution time: 2.595000 (cpu), 2.607573 (wall) -sec Space used: 340058112 (+85917696 for this command) --MB FSF GDB HEAD ("thread apply all bt full"): Command execution time: 466.751000 (cpu), 468.345837 (wall) ---sec Space used: 2330132480 (+2070974464 for this command) ----MB vs. THIS PATCH ("thread apply all bt full"): Command execution time: 18.907000 (cpu), 18.964125 (wall) --sec Space used: 364462080 (+110325760 for this command) ---MB ------------------------------------------------------------------------------ gdb/ChangeLog 2015-01-24 Jan Kratochvil <jan.kratochvil@redhat.com> Fix 100x slowdown regression on DWZ files. * dwarf2read.c (struct dwarf2_per_objfile): Add line_header_hash. (struct line_header): Add offset and offset_in_dwz. (dwarf_decode_lines): Add parameter decode_mapping to the declaration. (free_line_header_voidp): New declaration. (line_header_hash, line_header_hash_voidp, line_header_eq_voidp): New functions. (dwarf2_build_include_psymtabs): Update dwarf_decode_lines caller. (handle_DW_AT_stmt_list): Use line_header_hash. (free_line_header_voidp): New function. (dwarf_decode_line_header): Initialize offset and offset_in_dwz. (dwarf_decode_lines): New parameter decode_mapping, use it. (dwarf2_free_objfile): Free line_header_hash.
2015-01-24 15:44:52 +01:00
2015-01-24 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix 100x slowdown regression on DWZ files.
* dwarf2read.c (struct dwarf2_per_objfile): Add line_header_hash.
(struct line_header): Add offset and offset_in_dwz.
(dwarf_decode_lines): Add parameter decode_mapping to the declaration.
(free_line_header_voidp): New declaration.
(line_header_hash, line_header_hash_voidp, line_header_eq_voidp): New
functions.
(dwarf2_build_include_psymtabs): Update dwarf_decode_lines caller.
(handle_DW_AT_stmt_list): Use line_header_hash.
(free_line_header_voidp): New function.
(dwarf_decode_line_header): Initialize offset and offset_in_dwz.
(dwarf_decode_lines): New parameter decode_mapping, use it.
(dwarf2_free_objfile): Free line_header_hash.
2015-01-23 Simon Marchi <simon.marchi@ericsson.com>
PR gdb/17416
* valops.c (value_rtti_indirect_type): Catch exception thrown by
value_ind.
2015-01-15 Mark Wielaard <mjw@redhat.com>
* dwarf2read.c (read_subroutine_type): Set TYPE_NO_RETURN from
DW_AT_noreturn.
* gdbtypes.h (struct func_type): Add is_noreturn field flag. Make
calling_convention an 8 bit bit field.
(TYPE_NO_RETURN): New macro.
* infcmd.c (finish_command): Query if function does not return
normally.
* stack.c (return_command): Likewise.
2015-01-23 Pedro Alves <palves@redhat.com>
* linux-nat.c (linux_is_async_p): New macro.
(linux_nat_is_async_p):
(linux_nat_terminal_inferior): Check whether the target can async
instead of whether it is already async.
(linux_nat_terminal_ours): Don't check whether the target is
async.
(linux_async_pipe): Use linux_is_async_p.
Sort threads for thread apply all downstream Fedora request: Please make it easier to find the backtrace of the crashing thread https://bugzilla.redhat.com/show_bug.cgi?id=1024504 Currently after loading a core file GDB prints: Core was generated by `./threadcrash1'. Program terminated with signal SIGSEGV, Segmentation fault. 8 *(volatile int *)0=0; (gdb) _ there is nowhere seen which of the threads had crashed. In reality GDB always numbers that thread as #1 and it is the current thread that time. But after dumping all the info into a file for later analysis it is no longer obvious. 'thread apply all bt' even puts the thread #1 to the _end_ of the output!!! I find maybe as good enough and with no risk of UI change flamewar to just sort the threads by their number. Currently they are printed as they happen in the internal GDB list which has no advantage. Printing thread #1 as the first one with assumed 'thread apply all bt' (after the core file is loaded) should make the complaint resolved I guess. On Thu, 15 Jan 2015 20:29:07 +0100, Doug Evans wrote: No objection to sorting the list, but if thread #1 is the important one, then a concern could be it'll have scrolled off the screen (such a concern has been voiced in another thread in another context), and if not lost (say it's in an emacs buffer) one would still have to scroll back to see it. So one *could* still want #1 to be last. Do we want an option to choose the sort direction? gdb/ChangeLog 2015-01-22 Jan Kratochvil <jan.kratochvil@redhat.com> * NEWS (Changes since GDB 7.9): Add 'thread apply all' option '-ascending'. * thread.c (tp_array_compar_ascending, tp_array_compar): New. (thread_apply_all_command): Parse CMD for tp_array_compar_ascending. Sort tp_array using tp_array_compar. (_initialize_thread): Extend thread_apply_all_command help. gdb/doc/ChangeLog 2015-01-22 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.texinfo (Threads): Describe -ascending for thread apply all.
2015-01-22 21:04:53 +01:00
2015-01-22 Jan Kratochvil <jan.kratochvil@redhat.com>
* NEWS (Changes since GDB 7.9): Add 'thread apply all' option
'-ascending'.
* thread.c (tp_array_compar_ascending, tp_array_compar): New.
(thread_apply_all_command): Parse CMD for tp_array_compar_ascending.
Sort tp_array using tp_array_compar.
(_initialize_thread): Extend thread_apply_all_command help.
2015-01-22 Jan Kratochvil <jan.kratochvil@redhat.com>
* corelow.c (core_open): Call also thread_command.
* gdbthread.h (thread_command): New prototype moved from ...
* thread.c (thread_command): ... here.
(thread_command): Make it global.
2015-01-22 Pedro Alves <palves@redhat.com>
* configure.ac [*mingw32*]: Check $curses_found instead of
$prefer_curses.
* configure: Regenerate.
* windows-termcap.c: Remove HAVE_CURSES_H, HAVE_NCURSES_H and
HAVE_NCURSES_NCURSES_H checks.
2015-01-22 Eli Zaretskii <eliz@gnu.org>
* tui/tui.c (tui_enable) [__MINGW32__]: If the call to 'newterm'
fails with the 1st arg NULL, try again with "unknown". Don't test
the "cup" capability: it isn't supported by the Windows port of
ncurses, but the Windows console driver is still capable of
supporting TUI.
2015-01-22 Jan Kratochvil <jan.kratochvil@redhat.com>
* compile/compile.c (_initialize_compile): Use -fPIE for compile_args.
2015-01-22 Eli Zaretskii <eliz@gnu.org>
* Makefile.in (HFILES_NO_SRCDIR): Remove ada-varobj.h.
(ALLDEPFILES): Remove irix5-nat.c. These two are part of the
reason that "make TAGS" is broken.
2015-01-22 Chen Gang <gang.chen.5i5j@gmail.com>
* hppa-tdep.c (inst_saves_gr): Fix logical working flow issues
and check additional store instructions.
2015-01-21 Wei-cheng Wang <cole945@gmail.com>
* MAINTAINERS (Write After Approval): Add "Wei-cheng Wang".
2015-01-21 Wei-cheng Wang <cole945@gmail.com>
* ppc-linux-tdep.c (ppc_skip_trampoline_code,
ppc_canonicalize_syscall, ppc_linux_syscall_record,
ppc_linux_record_signal, ppc_init_linux_record_tdep): Add comments.
* ppc64-tdep.c (ppc64_skip_trampoline_code): Likewise.
* rs6000-tdep.c (rs6000_epilogue_frame_cache,
rs6000_epilogue_frame_this_id, rs6000_epilogue_frame_prev_register,
rs6000_epilogue_frame_sniffer, ppc_record_vsr, ppc_process_record_op4,
ppc_process_record_op19, ppc_process_record_op31,
ppc_process_record_op59, ppc_process_record_op60,
ppc_process_record_op63): Likewise.
2015-01-20 Joel Brobecker <brobecker@adacore.com>
* nat/linux-ptrace.c (linux_ptrace_attach_fail_reason_string)
(linux_ptrace_test_ret_to_nx): Use safe_strerror instead of
strerror.
2015-01-20 19:04:26 +01:00
2015-01-20 Wei-cheng Wang <cole945@gmail.com>
2015-01-18 08:20:46 +01:00
* rs6000-tdep.c (ppc_process_record_op4, ppc_process_record_op19,
ppc_process_record_op31, ppc_process_record_op59,
ppc_process_record_op60, ppc_process_record_op63,
ppc_process_record): Fix -Wformat warning.
* rs6000-tdep.c (rs6000_epilogue_frame_cache, ppc_process_record_op60):
Remove unused variables.
2015-01-20 Chen Gang <gang.chen.5i5j@gmail.com>
* MAINTAINERS (Write After Approval): Add "Chen Gang".
2015-01-19 Eli Zaretskii <eliz@gnu.org>
* configure.ac [*mingw32*]: Only add windows-termcap.o to
CONFIG_OBS if not building with a curses library.
* configure: Regenerate.
* windows-termcap.c: Include defs.h. Make the whole body empty if
either one of HAVE_CURSES_H or HAVE_NCURSES_H or
HAVE_NCURSES_NCURSES_H is defined.
2015-01-19 Joel Brobecker <brobecker@adacore.com>
* rs6000-tdep.c (rs6000_gdbarch_init): Move divide operator
from end of line to start of next line.
2015-01-17 Wei-cheng Wang <cole945@gmail.com>
* ppc-linux-tdep.c (ppc_skip_trampoline_code):
Scan PLT stub backward for reverse debugging.
* ppc64-tdep.c (ppc64_skip_trampoline_code): Likewise.
2015-01-17 07:30:33 +01:00
2015-01-17 Wei-cheng Wang <cole945@gmail.com>
Ulrich Weigand <uweigand@de.ibm.com>
* configure.tgt (powerpc*-*-linux): Add linux-record.o to
gdb_target_obs.
(ppc_linux_record_tdep, ppc64_linux_record_tdep): New for linux syscall
record.
(ppc_canonicalize_syscall, ppc_linux_syscall_record,
ppc_linux_record_signal, ppc_init_linux_record_tdep): New functions.
(ppc_linux_init_abi): Set process_record, process_record_signal.
* ppc-tdep.h (struct gdbarch_tdep): Add ppc_syscall_record and
ppc_linux_record_tdep to gdbarch_tdep.
(ppc_process_record): New declaration.
* rs6000-tdep.c (ppc_record_vsr, ppc_process_record_op4,
ppc_process_record_op19, ppc_process_record_op31,
ppc_process_record_op59, ppc_process_record_op60,
ppc_process_record_op63, ppc_process_record): New functions.
2015-01-17 07:29:16 +01:00
2015-01-17 Wei-cheng Wang <cole945@gmail.com>
* rs6000-tdep.c (rs6000_in_function_epilogue_p): Rename to
rs6000_in_function_epilogue_frame_p and add an argument
for frame_info.
(rs6000_epilogue_frame_cache, rs6000_epilogue_frame_this_id,
rs6000_epilogue_frame_prev_register, rs6000_epilogue_frame_sniffer):
New functions.
(rs6000_epilogue_frame_unwind): New.
(rs6000_gdbarch_init): Append epilogue unwinder.
2015-01-16 Sergio Durigan Junior <sergiodj@redhat.com>
* nat/linux-personality.c: Replace "#ifndef
HAVE_DECL_ADDR_NO_RANDOMIZE" by "#if
!HAVE_DECL_ADDR_NO_RANDOMIZE", fixing a regression in RHEL-5
systems.
2015-01-16 Eli Zaretskii <eliz@gnu.org>
* tui/tui-win.c (tui_rehighlight_all, tui_set_var_cmd): New
functions.
(_initialize_tui_win) <border-kind, border-mode>:
<active-border-mode>: Use tui_set_var_cmd as the "set" function.
(tui_set_tab_width_command): Fix the commentary.
* tui/tui-win.h: Add prototype for tui_rehighlight_all.
* tui/tui-win.c (tui_scroll_left_command, tui_scroll_right_command):
Doc fix.
(tui_set_tab_width_command): Delete and recreate the source and
the disassembly windows, to show the effect of the changed tab
size immediately.
* tui/tui-data.h (LINE_PREFIX): Make shorter
(MAX_PID_WIDTH): Enlarge from 14 to 19, to leave enough space for
"Thread NNNNN.XXXX" thread ID notation on Windows.
2015-01-16 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix gcc-5 compilation.
* hppa-tdep.c (inst_saves_gr): Fix parentheses typo.
Move code to disable ASR to nat/ This patch moves the shared code present on gdb/linux-nat.c:linux_nat_create_inferior and gdb/gdbserver/linux-low.c:linux_create_inferior to nat/linux-personality.c. This code is responsible for disabling address space randomization based on user setting, and using <sys/personality.h> to do that. I decided to put the prototype of the maybe_disable_address_space_randomization on nat/linux-osdata.h because it seemed the best place to put it. I regression-tested this patch on Fedora 20 x86_64, and found no regressions. gdb/ChangeLog 2015-01-15 Sergio Durigan Junior <sergiodj@redhat.com> * Makefile.in (HFILES_NO_SRCDIR): Add nat/linux-personality.h. (linux-personality.o): New rule. * common/common-defs.h: Include <stdint.h>. * config/aarch64/linux.mh (NATDEPFILES): Include linux-personality.o. * config/alpha/alpha-linux.mh (NATDEPFILES): Likewise. * config/arm/linux.mh (NATDEPFILES): Likewise. * config/i386/linux64.mh (NATDEPFILES): Likewise. * config/i386/linux.mh (NATDEPFILES): Likewise. * config/ia64/linux.mh (NATDEPFILES): Likewise. * config/m32r/linux.mh (NATDEPFILES): Likewise. * config/m68k/linux.mh (NATDEPFILES): Likewise. * config/mips/linux.mh (NATDEPFILES): Likewise. * config/pa/linux.mh (NATDEPFILES): Likewise. * config/powerpc/linux.mh (NATDEPFILES): Likewise. * config/powerpc/ppc64-linux.mh (NATDEPFILES): Likewise. * config/powerpc/spu-linux.mh (NATDEPFILES): Likewise. * config/s390/linux.mh (NATDEPFILES): Likewise. * config/sparc/linux64.mh (NATDEPFILES): Likewise. * config/sparc/linux.mh (NATDEPFILES): Likewise. * config/tilegx/linux.mh (NATDEPFILES): Likewise. * config/xtensa/linux.mh (NATDEPFILES): Likewise. * defs.h: Remove #include <stdint.h> (moved to common/common-defs.h). * linux-nat.c: Include nat/linux-personality.h. Remove #include <sys/personality.h>; do not define ADDR_NO_RANDOMIZE (moved to nat/linux-personality.c). (linux_nat_create_inferior): Remove code to disable address space randomization (moved to nat/linux-personality.c). Create cleanup to disable address space randomization. * nat/linux-personality.c: New file. * nat/linux-personality.h: Likewise. gdb/gdbserver/ChangeLog 2015-01-15 Sergio Durigan Junior <sergiodj@redhat.com> * Makefile.in (SFILES): Add linux-personality.c. (linux-personality.o): New rule. * configure.srv (srv_linux_obj): Add linux-personality.o to the list of objects to be built. * linux-low.c: Include nat/linux-personality.h. (linux_create_inferior): Remove code to disable address space randomization (moved to ../nat/linux-personality.c). Create cleanup to disable address space randomization.
2015-01-15 21:10:49 +01:00
2015-01-15 Sergio Durigan Junior <sergiodj@redhat.com>
* Makefile.in (HFILES_NO_SRCDIR): Add nat/linux-personality.h.
(linux-personality.o): New rule.
* common/common-defs.h: Include <stdint.h>.
* config/aarch64/linux.mh (NATDEPFILES): Include
linux-personality.o.
* config/alpha/alpha-linux.mh (NATDEPFILES): Likewise.
* config/arm/linux.mh (NATDEPFILES): Likewise.
* config/i386/linux64.mh (NATDEPFILES): Likewise.
* config/i386/linux.mh (NATDEPFILES): Likewise.
* config/ia64/linux.mh (NATDEPFILES): Likewise.
* config/m32r/linux.mh (NATDEPFILES): Likewise.
* config/m68k/linux.mh (NATDEPFILES): Likewise.
* config/mips/linux.mh (NATDEPFILES): Likewise.
* config/pa/linux.mh (NATDEPFILES): Likewise.
* config/powerpc/linux.mh (NATDEPFILES): Likewise.
* config/powerpc/ppc64-linux.mh (NATDEPFILES): Likewise.
* config/powerpc/spu-linux.mh (NATDEPFILES): Likewise.
* config/s390/linux.mh (NATDEPFILES): Likewise.
* config/sparc/linux64.mh (NATDEPFILES): Likewise.
* config/sparc/linux.mh (NATDEPFILES): Likewise.
* config/tilegx/linux.mh (NATDEPFILES): Likewise.
* config/xtensa/linux.mh (NATDEPFILES): Likewise.
* defs.h: Remove #include <stdint.h> (moved to
common/common-defs.h).
* linux-nat.c: Include nat/linux-personality.h. Remove #include
<sys/personality.h>; do not define ADDR_NO_RANDOMIZE (moved to
nat/linux-personality.c).
(linux_nat_create_inferior): Remove code to disable address space
randomization (moved to nat/linux-personality.c). Create cleanup
to disable address space randomization.
* nat/linux-personality.c: New file.
* nat/linux-personality.h: Likewise.
Move safe_strerror to common/ This patch moves safe_strerror from the gdb/{posix,mingw}-hdep.c files to the respective common/{posix,mingw}-strerror.c files. This is a preparation for the next patch, which shares a common code (to disable address space randomization when creating a new inferior). The patch has been regtested on Fedora 20 x86_64, and no regressions were found. gdb/ChangeLog 2015-01-15 Sergio Durigan Junior <sergiodj@redhat.com> * Makefile.in (ALLDEPFILES): Including common/mingw-strerror.c and common/posix-strerror.c. (posix-strerror.o): New rule. (mingw-strerror.o): Likewise. * common/common-utils.h (safe_strerror): Move prototype to here, from utils.h. * common/common.host: New file. * common/mingw-strerror.c: Likewise. * common/posix-strerror.c: Likewise. * configure: Regenerated. * configure.ac: Source common/common.host. Add variable common_host_obs to gdb_host_obs. * contrib/ari/gdb_ari.sh: Mention gdb/common/mingw-strerror.c and gdb/common/posix-strerror.c when warning about the use of strerror. * mingw-hdep.c (safe_strerror): Remove definition; move it to common/mingw-strerror.c. * posix-hdep.c (safe_strerror): Remove definition; move it to common/posix-hdep.c. * utils.h (safe_strerror): Remove prototype; move to common/common-utils.h. gdb/gdbserver/ChangeLog 2015-01-15 Sergio Durigan Junior <sergiodj@redhat.com> * Makefile.in (posix-strerror.o): New rule. (mingw-strerror.o): Likewise. * configure: Regenerated. * configure.ac: Source file ../common/common.host. Initialize new variable srv_host_obs. Add srv_host_obs to GDBSERVER_DEPFILES.
2015-01-15 21:09:15 +01:00
2015-01-15 Sergio Durigan Junior <sergiodj@redhat.com>
* Makefile.in (ALLDEPFILES): Including common/mingw-strerror.c and
common/posix-strerror.c.
(posix-strerror.o): New rule.
(mingw-strerror.o): Likewise.
* common/common-utils.h (safe_strerror): Move prototype to here,
from utils.h.
* common/common.host: New file.
* common/mingw-strerror.c: Likewise.
* common/posix-strerror.c: Likewise.
* configure: Regenerated.
* configure.ac: Source common/common.host. Add variable
common_host_obs to gdb_host_obs.
* contrib/ari/gdb_ari.sh: Mention gdb/common/mingw-strerror.c and
gdb/common/posix-strerror.c when warning about the use of
strerror.
* mingw-hdep.c (safe_strerror): Remove definition; move it to
common/mingw-strerror.c.
* posix-hdep.c (safe_strerror): Remove definition; move it to
common/posix-hdep.c.
* utils.h (safe_strerror): Remove prototype; move to
common/common-utils.h.
2015-01-15 Joel Brobecker <brobecker@adacore.com>
GDB 7.8.2 released.
[Ada] 'first/'last/'length of array whose bound is a discriminant Consider the following code: type Table is array (Positive range <>) of Integer; type Object (N : Integer) is record Data : Table (1 .. N); end record; My_Object : Object := (N => 3, Data => (3, 5, 8)); Trying to print the range and length of the My_Object.Data array yields: (gdb) print my_object.data'first $1 = 1 (gdb) print my_object.data'last $2 = 0 (gdb) print my_object.data'length $3 = 0 The first one is correct, and that is thanks to the fact that the lower bound is statically known. However, for the upper bound, and consequently the array's length, the values are incorrect. It should be: (gdb) print my_object.data'last $2 = 3 (gdb) print my_object.data'length $3 = 3 What happens here is that ada_array_bound_from_type sees that our array has a parallel "___XA" type, and therefore tries to use it. In particular, it described our array's index type as: [...]___XDLU_1__n, which means lower bound = 1, and upper bound is value of "n". Unfortunately, ada_array_bound_from_type does not have access to the discriminant, and is therefore unable to compute the bound correctly. Fortunately, at this stage, the bound has already been computed a while ago, and therefore doesn't need to be re-computed here. This patch fixes the issue by ignoring that ___XA type if the array is marked as already fixed. This also fixes the same issue with packed arrays. gdb/ChangeLog: * ada-lang.c (ada_array_bound_from_type): Ignore array's parallel ___XA type if the array has already been fixed. gdb/testsuite/ChangeLog: * gdb.ada/var_arr_attrs: New testcase.
2015-01-15 07:09:32 +01:00
2015-01-15 Joel Brobecker <brobecker@adacore.com>
* ada-lang.c (ada_array_bound_from_type): Ignore array's parallel
___XA type if the array has already been fixed.
Detect 64-bit-ness in PowerPC Book III-E This patch is to teach both GDB and GDBServer to detect 64-bit inferior correctly. We find a problem that GDBServer is unable to detect on a e5500 core processor. Current GDBServer assumes that MSR is a 64-bit register, but MSR is a 32-bit register in Book III-E. This patch is to fix this problem by checking the right bit in MSR, in order to handle both Book III-S and Book III-E. In order to detect Book III-S and Book III-E, we check the PPC_FEATURE_BOOKE from the host's HWCAP (by getauxval on glibc >= 2.16. If getauxval doesn't exist, we implement the fallback by parsing /proc/self/auxv), because it should an invariant on the same machine cross different processes. In order to share code, I add nat/ppc-linux.c for both GDB and GDBserver side. gdb: 2015-01-14 Yao Qi <yao@codesourcery.com> * Makefile.in (ppc-linux.o): New rule. * config/powerpc/ppc64-linux.mh (NATDEPFILES): Add ppc-linux.o. * configure.ac: AC_CHECK_FUNCS(getauxval). * config.in: Re-generated. * configure: Re-generated. * nat/ppc-linux.h [__powerpc64__] (ppc64_64bit_inferior_p): Declare. * nat/ppc-linux.c: New file. * ppc-linux-nat.c (ppc_linux_target_wordsize) [__powerpc64__]: Call ppc64_64bit_inferior_p. gdb/gdbserver: 2015-01-14 Yao Qi <yao@codesourcery.com> * Makefile.in (SFILES): Add nat/ppc-linux.c. (ppc-linux.o): New rule. * configure.srv (powerpc*-*-linux*): Add ppc-linux.o. * configure.ac: AC_CHECK_FUNCS(getauxval). * config.in: Re-generated. * configure: Re-generated. * linux-ppc-low.c (ppc_arch_setup) [__powerpc64__]: Call ppc64_64bit_inferior_p
2014-11-28 02:18:26 +01:00
2015-01-14 Yao Qi <yao@codesourcery.com>
* Makefile.in (ppc-linux.o): New rule.
* config/powerpc/ppc64-linux.mh (NATDEPFILES): Add ppc-linux.o.
* configure.ac: AC_CHECK_FUNCS(getauxval).
* config.in: Re-generated.
* configure: Re-generated.
* nat/ppc-linux.h [__powerpc64__] (ppc64_64bit_inferior_p):
Declare.
* nat/ppc-linux.c: New file.
* ppc-linux-nat.c (ppc_linux_target_wordsize) [__powerpc64__]:
Call ppc64_64bit_inferior_p.
2015-01-14 Yao Qi <yao@codesourcery.com>
* ppc-linux-nat.c (PT_ORIG_R3, PT_TRAP): Move to
nat/ppc-linux.h.
(PPC_FEATURE_CELL, PPC_FEATURE_BOOKE): Likewise.
(PPC_FEATURE_HAS_DFP): Likewise.
(PTRACE_GETVRREGS, PTRACE_SETVRREGS): Likewise.
(PTRACE_GETVSXREGS, PTRACE_SETVSXREGS): Likewise.
(PTRACE_GETEVRREGS, PTRACE_SETEVRREGS): Likewise.
Include "nat/ppc-linux.h".
* nat/ppc-linux.h: New file.
* Makefile.in (HFILES_NO_SRCDIR): Add nat/ppc-linux.h.
2015-01-14 Pedro Alves <palves@redhat.com>
PR gdb/17525
* breakpoint.c: Include "interps.h".
(bpstat_do_actions_1): Also check whether the interpreter is
async.
PR cli/17828: -batch -ex r breaks terminal Commit d3d4baed (PR python/17372 - Python hangs when displaying help()) had the side effect of causing 'gdb -batch' to leave the terminal in the wrong state if the program was run. E.g,. $ echo 'main(){*(int*)0=0;}' | gcc -x c -; ./gdb/gdb -batch -ex r ./a.out Program received signal SIGSEGV, Segmentation fault. 0x00000000004004ff in main () $ If you start typing the next command, seemingly nothing happens - GDB left the terminal with echo disabled. The issue is that that "r" ends up in fetch_inferior_event, which calls reinstall_readline_callback_handler_cleanup, which causes readline to prep the terminal (raw, echo disabled). But "-batch" causes GDB to exit before the top level event loop is first started, and then nothing de-preps the terminal. The reinstall_readline_callback_handler_cleanup function's intro comment mentions: "Need to do this as we go back to the event loop, ready to process further input." but the implementation forgets the case of when the interpreter is sync, which indicates we won't return to the event loop yet, or as in the case of -batch, we have not started it yet. The fix is to not install the readline callback in that case. For the test, in this case, checking that command echo still works is sufficient. Comparing stty output before/after running GDB is even better. Because stty may not be available, the test tries both ways. In any case, since expect's spawn (what we use to start gdb) creates a new pseudo tty, another expect spawn or tcl exec after GDB exits would not see the wrong terminal settings. So instead, the test spawns a shell and runs stty and GDB in it. Tested on x86_64 Fedora 20. gdb/ 2015-01-14 Pedro Alves <palves@redhat.com> PR cli/17828 * infrun.c (reinstall_readline_callback_handler_cleanup): Don't reinstall if the interpreter is sync. gdb/testsuite/ 2015-01-14 Pedro Alves <palves@redhat.com> PR cli/17828 * gdb.base/batch-preserve-term-settings.c: New file. * gdb.base/batch-preserve-term-settings.exp: New file.
2015-01-14 12:51:06 +01:00
2015-01-14 Pedro Alves <palves@redhat.com>
PR cli/17828
* infrun.c (reinstall_readline_callback_handler_cleanup): Don't
reinstall if the interpreter is sync.
2015-01-13 Doug Evans <dje@google.com>
* objfiles.c (objfile_filename): New function.
* objfiles.h (objfile_filename): Declare it.
(objfile_name): Add function comment.
* python/py-objfile.c (objfpy_lookup_objfile_by_name): Try both the
bfd file name (which may be realpath'd), and the original name.
2015-01-13 Joel Brobecker <brobecker@adacore.com>
* NEWS: Create a new section for the next release branch.
Rename the section of the current branch, now that it has
been cut.
2015-01-13 Joel Brobecker <brobecker@adacore.com>
GDB 7.9 branch created (92fc2e6978d9a7c8324c7e851dbee59e22ec7a37):
* version.in: Bump version to 7.9.50.DATE-cvs.
2015-01-13 Joel Brobecker <brobecker@adacore.com>
* nat/linux-procfs.c (linux_proc_attach_tgid_threads):
Remove trailing new-line in argument of call to warning.
2015-01-13 Joel Brobecker <brobecker@adacore.com>
* linux-nat.c (attach_proc_task_lwp_callback): Remove trailing
new-line in argument of call to "warning".
2015-01-13 Joel Brobecker <brobecker@adacore.com>
* ada-lang.c (ada_lookup_symbol_nonlocal): If name not found
in static block, then try searching for primitive types.
2015-01-12 Patrick Palka <patrick@parcs.ath.cx>
* top.h (gdb_add_history): Declare.
* top.c (command_count): New variable.
(gdb_add_history): New function.
(gdb_safe_append_history): New static function.
(quit_force): Call it.
(command_line_input): Use gdb_add_history instead of
add_history.
* event-top.c (command_line_handler): Likewise.
2015-01-12 James Clarke <jrtc27@jrtc27.com> (tiny patch)
PR gdb/17046
* darwin-nat.c: Replace <machine/setjmp.h> #include by
<setjmp.h> #include.
2015-01-11 Doug Evans <xdje42@gmail.com>
* dwarf2read.c (compute_delayed_physnames): Use TYPE_FN_FIELD_PHYSNAME.
2015-01-11 Doug Evans <xdje42@gmail.com>
PR gdb/15830
* NEWS: The "maint demangle" command is renamed as "demangle".
* demangle.c: #include cli/cli-utils.h, language.h.
(demangle_command): New function.
(_initialize_demangle): Add new command "demangle".
* maint.c (maintenance_demangle): Stub out.
(_initialize_maint_cmds): Update help text for "maint demangle",
and mark as deprecated.
2015-01-11 Mark Kettenis <kettenis@gnu.org>
* inf-ptrace.c (inf_ptrace_follow_fork): Adjust now that
inferior_thread is a function.
2015-01-09 Patrick Palka <patrick@parcs.ath.cx>
* Makefile.in (.y.c): Don't munge yacc's #line
directives.
Consolidate the custom TUI query hook with the default query hook This patch primarily rewrites defaulted_query() to use gdb_readline_wrapper() to prompt the user for input, like prompt_for_continue() does. The motivation for this rewrite is to be able to reuse the default query hook in TUI, obviating the need for a custom TUI query hook. However, having TUI use the default query mechanism exposed a couple of latent bugs in tui_redisplay_readline() related to the handling of multi-line prompts, in particular GDB's multi-line quit prompt. The first issue is an off-by-one error in the calculation of the height of the prompt. The check in question should be col <= prev_col, not c < prev_col, to properly account for the case when a prompt contains multiple consecutive newlines. Failing to do so makes TUI have the wrong idea of the vertical height of the prompt. This patch fixes the column check. The second issue is that cur_line does not get updated to reflect the cursor position if the user's prompt cursor is at the end of the prompt (i.e. if rl_point == rl_end). cur_line only gets updated if rl_point lies between 0..rl_end-1 because that is the bounds of the for loop responsible for updating cur_line. This patch changes the loop's bounds to 0..rl_end so that cur_line always gets updated. With these two bug fixes out of the way, the default query mechanism works well in TUI even with multi-line prompts like GDB's quit prompt. gdb/ChangeLog: * utils.c (defaulted_query): Rewrite to use gdb_readline_wrapper to prompt for input. * tui/tui-hooks.c (tui_query_hook): Remove. (tui_install_hooks): Don't set deprecated_query_hook. * tui/tui-io.c (tui_redisplay_readline): Fix off-by-one error in height calculation. Always update the command window's cur_line.
2015-01-09 19:27:56 +01:00
2015-01-09 Patrick Palka <patrick@parcs.ath.cx>
* utils.c (defaulted_query): Rewrite to use gdb_readline_wrapper
to prompt for input.
* tui/tui-hooks.c (tui_query_hook): Remove.
(tui_install_hooks): Don't set deprecated_query_hook.
* tui/tui-io.c (tui_redisplay_readline): Fix off-by-one error in
height calculation. Always update the command window's cur_line.
linux-nat.c: better starvation avoidance, handle non-stop mode too Running the testsuite with a series that reimplements user-visible all-stop behavior on top of a target running in non-stop mode revealed problems related to event starvation avoidance. For example, I see gdb.threads/signal-while-stepping-over-bp-other-thread.exp failing. What happens is that GDB core never gets to see the signal event. It ends up processing the events for the same threads over an over, because Linux's waitpid(-1, ...) returns that first task in the task list that has an event, starving threads on the tail of the task list. So I wrote a non-stop mode test originally inspired by signal-while-stepping-over-bp-other-thread.exp, to stress this independently of all-stop on top of non-stop. Fixing it required the changes described below. The test will be added in a following commit. 1) linux-nat.c has code in place that picks an event LWP at random out of all that have had events. This is because on the kernel side, "waitpid(-1, ...)" just walks the task list linearly looking for the first that had an event. But, this code is currently only used in all-stop mode. So with a multi-threaded program that has multiple events triggering debug events in parallel, GDB ends up starving some threads. To make the event randomization work in non-stop mode too, the patch makes us pull out all the already pending events on the kernel side, with waitpid, before deciding which LWP to report to the core. There's some code in linux_wait that takes care of leaving events pending if they were for LWPs the caller is not interested in. The patch moves that to linux_nat_filter_event, so that we only have one place that leaves events pending. With that in place, conceptually, the flow is simpler and more normalized: #1 - walk the LWP list looking for an LWP with a pending event to report. #2 - if no pending event, pull events out of the kernel, and store them in the LWP structures as pending. #3- goto #1. 2) Then, currently the event randomization code only considers SIGTRAP (or trap-like) events. That means that if e.g., have have multiple threads stepping in parallel that hit a breakpoint that needs stepping over, and one gets a signal, the signal may end up never getting processed, because GDB will always be giving priority to the SIGTRAPs. The patch fixes this by making the randomization code consider all kinds of pending events. 3) If multiple threads hit a breakpoint, we report one of those, and "cancel" the others. Cancelling means decrementing the PC, and discarding the event. If the next time the LWP is resumed the breakpoint is still installed, the LWP should hit it again, and we'll report the hit then. The problem I found is that this delays threads from advancing too much, with the kernel potentially ending up scheduling the same threads over and over, and others not advancing. So the patch switches away from cancelling the breakpoints, and instead remembering that the LWP had stopped for a breakpoint. If on resume the breakpoint is still installed, we report it. If it's no longer installed, we discard the pending event then. This is actually how GDBserver used to handle this before d50171e4 (Teach linux gdbserver to step-over-breakpoints), but with the difference that back then we'd delay adjusting the PC until resuming, which made it so that "info threads" could wrongly see threads with unadjusted PCs. gdb/ 2015-01-09 Pedro Alves <palves@redhat.com> * breakpoint.c (hardware_breakpoint_inserted_here_p): New function. * breakpoint.h (hardware_breakpoint_inserted_here_p): New declaration. * linux-nat.c (linux_nat_status_is_event): Move higher up in file. (linux_resume_one_lwp): Store the thread's PC. Adjust to clear stop_reason. (check_stopped_by_watchpoint): New function. (save_sigtrap): Reimplement. (linux_nat_stopped_by_watchpoint): Adjust. (linux_nat_lp_status_is_event): Delete. (stop_wait_callback): Only call save_sigtrap after storing the pending status. (status_callback): If the thread had been stopped for a breakpoint that has since been removed, discard the event and resume the LWP. (count_events_callback, select_event_lwp_callback): Use lwp_status_pending_p instead of linux_nat_lp_status_is_event. (cancel_breakpoint): Rename to ... (check_stopped_by_breakpoint): ... this. Record whether the LWP stopped for a software breakpoint or hardware breakpoint. (select_event_lwp): Only give preference to the stepping LWP in all-stop mode. Adjust comments. (stop_and_resume_callback): Remove references to new_pending_p. (linux_nat_filter_event): Likewise. Leave exit events of the leader thread pending here. Handle signal short circuiting here. Only call save_sigtrap after storing the pending waitstatus. (linux_nat_wait_1): Remove 'retry' label. Remove references to new_pending. Don't handle leaving events the caller is not interested in pending here, nor handle signal short-circuiting here. Also give equal priority to all LWPs that have had events in non-stop mode. If reporting a software breakpoint event, unadjust the LWP's PC. * linux-nat.h (enum lwp_stop_reason): New. (struct lwp_info) <stop_pc>: New field. (struct lwp_info) <stopped_by_watchpoint>: Delete field. (struct lwp_info) <stop_reason>: New field. * x86-linux-nat.c (x86_linux_prepare_to_resume): Adjust.
2015-01-07 13:48:32 +01:00
2015-01-09 Pedro Alves <palves@redhat.com>
* breakpoint.c (hardware_breakpoint_inserted_here_p): New
function.
* breakpoint.h (hardware_breakpoint_inserted_here_p): New
declaration.
* linux-nat.c (linux_nat_status_is_event): Move higher up in file.
(linux_resume_one_lwp): Store the thread's PC. Adjust to clear
stop_reason.
(check_stopped_by_watchpoint): New function.
(save_sigtrap): Reimplement.
(linux_nat_stopped_by_watchpoint): Adjust.
(linux_nat_lp_status_is_event): Delete.
(stop_wait_callback): Only call save_sigtrap after storing the
pending status.
(status_callback): If the thread had been stopped for a breakpoint
that has since been removed, discard the event and resume the LWP.
(count_events_callback, select_event_lwp_callback): Use
lwp_status_pending_p instead of linux_nat_lp_status_is_event.
(cancel_breakpoint): Rename to ...
(check_stopped_by_breakpoint): ... this. Record whether the LWP
stopped for a software breakpoint or hardware breakpoint.
(select_event_lwp): Only give preference to the stepping LWP in
all-stop mode. Adjust comments.
(stop_and_resume_callback): Remove references to new_pending_p.
(linux_nat_filter_event): Likewise. Leave exit events of the
leader thread pending here. Handle signal short circuiting here.
Only call save_sigtrap after storing the pending waitstatus.
(linux_nat_wait_1): Remove 'retry' label. Remove references to
new_pending. Don't handle leaving events the caller is not
interested in pending here, nor handle signal short-circuiting
here. Also give equal priority to all LWPs that have had events
in non-stop mode. If reporting a software breakpoint event,
unadjust the LWP's PC.
* linux-nat.h (enum lwp_stop_reason): New.
(struct lwp_info) <stop_pc>: New field.
(struct lwp_info) <stopped_by_watchpoint>: Delete field.
(struct lwp_info) <stop_reason>: New field.
* x86-linux-nat.c (x86_linux_prepare_to_resume): Adjust.
2015-01-09 Pedro Alves <palves@redhat.com>
* linux-nat.c (linux_handle_extended_wait) <PTRACE_EVENT_EXEC>:
Set the LWP's 'resumed' flag.
2015-01-09 Pedro Alves <palves@redhat.com>
* linux-nat.c (linux_resume_one_lwp): New function.
(resume_lwp): Use lwp_status_pending_p and linux_resume_one_lwp.
(linux_nat_resume): Use lwp_status_pending_p and
linux_resume_one_lwp.
(linux_handle_syscall_trap): Use linux_resume_one_lwp.
(linux_handle_extended_wait): Use linux_resume_one_lwp.
(status_callback, running_callback): Use lwp_status_pending_p.
(lwp_status_pending_p): New function.
(stop_and_resume_callback): Use lwp_status_pending_p.
(linux_nat_filter_event): Use linux_resume_one_lwp.
(linux_nat_wait_1): Always use status_callback to look for an LWP
with a pending status. Use linux_resume_one_lwp.
(resume_stopped_resumed_lwps): Use lwp_status_pending_p and
linux_resume_one_lwp.
2015-01-09 Pedro Alves <palves@redhat.com>
* breakpoint.c (bp_location_inserted_here_p): New function,
factored out from ...
(breakpoint_inserted_here_p): ... here. Use
ALL_BP_LOCATIONS_AT_ADDR.
(software_breakpoint_inserted_here_p): Use
bp_location_inserted_here_p and ALL_BP_LOCATIONS_AT_ADDR.
Linux: Skip thread_db thread event reporting if PTRACE_EVENT_CLONE is supported [A test I wrote stumbled on a libthread_db issue related to thread event breakpoints. See glibc PR17705: [nptl_db: stale thread create/death events if debugger detaches] https://sourceware.org/bugzilla/show_bug.cgi?id=17705 This patch avoids that whole issue by making GDB stop using thread event breakpoints in the first place, which is good for other reasons as well, anyway.] Before PTRACE_EVENT_CLONE (Linux 2.6), the only way to learn about new threads in the inferior (to attach to them) or to learn about thread exit was to coordinate with the inferior's glibc/runtime, using libthread_db. That works by putting a breakpoint at a magic address which is called when a new thread is spawned, or when a thread is about to exit. When that breakpoint is hit, all threads are stopped, and then GDB coordinates with libthread_db to read data structures out of the inferior to learn about what happened. Then the breakpoint is single-stepped, and then all threads are re-resumed. This isn't very efficient (stops all threads) and is more fragile (inferior's thread list in memory may be corrupt; libthread_db bugs, etc.) than ideal. When the kernel supports PTRACE_EVENT_CLONE (which we already make use of), there's really no need to use libthread_db's event reporting mechanism to learn about new LWPs. And if the kernel supports that, then we learn about LWP exits through regular WIFEXITED wait statuses, so no need for the death event breakpoint either. GDBserver has been likewise skipping the thread_db events for a long while: https://sourceware.org/ml/gdb-patches/2007-10/msg00547.html There's one user-visible difference: we'll no longer print about threads being created and exiting while the program is running, like: [Thread 0x7ffff7dbb700 (LWP 30670) exited] [New Thread 0x7ffff7db3700 (LWP 30671)] [Thread 0x7ffff7dd3700 (LWP 30667) exited] [New Thread 0x7ffff7dab700 (LWP 30672)] [Thread 0x7ffff7db3700 (LWP 30671) exited] [Thread 0x7ffff7dcb700 (LWP 30668) exited] This is exactly the same behavior as when debugging against remote targets / gdbserver. I actually think that's a good thing (and as such have listed this in the local/remote parity wiki page a while ago), as the printing slows down the inferior. It's also a distraction to keep bothering the user about short-lived threads that she won't be able to interact with anyway. Instead, the user (and frontend) will be informed about new threads that currently exist in the program when the program next stops: (gdb) c ... * ctrl-c * [New Thread 0x7ffff7963700 (LWP 7797)] [New Thread 0x7ffff796b700 (LWP 7796)] Program received signal SIGINT, Interrupt. [Switching to Thread 0x7ffff796b700 (LWP 7796)] clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:81 81 testq %rax,%rax (gdb) info threads A couple of tests had assumptions on GDB thread numbers that no longer hold. Tested on x86_64 Fedora 20. gdb/ 2014-01-09 Pedro Alves <palves@redhat.com> Skip enabling event reporting if the kernel supports PTRACE_EVENT_CLONE. * linux-thread-db.c: Include "nat/linux-ptrace.h". (thread_db_use_events): New function. (try_thread_db_load_1): Check thread_db_use_events before enabling event reporting. (update_thread_state): New function. (attach_thread): Use it. Check thread_db_use_events before enabling event reporting. (thread_db_detach): Check thread_db_use_events before disabling event reporting. (find_new_threads_callback): Check thread_db_use_events before enabling event reporting. Update the thread's state if not using libthread_db events. gdb/testsuite/ 2014-01-09 Pedro Alves <palves@redhat.com> * gdb.threads/fork-thread-pending.exp: Switch to the main thread instead of to thread 2. * gdb.threads/signal-command-multiple-signals-pending.c (main): Add barrier around each pthread_create call instead of around all calls. * gdb.threads/signal-command-multiple-signals-pending.exp (test): Set a break on thread_function and have the child threads hit it one at at a time.
2014-12-16 17:12:25 +01:00
2014-01-09 Pedro Alves <palves@redhat.com>
Skip enabling event reporting if the kernel supports
PTRACE_EVENT_CLONE.
* linux-thread-db.c: Include "nat/linux-ptrace.h".
(thread_db_use_events): New function.
(try_thread_db_load_1): Check thread_db_use_events before enabling
event reporting.
(update_thread_state): New function.
(attach_thread): Use it. Check thread_db_use_events before
enabling event reporting.
(thread_db_detach): Check thread_db_use_events before disabling
event reporting.
(find_new_threads_callback): Check thread_db_use_events before
enabling event reporting. Update the thread's state if not using
libthread_db events.
libthread_db: Skip attaching to terminated and joined threads I wrote a test that attaches to a program that constantly spawns short-lived threads, which exposed several issues. This is one of them. On GNU/Linux, attaching to a multi-threaded program sometimes prints out warnings like: ... [New LWP 20700] warning: unable to open /proc file '/proc/-1/status' [New LWP 20850] [New LWP 21019] ... That happens because when a thread exits, and is joined, glibc does: nptl/pthread_join.c: pthread_join () { ... if (__glibc_likely (result == 0)) { /* We mark the thread as terminated and as joined. */ pd->tid = -1; ... /* Free the TCB. */ __free_tcb (pd); } So if we attach or interrupt the program (which does an implicit "info threads") at just the right (or rather, wrong) time, we can find and return threads in the libthread_db/pthreads thread list with kernel thread ID -1. I've filed glibc PR nptl/17707 for this. You'll find more info there. This patch handles this as a special case in GDB. This is actually more than just a cosmetic issue. lin_lwp_attach_lwp will think that this -1 is an LWP we're not attached to yet, and after failing to attach will try to check we were already attached to the process, using a waitpid call, which in this case ends up being "waitpid (-1, ...", which obviously results in GDB potentially discarding an event when it shouldn't... Tested on x86_64 Fedora 20, native and gdbserver. gdb/gdbserver/ 2015-01-09 Pedro Alves <palves@redhat.com> * thread-db.c (find_new_threads_callback): Ignore thread if the kernel thread ID is -1. gdb/ 2015-01-09 Pedro Alves <palves@redhat.com> * linux-nat.c (lin_lwp_attach_lwp): Assert that the lwp id we're about to wait for is > 0. * linux-thread-db.c (find_new_threads_callback): Ignore thread if the kernel thread ID is -1.
2014-12-16 17:12:24 +01:00
2015-01-09 Pedro Alves <palves@redhat.com>
* linux-nat.c (lin_lwp_attach_lwp): Assert that the lwp id we're
about to wait for is > 0.
* linux-thread-db.c (find_new_threads_callback): Ignore thread if
the kernel thread ID is -1.
Linux: on attach, attach to lwps listed under /proc/$pid/task/ ... instead of relying on libthread_db. I wrote a test that attaches to a program that constantly spawns short-lived threads, which exposed several issues. This is one of them. On Linux, we need to attach to all threads of a process (thread group) individually. We currently rely on libthread_db to list the threads, but that is problematic, because libthread_db relies on reading data structures out of the inferior (which may well be corrupted). If threads are being created or exiting just while we try to attach, we may trip on inconsistencies in the inferior's thread list. To work around that, when we see a seemingly corrupt list, we currently retry a few times: static void thread_db_find_new_threads_2 (ptid_t ptid, int until_no_new) { ... if (until_no_new) { /* Require 4 successive iterations which do not find any new threads. The 4 is a heuristic: there is an inherent race here, and I have seen that 2 iterations in a row are not always sufficient to "capture" all threads. */ ... That heuristic may well fail, and when it does, we end up with threads in the program that aren't under GDB's control. That's obviously bad and results in quite mistifying failures, like e.g., the process dying for seeminly no reason when a thread that wasn't attached trips on a breakpoint. There's really no reason to rely on libthread_db for this nowadays when we have /proc mounted. In that case, which is the usual case, we can list the LWPs from /proc/PID/task/. In fact, GDBserver is already doing this. The patch factors out that code that knows to walk the task/ directory out of GDBserver, and makes GDB use it too. Like GDBserver, the patch makes GDB attach to LWPs and _not_ wait for them to stop immediately. Instead, we just tag the LWP as having an expected stop. Because we can only set the ptrace options when the thread stops, we need a new flag in the lwp structure to keep track of whether we've already set the ptrace options, just like in GDBserver. Note that nothing issues any ptrace command to the threads between the PTRACE_ATTACH and the stop, so this is safe (unlike one scenario described in gdbserver's linux-low.c). When we attach to a program that has threads exiting while we attach, it's easy to race with a thread just exiting as we try to attach to it, like: #1 - get current list of threads #2 - attach to each listed thread #3 - ooops, attach failed, thread is already gone As this is pretty normal, we shouldn't be issuing a scary warning in step #3. When #3 happens, PTRACE_ATTACH usually fails with ESRCH, but sometimes we'll see EPERM as well. That happens when the kernel still has the thread in its task list, but the thread is marked as dead. Unfortunately, EPERM is ambiguous and we'll get it also on other scenarios where the thread isn't dead, and in those cases, it's useful to get a warning. To distiguish the cases, when we get an EPERM failure, we open /proc/PID/status, and check the thread's state -- if the /proc file no longer exists, or the state is "Z (Zombie)" or "X (Dead)", we ignore the EPERM error silently; otherwise, we'll warn. Unfortunately, there seems to be a kernel race here. Sometimes I get EPERM, and then the /proc state still indicates "R (Running)"... If we wait a bit and retry, we do end up seeing X or Z state, or get an ESRCH. I thought of making GDB retry the attach a few times, but even with a 500ms wait and 4 retries, I still see the warning sometimes. I haven't been able to identify the kernel path that causes this yet, but in any case, it looks like a kernel bug to me. As this just results failure to suppress a warning that we've been printing since about forever anyway, I'm just making the test cope with it, and issue an XFAIL. gdb/gdbserver/ 2015-01-09 Pedro Alves <palves@redhat.com> * linux-low.c (linux_attach_fail_reason_string): Move to nat/linux-ptrace.c, and rename. (linux_attach_lwp): Update comment. (attach_proc_task_lwp_callback): New function. (linux_attach): Adjust to rename and use linux_proc_attach_tgid_threads. (linux_attach_fail_reason_string): Delete declaration. gdb/ 2015-01-09 Pedro Alves <palves@redhat.com> * linux-nat.c (attach_proc_task_lwp_callback): New function. (linux_nat_attach): Use linux_proc_attach_tgid_threads. (wait_lwp, linux_nat_filter_event): If not set yet, set the lwp's ptrace option flags. * linux-nat.h (struct lwp_info) <must_set_ptrace_flags>: New field. * nat/linux-procfs.c: Include <dirent.h>. (linux_proc_get_int): New parameter "warn". Handle it. (linux_proc_get_tgid): Adjust. (linux_proc_get_tracerpid): Rename to ... (linux_proc_get_tracerpid_nowarn): ... this. (linux_proc_pid_get_state): New function, factored out from (linux_proc_pid_has_state): ... this. Add new parameter "warn" and handle it. (linux_proc_pid_is_gone): New function. (linux_proc_pid_is_stopped): Adjust. (linux_proc_pid_is_zombie_maybe_warn) (linux_proc_pid_is_zombie_nowarn): New functions. (linux_proc_pid_is_zombie): Use linux_proc_pid_is_zombie_maybe_warn. (linux_proc_attach_tgid_threads): New function. * nat/linux-procfs.h (linux_proc_get_tgid): Update comment. (linux_proc_get_tracerpid): Rename to ... (linux_proc_get_tracerpid_nowarn): ... this, and update comment. (linux_proc_pid_is_gone): New declaration. (linux_proc_pid_is_zombie): Update comment. (linux_proc_pid_is_zombie_nowarn): New declaration. (linux_proc_attach_lwp_func): New typedef. (linux_proc_attach_tgid_threads): New declaration. * nat/linux-ptrace.c (linux_ptrace_attach_fail_reason): Adjust to use nowarn functions. (linux_ptrace_attach_fail_reason_string): Move here from gdbserver/linux-low.c and rename. (ptrace_supports_feature): If the current ptrace options are not known yet, check them now, instead of asserting. * nat/linux-ptrace.h (linux_ptrace_attach_fail_reason_string): Declare.
2014-12-16 17:12:24 +01:00
2015-01-09 Pedro Alves <palves@redhat.com>
* linux-nat.c (attach_proc_task_lwp_callback): New function.
(linux_nat_attach): Use linux_proc_attach_tgid_threads.
(wait_lwp, linux_nat_filter_event): If not set yet, set the lwp's
ptrace option flags.
* linux-nat.h (struct lwp_info) <must_set_ptrace_flags>: New
field.
* nat/linux-procfs.c: Include <dirent.h>.
(linux_proc_get_int): New parameter "warn". Handle it.
(linux_proc_get_tgid): Adjust.
(linux_proc_get_tracerpid): Rename to ...
(linux_proc_get_tracerpid_nowarn): ... this.
(linux_proc_pid_get_state): New function, factored out from
(linux_proc_pid_has_state): ... this. Add new parameter "warn"
and handle it.
(linux_proc_pid_is_gone): New function.
(linux_proc_pid_is_stopped): Adjust.
(linux_proc_pid_is_zombie_maybe_warn)
(linux_proc_pid_is_zombie_nowarn): New functions.
(linux_proc_pid_is_zombie): Use
linux_proc_pid_is_zombie_maybe_warn.
(linux_proc_attach_tgid_threads): New function.
* nat/linux-procfs.h (linux_proc_get_tgid): Update comment.
(linux_proc_get_tracerpid): Rename to ...
(linux_proc_get_tracerpid_nowarn): ... this, and update comment.
(linux_proc_pid_is_gone): New declaration.
(linux_proc_pid_is_zombie): Update comment.
(linux_proc_pid_is_zombie_nowarn): New declaration.
(linux_proc_attach_lwp_func): New typedef.
(linux_proc_attach_tgid_threads): New declaration.
* nat/linux-ptrace.c (linux_ptrace_attach_fail_reason): Adjust to
use nowarn functions.
(linux_ptrace_attach_fail_reason_string): Move here from
gdbserver/linux-low.c and rename.
(ptrace_supports_feature): If the current ptrace options are not
known yet, check them now, instead of asserting.
* nat/linux-ptrace.h (linux_ptrace_attach_fail_reason_string):
Declare.
2015-01-09 Pedro Alves <palves@redhat.com>
* linux-thread-db.c (thread_db_find_new_threads_silently)
(try_thread_db_load_1, try_thread_db_load, thread_db_load_search)
(find_new_threads_once): Print debug output on gdb_stdlog.
2015-01-09 Chen Gang <gang.chen.5i5j@gmail.com>
Pedro Alves <palves@redhat.com>
* compile/compile.c: Include "gdb_wait.h".
(do_rmdir): Check return value, and free 'zap'.
2014-12-28 09:12:53 +01:00
2015-01-08 Pedro Alves <palves@redhat.com>
Yao Qi <yao@codesourcery.com>
* dwarf2loc.c (indirect_pieced_value): Don't call
gdb_sign_extend. Call extract_signed_integer instead.
* utils.c (gdb_sign_extend): Remove.
* utils.h (gdb_sign_extend): Remove declaration.
2015-01-07 Pierre Muller <muller@sourceware.org>
PR symtab/17811
* stabsread.c (define_symbol): Set language for C++ special symbols.
2015-01-07 Patrick Palka <patrick@parcs.ath.cx>
* inflow.c (initial_gdb_ttystate): Tweak comment.
2015-01-07 Joel Brobecker <brobecker@adacore.com>
* inflow.c (set_initial_gdb_ttystate): Add empty line after
comment documenting function.
Don't propagate our current terminal state to the inferior Currently when we start an inferior we have the inferior inherit our terminal state. Under TUI, our terminal is highly modified by ncurses and readline. So when starting an inferior under TUI, the inferior will have a highly modified terminal state which will interfere with standard I/O. For example, $ gdb gdb (gdb) break main (gdb) run (gdb) print puts ("a\nb") a b $1 = 4 (gdb) [enter TUI mode] (gdb) run (gdb) [exit TUI mode] (gdb) print puts ("a\nb") a b $2 = 4 (gdb) print puts ("a\r\nb\r") a b $3 = 6 As you can see, when we start the inferior under the regular interface, puts() prints the text properly. But when we start the inferior under TUI, puts() does not print the text properly. This is because when we start the inferior under TUI it inherits our current terminal state which has been modified by ncurses to, among other things, require an explicit \r\n to print a new line. As a result the inferior performs standard I/O in an unexpected way. Because of this discrepancy, it doesn't seem like a good idea to have the inferior inherit our _current_ terminal state for it may have been modified by readline and/or ncurses. Instead, we should have the inferior inherit a pristine snapshot of our terminal state taken before readline or ncurses have had a chance to alter it. This enables the inferior to run in a more accurate way, more closely mimicking the program's behavior had it run standalone. And it fixes the above mentioned issue. Tested on x86_64-unknown-linux-gnu. gdb/ChangeLog: * terminal.h (set_initial_gdb_ttystate): Declare. * inflow.c (initial_gdb_ttystate): New static variable. (set_initial_gdb_ttystate): New setter. (child_terminal_init_with_pgrp): Copy initial_gdb_ttystate instead of our current terminal state. * top.c (gdb_init): Call set_initial_gdb_ttystate.
2014-11-22 20:12:49 +01:00
2015-01-07 Patrick Palka <patrick@parcs.ath.cx>
* terminal.h (set_initial_gdb_ttystate): Declare.
* inflow.c (initial_gdb_ttystate): New static variable.
(set_initial_gdb_ttystate): New setter.
(child_terminal_init_with_pgrp): Copy initial_gdb_ttystate
instead of our current terminal state.
* top.c (gdb_init): Call set_initial_gdb_ttystate.
2015-01-07 Joel Brobecker <brobecker@adacore.com>
* guile/scm-type.c (tyscm_array_1): Add comment.
* python/py-type.c (typy_array_1): Add comment.
2015-01-06 Joel Brobecker <brobecker@adacore.com>
* guile/scm-type.c (tyscm_array_1): Do not raise out-of-range
error if N2 is equal to N1 - 1.
2015-01-06 Joel Brobecker <brobecker@adacore.com>
* python/py-type.c (typy_array_1): Do not raise negative-length
exception if N2 is equal to N1 - 1.
2015-01-03 Doug Evans <xdje42@gmail.com>
* c-exp.y: Whitespace cleanup.
(classify_inner_name): Remove extra ;.
2015-01-02 Maciej W. Rozycki <macro@codesourcery.com>
* mips-tdep.c (mips32_scan_prologue): Keep the extracted stack
offset signed.
2015-01-02 Doug Evans <dje@google.com>
* dwarf2read.c (setup_type_unit_groups): Remove outdated comment.
2015-01-02 Doug Evans <dje@google.com>
* symtab.h (struct symbol): Fix typo in comment.
2015-01-01 Joel Brobecker <brobecker@adacore.com>
Update year range in copyright notice of all files.
2015-01-01 Joel Brobecker <brobecker@adacore.com>
* top.c (print_gdb_version): Update copyright year to 2015.
2015-01-01 Joel Brobecker <brobecker@adacore.com>
* config/djgpp/fnchange.lst: Add entry for gdb/ChangeLog-2014.
For older changes see ChangeLog-2014.
Local Variables:
mode: change-log
left-margin: 8
fill-column: 74
version-control: never
2007-08-10 00:44:38 +02:00
coding: utf-8
End: