aboutsummaryrefslogtreecommitdiff
path: root/gdb
AgeCommit message (Collapse)AuthorFilesLines
2015-10-29compile: Rename struct type_map_instance::gcc_type fieldPedro Alves2-4/+10
Fixes: src/gdb/compile/compile-c-types.c:36:12: error: declaration of ‘gcc_type type_map_instance::gcc_type’ [-fpermissive] gcc_type gcc_type; ^ In file included from src/gdb/../include/gcc-c-interface.h:23:0, from src/gdb/compile/compile-internal.h:21, from src/gdb/compile/compile-c-types.c:23: src/gdb/../include/gcc-interface.h:32:28: error: changes meaning of ‘gcc_type’ from ‘typedef long long unsigned int gcc_type’ [-fpermissive] typedef unsigned long long gcc_type; ^ src/gdb/compile/compile-c-types.c: In function ‘gcc_type convert_qualified(compile_c_instance*, type*)’: src/gdb/compile/compile-c-types.c:310:19: error: invalid conversion from ‘int’ to ‘gcc_qualifiers’ [-fpermissive] quals); ^ gdb/ChangeLog: 2015-10-29 Pedro Alves <palves@redhat.com> * compile/compile-c-types.c (struct type_map_instance) <gcc_type>: Rename to gcc_type_handle. (insert_type, convert_type): Adjust.
2015-10-29Don't assume break/continue inside a TRY block worksPedro Alves6-194/+261
In C++, this: try { break; } catch (..) {} is invalid. However, because our TRY/CATCH macros support it in C, the C++ version of those macros support it too. To catch such assumptions, this adds a (disabled) hack that maps TRY/CATCH to raw C++ try/catch. Then it goes through all instances that building on x86_64 GNU/Linux trips on, fixing them. This isn't strictly necessary yet, but I think it's nicer to try to keep the tree in a state where it's easier to eliminate the TRY/CATCH macros. gdb/ChangeLog: 2015-10-29 Pedro Alves <palves@redhat.com> * dwarf2-frame-tailcall.c (dwarf2_tailcall_sniffer_first): Don't assume that "break" breaks out of a TRY/CATCH. * python/py-framefilter.c (py_print_single_arg): Don't assume "continue" breaks out of a TRY/CATCH. * python/py-value.c (valpy_binop_throw): New function, factored out from ... (valpy_binop): ... this. (valpy_richcompare_throw): New function, factored out from ... (valpy_richcompare): ... this. * solib.c (solib_read_symbols): Don't assume "break" breaks out of a TRY/CATCH. * common/common-exceptions.h [USE_RAW_CXX_TRY] <TRY/CATCH/END_CATCH>: Define as 1-1 wrappers around try/catch.
2015-10-28Move encoded as 'or' in binutils.Simon Dardis2-4/+11
A patch (http://sourceware.org/ml/binutils/2015-07/msg00376.html) submitted to binutils will be encoding move as an 'or' instruction over [d]addu in assembly and various code stubs. This patch for gdb addresses that change for the mips specific parts of gdb. gdb/ChangeLog: * mips-linux-tdep.c (mips_linux_in_dynsym_stub): Recognise 'or' as move along with [d]addu.
2015-10-28Pass noaliases_p to aarch64_decode_insnYao Qi2-2/+7
Nowadays aarch64_decode_insn is a public interface used by both opcodes and gdb. However, its behaviour relies on a global variable no_aliases, which isn't a good practise. On the other hand, In default, no_aliases is zero, but in GDB, we do want no alias when decoding instructions for prologue analysis (patches to be posted), so that we can handle both instructions "add" and "mov" (an alias of "add") as "add". The code in GDB can be simplified. This patch adds a new argument in aarch64_decode_insn, and pass no_aliases to it. In GDB side, always pass 1 to it. include/opcode: 2015-10-28 Yao Qi <yao.qi@linaro.org> * aarch64.h (aarch64_decode_insn): Update declaration. opcodes: 2015-10-28 Yao Qi <yao.qi@linaro.org> * aarch64-dis.c (aarch64_decode_insn): Add one argument noaliases_p. Update comments. Pass noaliases_p rather than no_aliases to aarch64_opcode_decode. (print_insn_aarch64_word): Pass no_aliases to aarch64_decode_insn. gdb: 2015-10-28 Yao Qi <yao.qi@linaro.org> * aarch64-tdep.c (aarch64_software_single_step): Pass 1 to aarch64_decode_insn.
2015-10-27Make host_address_to_string/gdb_print_host_address cast parameter to 'void *'Pedro Alves5-4/+23
Fixes a set of errors like: ../../src/gdb/symfile-debug.c: In function ‘int debug_qf_map_symtabs_matching_filename(objfile*, const char*, const char*, int (*)(symtab*, void*), void*)’: ../../src/gdb/symfile-debug.c:137:39: error: invalid conversion from ‘int (*)(symtab*, void*)’ to ‘const void*’ [-fpermissive] host_address_to_string (callback), ^ Note this has to work with data and function pointers. In C++11 we may perhaps do something a bit safer, but we're not there yet, and I don't think it really matters. For now just always do a simple C-style cast in host_address_to_string itself. No point in adding a void * cast to each and every caller. gdb/ChangeLog: 2015-10-27 Pedro Alves <palves@redhat.com> * common/print-utils.c (host_address_to_string): Rename to ... (host_address_to_string_1): ... this. * common/print-utils.h (host_address_to_string): Reimplement as wrapper around host_address_to_string_1. * utils.c (gdb_print_host_address): Rename to ... (gdb_print_host_address_1): ... this. * utils.h (gdb_print_host_address): Reimplement as wrapper macro around host_address_to_string_1.
2015-10-27target_read_memory&co: no longer return target_xfer_statusPedro Alves8-49/+72
Years ago, these functions used to return errno/EIO. Later, through a series of changes that intended to remove native/remote differences, they ended up returning a target_xfer_status in disguise. Unlike target_xfer_partial&co, the point of target_read_memory&co is to either fully succeed or fail. On error, they always return TARGET_XFER_E_IO. So there's no real point in casting the return of target_read_memory to a target_xfer_status to pass it to memory_error. Instead, it results in clearer code to simply decouple target_read_memory&co's return from target_xfer_status. This fixes build errors like this in C++ mode: ../../src/gdb/corefile.c: In function ‘void read_stack(CORE_ADDR, gdb_byte*, ssize_t)’: ../../src/gdb/corefile.c:276:34: error: invalid conversion from ‘int’ to ‘target_xfer_status’ [-fpermissive] memory_error (status, memaddr); ^ ../../src/gdb/corefile.c:216:1: error: initializing argument 1 of ‘void memory_error(target_xfer_status, CORE_ADDR)’ [-fpermissive] gdb/ChangeLog: 2015-10-27 Pedro Alves <palves@redhat.com> * alpha-tdep.c (alpha_read_insn): Always pass TARGET_XFER_E_IO to memory_error. Rename local 'status' to 'res'. * c-lang.c (c_get_string): Always pass TARGET_XFER_E_IO to memory_error. * corefile.c (read_stack, read_code, write_memory): Always pass TARGET_XFER_E_IO to memory_error. * disasm.c (dis_asm_memory_error): Always pass TARGET_XFER_E_IO to memory_error. Rename parameter 'status' to 'err'. (dump_insns): Rename local 'status' to 'err'. * mips-tdep.c (mips_fetch_instruction): Rename parameter 'statusp' to 'errp'. Rename local 'status' to 'err'. Always pass TARGET_XFER_E_IO to memory_error. (mips_breakpoint_from_pc): Rename local 'status' to 'err'. * target.c (target_read_memory, target_read_raw_memory) (target_read_stack, target_read_code, target_write_memory) (target_write_raw_memory): Return -1 on error instead of TARGET_XFER_E_IO. * valprint.c (val_print_string): Rename local 'errcode' to 'err'. Always pass TARGET_XFER_E_IO to memory_error. Update comment.
2015-10-27guile: Change return value of gdbscm_with_guile for const char *Simon Marchi4-13/+31
The documentation of gdbscm_with_guile says that it returns a statically allocated string (IOW, a const char *). We can reflect that in its return value type, and get rid of C++ build errors. Initially fixes: /home/simark/src/binutils-gdb/gdb/guile/scm-disasm.c: In function ‘void* gdbscm_disasm_read_memory_worker(void*)’: /home/simark/src/binutils-gdb/gdb/guile/scm-disasm.c:93:12: error: invalid conversion from ‘const void*’ to ‘void*’ [-fpermissive] return "seek error"; gdb/ChangeLog: * guile/guile-internal.h (gdbscm_with_guile): Change return types to const char *. * guile/scm-safe-call.c (gdbscm_with_guile): Likewise. (struct c_data) <func>: Likewise. (struct c_data) <result>: Change type to const char *. (scscm_eval_scheme_string): Change return type to const char *. (scscm_source_scheme_script): Likewise. (gdbscm_safe_eval_string): Change type of result variable to const char * and remove cast. (gdbscm_safe_source_script): Likewise. * guile/scm-disasm.c (gdbscm_disasm_read_memory_worker): Change return type to const char *. (gdbscm_disasm_read_memory): Change type of status to const char *.
2015-10-27source.c:openp: save/restore errnoPedro Alves2-0/+12
openp's return is documented as: ~~~ If a file is found, return the descriptor. Otherwise, return -1, with errno set for the last name we tried to open. */ ~~~ By inspection, I noticed that there are function calls after the ones that first set errno, and those may clobber errno. It's safer to save errno when see an open fail, and restore it on exit. Tested on x86_64 Fedora 20. gdb/ChangeLog: 2015-10-27 Pedro Alves <palves@redhat.com> * source.c (openp): New local 'last_errno'. Use it to save/restore errno.
2015-10-27psymtab.c: Add castsPedro Alves2-2/+7
... as needed for C++. gdb/ChangeLog: 2015-10-27 Pedro Alves <palves@redhat.com> * psymtab.c (dump_psymtab_addrmap_1): Add casts.
2015-10-27ctf.c: Fix int/enum implicit castSimon Marchi2-2/+14
This patch was taken directly from Pedro's branch. Right now, SET_INT32_FIELD is used to set enum fields. This works in C, but not C++. Therefore, define the new SET_ENUM_FIELD, which casts the value to the right enum type. gdb/ChangeLog: * ctf.c (SET_ENUM_FIELD): New macro. (ctf_read_status): Use it. (ctf_read_tp): Use it.
2015-10-27Add scm_t_dynwind_flags castsSimon Marchi5-5/+13
There is a handful of calls to scm_dynwind_begin (0); where the parameter is an enum, scm_t_dynwind_flags. In C++, we have no choice but to add an explicit cast, since there is no enum value that represents 0 (no flags set). gdb/ChangeLog: * guile/scm-breakpoint.c (gdbscm_set_breakpoint_stop_x): Add scm_t_dynwind_flags casts. * guile/scm-cmd.c (gdbscm_parse_command_name): Likewise. * guile/scm-ports.c (gdbscm_open_memory): Likewise. * guile/scm-value.c (gdbscm_value_to_string): Likewise.
2015-10-27Introduce ax_raw_byte and use itSimon Marchi4-3/+20
This patch was taken directly from Pedro's branch. ax_simple is used to append an agent expression operator to an agent expression string. Therefore, it takes an enum agent_op as input. There is an instance where it's called to append a raw byte, unrelated to the enum. It makes the build fail in C++ mode. This patch introduces ax_raw_byte for that purpose and uses it. gdb/ChangeLog: * ax.h (ax_raw_byte): New declaration. * ax-general.c (ax_raw_byte): New function. (ax_simple): Use ax_raw_byte. * ax-gdb.c (gen_printf): Likewise.
2015-10-27ada-lang.h: Add cast in GROW_VECTSimon Marchi2-1/+5
The assignment requires a cast in C++. We only use this macro for vectors of chars, so adding (char *) diretly will do for now. gdb/ChangeLog: * ada-lang.h (GROW_VECT): Add cast.
2015-10-27Fix access_to_packed_array.exp typos/errorsJan Kratochvil2-4/+8
Running ./gdb.ada/access_to_packed_array.exp ... ERROR: tcl error sourcing ./gdb.ada/access_to_packed_array.exp. ERROR: extra characters after close-quote while executing "gdb_test "print pack.a" "\\(0 => 1, 2, 3, 4, 5, 6, 7, 8, 9, 10\\)")" (file "./gdb.ada/access_to_packed_array.exp" line 29) invoked from within "source ./gdb.ada/access_to_packed_array.exp" ("uplevel" body line 1) invoked from within "uplevel #0 source ./gdb.ada/access_to_packed_array.exp" invoked from within "catch "uplevel #0 source $test_file_name"" Unrelated to the typos I have changed the print expectations s/"x"/" = x"/ as for example expectation "3" should not match " = 43". 2015-10-27 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.ada/access_to_packed_array.exp: Fix typos erroring the testfile.
2015-10-26symtab.h (struct general_symbol_info> <ada_mangled>: Update comment.Doug Evans2-1/+5
gdb/ChangeLog: * symtab.h (struct general_symbol_info> <ada_mangled>: Update comment.
2015-10-26target.c: Add a cast and change a typeSimon Marchi2-4/+10
Fixes some errors in C++ build. gdb/ChangeLog: * target.c (memory_xfer_partial): Change type of buf to gdb_byte pointer. (simple_search_memory): Cast return of memmem.
2015-10-26stap-probe.c: Add castsSimon Marchi2-4/+10
gdb/ChangeLog: * stap-probe.c (handle_stap_probe): Add (const char *) casts.
2015-10-26ctf_xfer_partial: Return TARGET_XFER_E_IO instead of -1 on errorSimon Marchi2-1/+6
Use the enum value instead of the corresponding int value. gdb/ChangeLog: * ctf.c (ctf_xfer_partial): Return TARGET_XFER_E_IO instead of -1 on error.
2015-10-26PR symtab/17391 gdb internal error: assertion fails in regcache.c:178Doug Evans31-191/+411
gdb/ChangeLog: * dwarf2-frame.c (dwarf2_restore_rule): Call dwarf_reg_to_regnum instead of gdbarch_dwarf2_reg_to_regnum. (dwarf2_frame_cache): Ditto. (read_addr_from_reg): Call dwarf_reg_to_regnum_or_error instead of gdbarch_dwarf2_reg_to_regnum. (get_reg_value): Ditto. (dwarf2_fetch_cfa_info): Ditto. (dwarf2_frame_prev_register): Ditto. * dwarf2loc.c: #include "complaints.h". (dwarf_expr_read_addr_from_reg): Call dwarf_reg_to_regnum_or_error instead of gdbarch_dwarf2_reg_to_regnum. (dwarf_expr_get_reg_value): Ditto. (read_pieced_value): Ditto. (write_pieced_value): Ditto. (dwarf2_evaluate_loc_desc_full): Ditto. (dwarf_reg_to_regnum): New function. (throw_bad_regnum_error): New function. (dwarf_reg_to_regnum_or_error): Renamed from dwarf2_reg_to_regnum_or_errorChange to take a ULONGEST regnum. All callers updated. Call throw_bad_regnum_error. (locexpr_regname): Improve text of bad register number. * dwarf2loc.h (dwarf_reg_to_regnum): Declare. (dwarf_reg_to_regnum_or_error): Update prototype. * dwarf2expr.c: #include "dwarf2loc.h". (dwarf_block_to_sp_offset): Call dwarf_reg_to_regnum instead of gdbarch_dwarf2_reg_to_regnum. * gdbarch.sh (dwarf2_reg_to_regnum): Add comment. * gdbarch.h: Regenerate. * amd64-tdep.c (amd64_dwarf_reg_to_regnum): Remove warning for bad register. * avr-tdep.c (avr_dwarf_reg_to_regnum): Ditto. * cris-tdep.c (cris_dwarf2_reg_to_regnum): Ditto. * bfin-tdep.c (bfin_reg_to_regnum): Fix error checking. * hppa-linux-tdep.c (hppa_dwarf_reg_to_regnum): Improve error checking. Remove warning for bad register. * hppa-tdep.c (hppa64_dwarf_reg_to_regnum): Ditto. * i386-tdep.c (i386_svr4_dwarf_reg_to_regnum): Renamed from i386_svr4_reg_to_regnum. Return -1 for bad registers. (i386_svr4_reg_to_regnum): New function. (i386_gdbarch_init): Update call to set_gdbarch_dwarf2_reg_to_regnum. * microblaze-tdep.c (microblaze_dwarf2_reg_to_regnum): Don't assert on bad registers, return -1. * msp430-tdep.c (msp430_dwarf2_reg_to_regnum): Improve error checking. Remove warning for bad register. * nios2-tdep.c: Add static assert for NIOS2_NUM_REGS. (nios2_dwarf_reg_to_regnum): Fix off-by-one error. Remove warning for bad register. Return -1 for bad register. * rl78-tdep.c (rl78_dwarf_reg_to_regnum): Don't flag an internal error for bad register, return -1. * rx-tdep.c (rx_dwarf_reg_to_regnum): Ditto. * m68k-tdep.c (m68k_dwarf_reg_to_regnum): Fix error result. * mep-tdep.c (mep_debug_reg_to_regnum): Ditto. * mips-tdep.c (mips_stab_reg_to_regnum): Ditto. (mips_dwarf_dwarf2_ecoff_reg_to_regnum): Ditto. * mn10300-tdep.c (mn10300_dwarf2_reg_to_regnum): Remove warning for bad regs. * xtensa-tdep.c (xtensa_reg_to_regnum): Remove internal error for bad regs. Fix error result. * stabsread.c (stab_reg_to_regnum): Watch for negative regno. (reg_value_complaint): Update complaint text. * mdebugread.c (reg_value_complaint): New function. (mdebug_reg_to_regnum): Rewrite to watch for bad reg numbers. gdb/testsuite/ChangeLog: * lib/dwarf.exp (_location): Add support for DW_OP_regx. * gdb.dwarf2/bad-regnum.c: New file. * gdb.dwarf2/bad-regnum.exp: New file.
2015-10-26PR python/18938: source -s foo.py with foo.py a symlink to foo.notpy failsDoug Evans4-4/+35
gdb/ChangeLog: PR python/18938 * cli/cli-cmds (source_script_fron_sctream): New arg file_to_open. All callers updated. gdb/testsuite/ChangeLog: * gdb.python/python.exp: Add test for symlink from .py file to .notpy file.
2015-10-26Print address map in output of "mt print psymbols"Doug Evans2-2/+98
gdb/ChangeLog: * psymtab.c (struct dump_psymtab_addrmap_data): Define. (dump_psymtab_addrmap_1, dump_psymtab_addrmap): New functions. (maintenance_print_psymbols): Print address map.
2015-10-26Move __SIGRTMIN.Doug Evans4-6/+13
gdb/ChangeLog: * nat/linux-nat.h (__SIGRTMIN): Move here from gdbserver/linux-low.c. gdb/gdbserver/ChangeLog: * linux-low.c (__SIGRTMIN): Move to nat/linux-nat.h.
2015-10-26musl: Move W_STOPCODE to common/gdb_wait.h.Doug Evans4-8/+14
gdb/ChangeLog: * common/gdb_wait.h (W_STOPCODE): Define, moved here from gdbserver/linux-low.c. (WSETSTOP): Simplify. gdb/gdbserver/ChangeLog: * linux-low.c (W_STOPCODE): Moved to common/gdb_wait.h.
2015-10-26Add some casts for building on musl.Doug Evans4-6/+19
gdb/ChangeLog: * linux-thread-db.c (find_new_threads_callback): Cast ti.ti_tid to unsigned long for debug_printf. (thread_db_pid_to_str): Ditto. gdb/gdbserver/ChangeLog: * thread-db.c (find_one_thread): Cast ti.ti_tid to unsigned long for debug_printf. (attach_thread, find_new_threads_callback): Ditto.
2015-10-26guile: Simplify ioscm_make_gdb_stdio_portSimon Marchi2-11/+11
As pointed out by Pedro, it's clearer to do it this way. We can trust that scm_mode_bits won't try to modify our string, even though it takes a non-const char *. gdb/ChangeLog: * guile/scm-ports.c (ioscm_make_gdb_stdio_port): Do not pass a local char array to scm_mode_bits, use a cast instead.
2015-10-26tui: Simplify tui_alloc_contentSimon Marchi2-25/+20
I stumbled upon this while doing some cxx-conversion work. Since the x-family alloc functions throw on failure, it is useless to test their result for failure. The else branch of != NULL is basically dead code. I changed the type of element_block_ptr to struct tui_win_element, which seems obvious (this is actually what raised the flag, casting the result of xmalloc to struct tui_win_element* wouldn't work). gdb/ChangeLog: * tui/tui-data.c (tui_alloc_content): Don't check xmalloc result. Change type of element_block_ptr. Change allocation to use XNEWVEC.
2015-10-26Do not pass NULL for the string in catch_errorsLuis Machado2-1/+6
I caught a segmentation fault while running gdb.reverse/sigall-reverse.exp, in a mingw32 GDB, in this code path. It boils down to the code trying to strlen () a NULL pointer. I tracked things down and it looks like record_full_message_wrapper_safe is the only offender. gdb/ChangeLog: 2015-10-26 Luis Machado <lgustavo@codesourcery.com> * record-full.c (record_full_message_wrapper_safe): Pass empty string to catch_errors call instead of NULL.
2015-10-26Fix constness problem in ioscm_make_gdb_stdio_portSimon Marchi2-4/+16
ioscm_make_gdb_stdio_port passes const char pointers (literal strings) to scm_mode_bits, which takes a non-const char pointer. Ideally, we would change scm_mode_bits to take a const char pointer, but it's not part of an API we control. Instead, it's easy enough to build the string to pass to scm_mode_bits in a (non-const) char array and pass that. gdb/ChangeLog: * guile/scm-ports.c (ioscm_make_gdb_stdio_port): Pass non-const char pointer to scm_mode_bits.
2015-10-26symtab.c: Add castSimon Marchi2-1/+6
gdb/ChangeLog: * symtab.c (default_make_symbol_completion_list_break_on_1): Add cast.
2015-10-26gdbscm_memory_port_write: use local variable to avoid adding castsSimon Marchi2-2/+8
By having a local variable of type (const gdb_byte *), we can avoid adding two casts. gdb/ChangeLog: * guile/scm-ports.c (gdbscm_memory_port_write): Declare new "data" local variable and use it.
2015-10-26scm-symbol.c: Add (domain_enum) castsSimon Marchi2-2/+9
We currently pass integers as domain_enums to lookup_symbol. The most obvious fix is to add casts there. I first thought of changing the type of the domain variables to domain_enum. However, because we pass a pointer to them to gdbscm_parse_function_args, which expects them to be integers (because of the format string), I don't think it would be correct. If the enum does not have the same size as an int, gdbscm_parse_function_args could write past the memory of domain, overwriting something else on the stack. gdb/ChangeLog: * guile/scm-symbol.c (gdbscm_lookup_global_symbol): Add domain_enum cast. (gdbscm_lookup_symbol): Likewise.
2015-10-25Fix compile.exp error message expectationJan Kratochvil2-1/+6
commit cdaec3f3e7ea9118204f0e579bd3257234fbae63 Author: Luis Machado <lgustavo@codesourcery.com> Date: Thu Aug 27 02:00:16 2015 -0300 Mention language in compile error message regressed: -PASS: gdb.compile/compile.exp: compile code globalvar +FAIL: gdb.compile/compile.exp: compile code globalvar Update the expected message. gdb/testsuite/ChangeLog 2015-10-25 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.compile/compile.exp (compile code globalvar): Update expectation for a change by "Mention language in compile error message".
2015-10-25Re-apply change for handling non-local references in nested functions.Iain Buclaw2-3/+6
gdb/ChangeLog: * d-exp.y: Remove an obsolete comment and propagate the block information to the produced expression.
2015-10-24tui-data.c: Remove unnecessary castsSimon Marchi2-2/+8
The (void *) casts make the build fail in C++ mode and are unnecessary. gdb/ChangeLog: * tui/tui-data.c (tui_add_to_source_windows): Remove void * cast. (tui_add_content_elements): Likewise.
2015-10-24cli-setshow.c: Constify variableSimon Marchi2-1/+5
Fixes: /home/simark/src/binutils-gdb/gdb/cli/cli-setshow.c:390:13: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive] p = strchr (arg, ' '); ^ gdb/ChangeLog: * cli/cli-setshow.c (do_set_command): Constify p.
2015-10-24Replace (void *) cast with (gdb_byte *)Simon Marchi2-1/+6
Fixes: /home/simark/src/binutils-gdb/gdb/nat/linux-ptrace.c:207:6: error: invalid conversion from ‘void*’ to ‘gdb_byte* {aka unsigned char*}’ [-fpermissive] pc = (void *) (uintptr_t) l; ^ gdb/ChangeLog: * nat/linux-ptrace.c (linux_ptrace_test_ret_to_nx): Replace (void *) cast with (gdb_byte *).
2015-10-24proc-service.c: Add (gdb_byte *) castSimon Marchi2-1/+5
A cast here is necessary, just as it's necessary in ps_pdwrite just below. The type of buf can't be changed, since it's fixed in the ps_pd* API. gdb/ChangeLog: * proc-service.c (ps_pdread): Add cast.
2015-10-24sparc64-tdep.c: Don't assign using memcpy returnSimon Marchi2-1/+7
This: valbuf = memcpy (buf, valbuf, len); causes a build failure in C++, because memcpy returns the value of "buf" as a void *. Instead of adding a cast, we can just do the assignment separately. gdb/ChangeLog: * sparc64-tdep.c (sparc64_store_arguments): Split assignment of valbuf.
2015-10-24ia64-tdep.c: Remove (void *) castsSimon Marchi2-3/+9
Remove these (void *) casts, which cause a build failure in C++ mode. gdb/ChangeLog: * ia64-tdep.c (ia64_pseudo_register_write): Remove cast. (ia64_push_dummy_call): Remove cast and change type of "to" to array of gdb_byte.
2015-10-23Add mmap casts in linux-btrace.cSimon Marchi2-4/+10
gdb/ChangeLog: * linux-btrace.c (linux_enable_pt): Add cast to mmap return.
2015-10-23Add cast to observer.shSimon Marchi2-1/+5
gdb/ChangeLog: * observer.h (observer_${event}_notification_stub): Add cast.
2015-10-23Remove set_breakpoint_data definition in GDBServer.Antoine Tremblay2-5/+4
This patch removes the now unused set_breakpoint_data function from mem_break.h gdb/gdbserver/ChangeLog: * mem-break.h (set_breakpoint_data): Remove.
2015-10-23Fix nto,spu and win32 builds of GDBServer.Antoine Tremblay4-10/+139
This patch fixes the build that was broken by : https://sourceware.org/ml/gdb-patches/2015-10/msg00369.html It implements the sw_breakpoint_from_kind operation on these targets and removes the calls to set_breakpoint_data. Compiliation tested on win32. Not tested : nto, spu. gdb/gdbserver/ChangeLog: * nto-low.c (nto_sw_breakpoint_from_kind): New function. (struct target_ops) <sw_breakpoint_from_kind>: Initialize. (initialize_low): Remove set_breakpoint_data call. * spu-low.c (spu_sw_breakpoint_from_kind): New function. (struct target_ops) <sw_breakpoint_from_kind>: Iniitalize. (initialize_low): Remove set_breakpoint_data call. * win32-low.c (win32_sw_breakpoint_from_kind): New function. (struct target_ops) <sw_breakpoint_from_kind>: Initialize. (initialize_low): Remove set_breakpoint_data call.
2015-10-23Refactor default_breakpoint_kind_from_pc to be used by all targets in GDBServer.Antoine Tremblay5-14/+31
This patch moves default_breakpoint_kind_from_pc to target.c and creates a macro so that all targets can easily use it. This allows the breakpoint_kind_from_pc operation to be left unimplemented in targets that do not need it. This is preparation to fix the win32/nto/spu build that was broken by this patch: https://sourceware.org/ml/gdb-patches/2015-10/msg00369.html No regression on Ubuntu 14.04 x86-64 with gdbserver-{native-extended} gdb/gdbserver/ChangeLog: * linux-low.c (default_breakpoint_kind_from_pc): Move to target.c. * mem-break.c (set_breakpoint_at): Use target_breakpoint_kind_from_pc. * target.c (default_breakpoint_kind_from_pc): Moved from linux-low.c * target.h (target_breakpoint_kind_from_pc): New macro.
2015-10-23Initialize field insn_count correctlyYao Qi2-0/+6
This patch initialize dsd.insn_count, otherwise, it triggers the assert below on testings we did recently. gdb: 2015-10-23 Yao Qi <yao.qi@linaro.org> * aarch64-tdep.c (aarch64_displaced_step_copy_insn): Set dsd.insn_count to zero.
2015-10-22garbage collect gdb/infrun.c:stop_after_trapPedro Alves2-22/+8
No longer used anywhere. gdb/ChangeLog: 2015-10-22 Pedro Alves <palves@redhat.com> * infrun.c (stop_after_trap): Delete. (clear_proceed_status, handle_signal_stop, struct infcall_control_state, save_infcall_control_state) (restore_infcall_control_state): Remove references to stop_after_trap.
2015-10-22Fix inconsistent breakpoint kinds between breakpoints and tracepoints in ↵Antoine Tremblay2-2/+20
GDBServer. This patch fixes a regression introduced by : https://sourceware.org/ml/gdb-patches/2015-10/msg00369.html Tests : gdb.trace/trace-break.exp and gdb.trace/trace-mt.exp would fail on x86 with gdbserver-{native,extended}. Before this patch, the breakpoint kind set by GDB with a Z packet and the one set in the case of a tracepoint would be inconsistent on targets that did not implement breakpoint_kind_from_pc. On x86 for example a breakpoint set by GDB would have a kind of 1 but a breakpoint set by a tracepoint would have a kind of 0. This created a missmatch when trying to insert a tracepoint and a breakpoint at the same location. One of the two breakpoints would be removed with debug message : "Inconsistent breakpoint kind". This patch fixes the issue by changing the default 0 breakpoint kind to be the size of the breakpoint according to sw_breakpoint_from_kind. The default breakpoint kind must be the breakpoint length to keep consistency between breakpoints set via GDB and the ones set internally by GDBServer. No regression on Ubuntu 14.04 x86-64 with gdbserver-{native-extended} gdb/gdbserver/ChangeLog: * linux-low.c (default_breakpoint_kind_from_pc): New function. (linux_breakpoint_kind_from_pc): Use default_breakpoint_kind_from_pc for the default breakpoint kind.
2015-10-22Add cast in python.cSimon Marchi2-1/+5
gdb/ChangeLog: * python/python.c (_initialize_python): Add cast.
2015-10-22Add cast in nto-tdep.cSimon Marchi2-1/+6
gdb/ChangeLog: * nto-tdep.c (nto_inferior_data): Add cast.
2015-10-22gdb/Windows: use windows_wait/windows_resume directly in initial startupPedro Alves2-10/+17
Explation below based on what Joel wrote at: https://sourceware.org/ml/gdb-patches/2015-10/msg00274.html The merge async/sync code paths patch broke attaching on Windows. This is what we observe, after attaching to any process. At first, it seems like everything worked fine, since the process stops, and we get the prompt back: (gdb) att 3156 Attaching to program `C:\[...]\foo.exe', process 3156 [New Thread 3156.0xcd8] [New Thread 3156.0xfe4] 0x7770000d in ntdll!DbgBreakPoint () from C:\Windows\SysWOW64\ntdll.dll (gdb) However, enter any commands at all, and GDB appears to be hanging. For instance: (gdb) set lang ada [nothing happens] Despite appearances, GDB is not reading from the prompt. It is blocked waiting for an event from the inferior. And since our inferior is stopped, there aren't going to be any events to read. In chronological order, what happens is that windows_attach calls do_initial_windows_stuff, which performs the inferior creation, and repeatedly waits until we get the first SIGTRAP: while (1) { stop_after_trap = 1; wait_for_inferior (); tp = inferior_thread (); if (tp->suspend.stop_signal != GDB_SIGNAL_TRAP) resume (tp->suspend.stop_signal); else break; } The call to wait_for_inferior triggers a call to do_target_wait to get the event, followed by handle_inferior_event to process it. However, because the first couple of events are "spurious" events, GDB resumes the execution, and prepares the inferior to wait again: case TARGET_WAITKIND_SPURIOUS: [...] resume (GDB_SIGNAL_0); prepare_to_wait (ecs); And prepare_to_wait just does... ecs->wait_some_more = 1; if (!target_is_async_p ()) mark_infrun_async_event_handler (); ... which as a result sets the infrun_async_event_handler "ready" flag to 1. We get a couple of spurious events before we get the initial SIGTRAP, at which point we exit the "while (1)" loop above, after which we reach the end of the attach_command, followed by the normal end-of-command processing (normal_stop, bp handling, printing the GDB prompt), back finally to the root of the event loop. Notice that, at this point, nothing has unset the "ready" flag for the infrun_async_event_handler. So, when another cycle of gdb_do_one_event from the event loop, we eventually call check_async_event_handlers, which finds that the infrun async event handler is "ready", and therefore calls it's associated "proc" callback, which does... inferior_event_handler (INF_REG_EVENT, NULL); ... triggering a blocking call to target_wait, thus hanging forever. The fix is to use windows_wait and windows_resume directly, similarly to gdbserver. This will also allow getting rid of 'stop_after_trap'. gdb/ChangeLog: 2015-10-22 Pedro Alves <palves@redhat.com> * windows-nat.c (do_initial_windows_stuff): Rewrite loop using windows_wait and windows_resume directly instead of wait_for_inferior and resume.