aboutsummaryrefslogtreecommitdiff
path: root/gdb
AgeCommit message (Collapse)AuthorFilesLines
2015-10-29gdbserver/mem-break.c: Add castPedro Alves2-1/+5
... for C++. Fixes: gdb/gdbserver/mem-break.c:204:28: error: invalid conversion from 'int' to 'bkpt_type' [-fpermissive] gdb/gdbserver/ChangeLog: 2015-10-29 Pedro Alves <palves@redhat.com> * mem-break.c (Z_packet_to_bkpt_type): Add cast.
2015-10-29gdbserver/tracepoint: Add casts out of tpoint->handlePedro Alves2-2/+16
... as needed for C++. tpoint->handle is a generic 'void *' handle. gdb/gdbserver/ChangeLog: 2015-10-29 Pedro Alves <palves@redhat.com> * tracepoint.c (clear_installed_tracepoints): Add casts.
2015-10-29gdbserver: enum gdb_signal castsPedro Alves2-6/+11
This is code parsing RSP signal numbers, checking whether the numbers are indeed valid/known GDB signals, and then converting to host signal numbers. I considered adding temporary enum gdb_signal variables instead, but didn't really like the result. gdb/gdbserver/ChangeLog: 2015-10-29 Pedro Alves <palves@redhat.com> * server.c (handle_v_cont, process_serial_event): Add enum gdb_signal casts to signal parsing code.
2015-10-29gdbserver: btrace enumsPedro Alves4-5/+24
Fixes: ../../../src/gdb/gdbserver/linux-low.c: In function ‘int linux_low_read_btrace(btrace_target_info*, buffer*, int)’: ../../../src/gdb/gdbserver/linux-low.c:6827:48: error: invalid conversion from ‘int’ to ‘btrace_read_type’ [-fpermissive] err = linux_read_btrace (&btrace, tinfo, type); ^ In file included from ../../../src/gdb/gdbserver/linux-low.c:98:0: ../../../src/gdb/gdbserver/../nat/linux-btrace.h:116:26: error: initializing argument 3 of ‘btrace_error linux_read_btrace(btrace_data*, btrace_target_info*, btrace_read_type)’ [-fpermissive] extern enum btrace_error linux_read_btrace (struct btrace_data *btrace, ^ The cyclic dependency the comment talks about is no longer relevant: https://sourceware.org/ml/gdb-patches/2015-10/msg00643.html gdb/gdbserver/ChangeLog: 2015-10-29 Pedro Alves <palves@redhat.com> * linux-low.c (linux_low_read_btrace): Change type of 'type' parameter. * server.c (handle_qxfer_btrace): Change type of 'type' local. * target.h (struct target_ops) <read_btrace>: Change type of 'type' parameter. Update comment.
2015-10-29gdbserver/Linux: Introduce NULL_REGSETPedro Alves16-14/+37
Fixes errors like: src/gdb/gdbserver/linux-x86-low.c:477:1: error: invalid conversion from 'int' to 'regset_type' [-fpermissive] gdb/gdbserver/ChangeLog: 2015-10-29 Pedro Alves <palves@redhat.com> * linux-low.h (NULL_REGSET): Define. * linux-aarch64-low.c (aarch64_regsets): Use NULL_REGSET. * linux-arm-low.c (arm_regsets): Likewise. * linux-crisv32-low.c (cris_regsets): Likewise. * linux-m68k-low.c (m68k_regsets): Likewise. * linux-mips-low.c (mips_regsets): Likewise. * linux-nios2-low.c (nios2_regsets): Likewise. * linux-ppc-low.c (ppc_regsets): Likewise. * linux-s390-low.c (s390_regsets): Likewise. * linux-sh-low.c (sh_regsets): Likewise. * linux-sparc-low.c (sparc_regsets): Likewise. * linux-tic6x-low.c (tic6x_regsets): Likewise. * linux-tile-low.c (tile_regsets): Likewise. * linux-x86-low.c (x86_regsets): Likewise. * linux-xtensa-low.c (xtensa_regsets): Likewise.
2015-10-29Add cast to exception_nonePedro Alves2-1/+5
Fixes, in C++ mode: ../../src/gdb/common/common-exceptions.c:23:69: error: invalid conversion from ‘int’ to ‘return_reason’ [-fpermissive] const struct gdb_exception exception_none = { 0, GDB_NO_ERROR, NULL }; ^ (I considered adding an enum value for '0', but the code and comments around return_reason and its uses explain how 0 is special/internal, so I'm leaving it be.) gdb/ChangeLog: 2015-10-29 Pedro Alves <palves@redhat.com> * common/common-exceptions.c (exception_none): Add cast.
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.