The read_frame_register_value function as it was implemented introduced
a regression on big-endian targets. The problem appears when trying to
get the value of an entity stored inside a register, and when the size
of the entity is smaller than the size of the register. In that case,
we were always reading the first N bytes of the register, which is wrong
for big-endian architectures, where we need to read the last N bytes of
the register.
gdb/ChangeLog:
* findvar.c (read_frame_register_value): Read correct bytes from
register on big-endian architectures.
gdb/testsuite/ChangeLog:
* gdb.ada/small_reg_param: New testcase.
When opening the procfs map file, we create a cleanup routine to make
sure that the associated file descriptor gets closed, but we never
call the cleanup. So the FD gets leaked.
gdb/ChangeLog:
* procfs.c (iterate_over_mappings): Call do_cleanups before
returning.
PR c++/13342:
* valops.c (value_full_object): Return early if real type is
smaller than the enclosing type.
gdb/testsuite
* gdb.cp/destrprint.exp: New file.
* gdb.cp/destrprint.cc: New file.
* arm-tdep.c (thumb_analyze_prologue): Always fallback on the SP
register when the frame can't be determined.
* arm-tdep.c (arm_analyze_prologue): Ditto.
gdb/testsuite/
* gdb.arch/thumb-prologue.c (switch_stack_to_same): New test function.
(switch_stack_to_other): New test function.
* gdb.arch/thumb-prologue.exp: New test cases.
Watchpoint support doesn't work anymore when using gdbserver on Windows.
They just never trigger.
The problem comes from the fact that we always set the debug registers
to zero, no matter what. This in turn comes from the fact that we
use i386_low_insert_watchpoint to compute the DR values:
return i386_low_insert_watchpoint (&debug_reg_state,
type, addr, len);
This function saves the new values in debug_reg_state. However,
the values we actually use when setting the DR registers are
taken from two different globals:
static unsigned dr_status_mirror;
static unsigned dr_control_mirror;
These are really never actually changed (their value is set from
the DR values read from the inferior, but since we never change
them, in practice, they never change).
The fix is to use the values provided by debug_reg_state, and
to eliminate the two dr_[...] globals.
gdb/gdbserver/ChangeLog:
* win32-i386-low.c (dr_status_mirror, dr_control_mirror): Delete.
(i386_dr_low_get_control, i386_dr_low_get_status): Use
dr_status_mirror and dr_control_mirror from debug_reg_state.
(i386_dr_low_get_status): Use debug_reg_state.dr_status_mirror
(i386_initial_stuff): Remove use of deleted globals.
(i386_get_thread_context, i386_set_thread_context,
i386_thread_added): Use dr_status_mirror and dr_control_mirror
from debug_reg_state.
2011-11-05 Yao Qi <yao@codesourcery.com>
* tracepoint.c (gdb_collect): Loop over tracepoints of same
address as TPOINT's.
gdb/testsuite:
2011-11-05 Yao Qi <yao@codesourcery.com>
* gdb.trace/trace-break.exp: Add test on setting two
fast tracepoints at the same address.
* gdb.base/skip-solib.exp (executable_main): New variable.
(binfile_main): Base it on that.
Use $executable_main in clean_restart calls. Drop gdb_exit and
gdb_start calls.
Fix racy FAILs.
* lib/mi-support.exp (mi_gdb_test): Replace thread_selected_re and
breakpoint_re globals import by async. Set string_regex to .* for
async. Remove the optional thread_selected_re and breakpoint_re
globals expectations.
PR symtab/13208
* jit.c (jit_register_code): Remove unused variable my_cleanups. Check
for NULL from bfd_open_from_target_memory. Fix ownership of NBFD and
SAI.
gdb/
* linux-nat.c (linux_nat_filter_event): Remove `options'
parameter, and dead code that used it. If we're handling a
PTRACE_EVENT_EXEC event, and the thread group leader is no longer
in our lwp list, re-add it.
(check_zombie_leaders): New.
(linux_nat_wait_1): Remove `options' and `pid' locals. Always
wait for children with WNOHANG, and always wait for all children.
Don't check for no resumed children upfront. Simplify wait loop.
Check for zombie thread group leaders after handling all wait
statuses. Return TARGET_WAITKIND_NO_RESUMED if there no
unwaited-for children left.
* infrun.c (fetch_inferior_event): Handle TARGET_WAITKIND_NO_RESUMED.
(handle_inferior_event): Handle TARGET_WAITKIND_NO_RESUMED.
(normal_stop): Handle TARGET_WAITKIND_NO_RESUMED.
* target.h (enum target_waitkind) <TARGET_WAITKIND_NO_RESUMED>: New.
gdb/testsuite/
* gdb.threads/no-unwaited-for-left.c: New.
* gdb.threads/no-unwaited-for-left.exp: New.
* gdb.threads/non-ldr-exc-1.c: New.
* gdb.threads/non-ldr-exc-1.exp: New.
* gdb.threads/non-ldr-exc-2.c: New.
* gdb.threads/non-ldr-exc-2.exp: New.
* gdb.threads/non-ldr-exc-3.c: New.
* gdb.threads/non-ldr-exc-3.exp: New.
* gdb.threads/non-ldr-exc-4.c: New.
* gdb.threads/non-ldr-exc-4.exp: New.
* gdb.base/async-shell.exp: Skip the testfile for use_gdb_stub.
* gdb.base/attach-pie-misread.exp: Likewise.
* gdb.base/break-interp.exp: Likewise.
* gdb.base/default.exp (attach, run "r" abbreviation, run): Skip these
testcases for use_gdb_stub.
* gdb.dwarf2/dw2-restore.exp: Fix the run for use_gdb_stub.
(continue): New testcase.
* gdb.python/py-events.exp: Skip the testfile for use_gdb_stub.
* gdb.threads/attach-into-signal.exp: Likewise.
* gdb.threads/attach-stopped.exp: Likewise.
* gdb.threads/attachstop-mt.exp: Likewise.
* lib/mi-support.exp (breakpoint_re): Suppress match reporting.
(mi_gdb_test): Import globals thread_selected_re
and breakpoint_re. Expect them optionally at the regex start.
gdb/ChangeLog:
* value.h (read_frame_register_value): Add declaration.
* findvar.c (read_frame_register_value): New function.
(value_from_register): Use read_frame_register_value
instead of get_frame_register_value + value_contents_copy
to get value contents.
source_script_from_stream if it may have been found on the search path.
* python/py-auto-load.c (source_section_scripts): Pass full path to
source_python_script_for_objfile.
* python/python.c (source_python_script): Delete stream parameter.
All callers updated.
(source_python_script_for_objfile): Ditto.
* python/python-internal.h (source_python_script_for_objfile): Update.
* python/python.h (source_python_script): Update.
testsuite/
* gdb.python/python.exp: Test source -s.
gdb/
* frame.c (frame_stop_reason_string): Rewrite using
unwind_stop_reasons.def.
* frame.h (enum unwind_stop_reason): Likewise.
* python/py-frame.c (gdbpy_initialize_frames): Likewise.
(gdbpy_frame_stop_reason_string): Use new enum unwind_stop_reason
constants for bound-checking.
* unwind_stop_reasons.def: New file.
* stack.c (backtrace_command_1): Handle UNWIND_FIRST_ERROR as an alias
instead of a distinct value.
doc/
* gdb.texinfo ((Frames In Python): Document
gdb.FRAME_UNWIND_FIRST_ERROR contant.
PR python/13331
* python/py-function.c (fnpy_call): Check 'args' is not NULL.
(convert_values_to_python): Return on Python tuple allocation
failure. Return NULL on value conversion error.
Not sure why, but the version currently checked in as an extraneous
trailing whitespace that showed up as a diff when I reran gdbarch.sh.
gdb/ChangeLog:
* gdbarch.h: Regenerate.
(ppc_sysv_abi_push_dummy_call): Use it.
(do_ppc_sysv_return_value): Likewise.
(ppc64_sysv_abi_push_dummy_call): Likewise.
(ppc64_sysv_abi_return_value): Likewise.
* python/py-value.c (value_to_value_object): Remove fetching of
the value if it was lazy.
(valpy_get_is_lazy): New function.
(valpy_fetch_lazy): New function.
Our testsuite noticed a crash when trying to call a function which
requires GDB to allocate memory in the inferior. Typically, this
happens when one of the parameters is a string. For instance, our
testcase tries:
(gdb) call debug.trace (me, "You")
[1] 32737 segmentation fault /path/to/gdb
What happens is that GDB sees the string, and thus tries to allocate
memory for it in the inferior:
> /* Allocate NBYTES of space in the inferior using the inferior's
> malloc and return a value that is a pointer to the allocated
> space. */
>
> struct value *
> value_allocate_space_in_inferior (int len)
> {
> struct objfile *objf;
> struct value *val = find_function_in_inferior ("malloc", &objf);
And find_function_in_inferior first searches the symtab in case
we have debug info. But, in our case (bareboard powerpc), we don't,
so it gets "malloc"'s address from the minimal symbols, and builds
a value whose type is a TYPE_CODE_PTR, not a TYPE_CODE_FUNC.
As a result, when we later try to make the call to malloc, we end up
inside the powerpc tdep code that has:
> do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type,
[...]
> if (func_type
> && TYPE_CALLING_CONVENTION (func_type) == DW_CC_GDB_IBM_OpenCL)
The problem is that func_type is not a TYPE_CODE_FUNC, and thus
the type-specific kind is not TYPE_SPECIFIC_FUNC, and so we do
TYPE_CALLING_CONVENTION is an invalid access.
Interestingly, the other call to TYPE_CALLING_CONVENTION is correctly
preceded by a check of the type's TYPE_CODE (making sure that it is
TYPE_CODE_FUNC).
gdb/ChangeLog:
* ppc-sysv-tdep.c (do_ppc_sysv_return_value): Do not check
FUNC_TYPE's calling convention if FUNC_TYPE is not a function.
gdb/
* linux-nat.c (linux_handle_extended_wait): When handling a clone
event, in non-stop, if not stopping, make sure the new lwp has
last_resume_kind set to resume_continue. Assert that when we're
resuming the new lwp, its last_resume_kind is resume_continue.