Age | Commit message (Collapse) | Author | Files | Lines |
|
Fixes another C++ -fpermissive error:
src/gdb/gdbserver/tracepoint.c:4535:21: error: invalid conversion from ‘int’ to ‘eval_result_type’ [-fpermissive]
expr_eval_result = ipa_expr_eval_result;
gdb/gdbserver/ChangeLog:
2015-08-06 Pedro Alves <palves@redhat.com>
* tracepoint.c (expr_eval_result): Now an int.
|
|
The regcache used to be hidden inside inferiors.c, but since the
tracepoints support that it's a first class object. This also fixes a
few implicit pointer conversion errors in C++ mode, caused by a few
places missing the explicit cast.
gdb/gdbserver/ChangeLog:
2015-08-06 Pedro Alves <palves@redhat.com>
* gdbthread.h (struct regcache): Forward declare.
(struct thread_info) <regcache_data>: Now a struct regcache
pointer.
* inferiors.c (inferior_regcache_data)
(set_inferior_regcache_data): Now work with struct regcache
pointers.
* inferiors.h (struct regcache): Forward declare.
(inferior_regcache_data, set_inferior_regcache_data): Now work
with struct regcache pointers.
* regcache.c (get_thread_regcache, regcache_invalidate_thread)
(free_register_cache_thread): Remove struct regcache pointer
casts.
|
|
Running gdb.threads/process-dies-while-handling-bp.exp against
gdbserver sometimes FAILs because GDBserver drops the connection, but
the logs leave no clue on what the reason could be. Running manually
a few times, I saw the same:
$ ./gdbserver/gdbserver --multi :9999 testsuite/gdb.threads/process-dies-while-handling-bp
Process testsuite/gdb.threads/process-dies-while-handling-bp created; pid = 12766
Listening on port 9999
Remote debugging from host 127.0.0.1
Listening on port 9999
Child exited with status 0
Child exited with status 0
What happened is that an exception escaped and gdbserver reopened the
connection, which led to that second "Listening on port 9999" output.
The error was a failure to access registers from a now-dead thread.
The exception probably shouldn't have escaped here, but meanwhile,
this at least makes the issue less mysterious.
Tested on x86_64 Fedora 20.
gdb/gdbserver/ChangeLog:
2015-08-06 Pedro Alves <palves@redhat.com>
* server.c (captured_main): On error, print the exception message
to stderr, and if run_once is set, throw a quit.
|
|
While hacking on the fix for PR threads/18600 (Threads left stopped
after fork+thread spawn), I once saw its test (fork-plus-threads.exp)
FAIL against gdbserver because move_out_of_jump_pad_callback has a
gdb_breakpoint_here call, and the caller isn't making sure the current
thread points to the right thread. In the case I saw, the current
thread pointed to the wrong process, so gdb_breakpoint_here returned
the wrong answer. Unfortunately I didn't save logs. Still, seems
obvious enough and it should fix a potential occasional racy FAIL.
Tested on x86_64 Fedora 20.
gdb/gdbserver/ChangeLog:
2015-08-06 Pedro Alves <palves@redhat.com>
* linux-low.c (move_out_of_jump_pad_callback): Temporarily switch
the current thread.
|
|
Running gdbserver --debug under Valgrind shows:
==4803== Invalid read of size 4
==4803== at 0x432B62: linux_write_memory (linux-low.c:5320)
==4803== by 0x4143F7: write_inferior_memory (target.c:83)
==4803== by 0x415895: remove_memory_breakpoint (mem-break.c:362)
==4803== by 0x432EF5: linux_remove_point (linux-low.c:5460)
==4803== by 0x416319: delete_raw_breakpoint (mem-break.c:802)
==4803== by 0x4163F3: release_breakpoint (mem-break.c:842)
==4803== by 0x416477: delete_breakpoint_1 (mem-break.c:869)
==4803== by 0x4164EF: delete_breakpoint (mem-break.c:891)
==4803== by 0x416843: delete_gdb_breakpoint_1 (mem-break.c:1069)
==4803== by 0x4168D8: delete_gdb_breakpoint (mem-break.c:1098)
==4803== by 0x4134E3: process_serial_event (server.c:4051)
==4803== by 0x4138E4: handle_serial_event (server.c:4196)
==4803== Address 0x4c6b930 is 0 bytes inside a block of size 1 alloc'd
==4803== at 0x4A0645D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==4803== by 0x4240C6: xmalloc (common-utils.c:43)
==4803== by 0x41439C: write_inferior_memory (target.c:80)
==4803== by 0x415895: remove_memory_breakpoint (mem-break.c:362)
==4803== by 0x432EF5: linux_remove_point (linux-low.c:5460)
==4803== by 0x416319: delete_raw_breakpoint (mem-break.c:802)
==4803== by 0x4163F3: release_breakpoint (mem-break.c:842)
==4803== by 0x416477: delete_breakpoint_1 (mem-break.c:869)
==4803== by 0x4164EF: delete_breakpoint (mem-break.c:891)
==4803== by 0x416843: delete_gdb_breakpoint_1 (mem-break.c:1069)
==4803== by 0x4168D8: delete_gdb_breakpoint (mem-break.c:1098)
==4803== by 0x4134E3: process_serial_event (server.c:4051)
==4803==
And:
==7272== Conditional jump or move depends on uninitialised value(s)
==7272== at 0x3615E48361: vfprintf (vfprintf.c:1634)
==7272== by 0x414E89: debug_vprintf (debug.c:60)
==7272== by 0x42800A: debug_printf (common-debug.c:35)
==7272== by 0x43937B: my_waitpid (linux-waitpid.c:149)
==7272== by 0x42D740: linux_wait_for_event_filtered (linux-low.c:2441)
==7272== by 0x42DADA: linux_wait_for_event (linux-low.c:2552)
==7272== by 0x42E165: linux_wait_1 (linux-low.c:2860)
==7272== by 0x42F5D8: linux_wait (linux-low.c:3453)
==7272== by 0x4144A4: mywait (target.c:107)
==7272== by 0x413969: handle_target_event (server.c:4214)
==7272== by 0x41A1A6: handle_file_event (event-loop.c:429)
==7272== by 0x41996D: process_event (event-loop.c:184)
gdb/ChangeLog:
2015-08-06 Pedro Alves <palves@redhat.com>
* nat/linux-waitpid.c (my_waitpid): Only print *status if waitpid
returned > 0.
gdb/gdbserver/ChangeLog:
2015-08-06 Pedro Alves <palves@redhat.com>
* linux-low.c (linux_write_memory): Rewrite debug output to avoid
reading beyond the passed in buffer length.
|
|
This field was never set nor used. This patch removes it.
gdb/ChangeLog:
* common/agent.c (symbol_list) <required>: Remove.
gdb/gdbserver/ChangeLog:
* tracepoint.c (symbol_list) <required>: Remove.
|
|
Ref: https://sourceware.org/ml/gdb-patches/2015-07/msg00868.html
This adds a test that has a multithreaded program have several threads
continuously fork, while another thread continuously steps over a
breakpoint.
This exposes several intertwined issues, which this patch addresses:
- When we're stopping and suspending threads, some thread may fork,
and we missed setting its suspend count to 1, like we do when a new
clone/thread is detected. When we next unsuspend threads, the fork
child's suspend count goes below 0, which is bogus and fails an
assertion.
- If a step-over is cancelled because a signal arrives, but then gdb
is not interested in the signal, we pass the signal straight back
to the inferior. However, we miss that we need to re-increment the
suspend counts of all other threads that had been paused for the
step-over. As a result, other threads indefinitely end up stuck
stopped.
- If a detach request comes in just while gdbserver is handling a
step-over (in the test at hand, this is GDB detaching the fork
child), gdbserver internal errors in stabilize_thread's helpers,
which assert that all thread's suspend counts are 0 (otherwise we
wouldn't be able to move threads out of the jump pads). The
suspend counts aren't 0 while a step-over is in progress, because
all threads but the one stepping past the breakpoint must remain
paused until the step-over finishes and the breakpoint can be
reinserted.
- Occasionally, we see "BAD - reinserting but not stepping." being
output (from within linux_resume_one_lwp_throw). That was because
GDB pokes memory while gdbserver is busy with a step-over, and that
suspends threads, and then re-resumes them with proceed_one_lwp,
which missed another reason to tell linux_resume_one_lwp that the
thread should be set back to stepping.
- In a couple places, we were resuming threads that are meant to be
suspended. E.g., when a vCont;c/s request for thread B comes in
just while gdbserver is stepping thread A past a breakpoint. The
resume for thread B must be deferred until the step-over finishes.
- The test runs with both "set detach-on-fork" on and off. When off,
it exercises the case of GDB detaching the fork child explicitly.
When on, it exercises the case of gdb resuming the child
explicitly. In the "off" case, gdb seems to exponentially become
slower as new inferiors are created. This is _very_ noticeable as
with only 100 inferiors gdb is crawling already, which makes the
test take quite a bit to run. For that reason, I've disabled the
"off" variant for now.
gdb/ChangeLog:
2015-08-06 Pedro Alves <palves@redhat.com>
* target/waitstatus.h (enum target_stop_reason)
<TARGET_STOPPED_BY_SINGLE_STEP>: New value.
gdb/gdbserver/ChangeLog:
2015-08-06 Pedro Alves <palves@redhat.com>
* linux-low.c (handle_extended_wait): Set the fork child's suspend
count if stopping and suspending threads.
(check_stopped_by_breakpoint): If stopped by trace, set the LWP's
stop reason to TARGET_STOPPED_BY_SINGLE_STEP.
(linux_detach): Complete an ongoing step-over.
(lwp_suspended_inc, lwp_suspended_decr): New functions. Use
throughout.
(resume_stopped_resumed_lwps): Don't resume a suspended thread.
(linux_wait_1): If passing a signal to the inferior after
finishing a step-over, unsuspend and re-resume all lwps. If we
see a single-step event but the thread should be continuing, don't
pass the trap to gdb.
(stuck_in_jump_pad_callback, move_out_of_jump_pad_callback): Use
internal_error instead of gdb_assert.
(enqueue_pending_signal): New function.
(check_ptrace_stopped_lwp_gone): Add debug output.
(start_step_over): Use internal_error instead of gdb_assert.
(complete_ongoing_step_over): New function.
(linux_resume_one_thread): Don't resume a suspended thread.
(proceed_one_lwp): If the LWP is stepping over a breakpoint, reset
it stepping.
gdb/testsuite/ChangeLog:
2015-08-06 Pedro Alves <palves@redhat.com>
* gdb.threads/forking-threads-plus-breakpoint.exp: New file.
* gdb.threads/forking-threads-plus-breakpoint.c: New file.
|
|
The tail end of linux_wait_1 isn't expecting that the select_event_lwp
machinery can pick a whole-process exit event to report to GDB. When
that happens, both gdb and gdbserver end up quite confused:
...
(gdb)
[Thread 24971.24971] #1 stopped.
0x0000003615a011f0 in ?? ()
c&
Continuing.
(gdb) [New Thread 24971.24981]
[New Thread 24983.24983]
[New Thread 24971.24982]
[Thread 24983.24983] #3 stopped.
0x0000003615ebc7cc in __libc_fork () at ../nptl/sysdeps/unix/sysv/linux/fork.c:130
130 pid = ARCH_FORK ();
[New Thread 24984.24984]
Error in re-setting breakpoint -16: PC register is not available
Error in re-setting breakpoint -17: PC register is not available
Error in re-setting breakpoint -18: PC register is not available
Error in re-setting breakpoint -19: PC register is not available
Error in re-setting breakpoint -24: PC register is not available
Error in re-setting breakpoint -25: PC register is not available
Error in re-setting breakpoint -26: PC register is not available
Error in re-setting breakpoint -27: PC register is not available
Error in re-setting breakpoint -28: PC register is not available
Error in re-setting breakpoint -29: PC register is not available
Error in re-setting breakpoint -30: PC register is not available
PC register is not available
(gdb)
gdb/gdbserver/ChangeLog:
2015-08-06 Pedro Alves <palves@redhat.com>
* linux-low.c (add_lwp): Set waitstatus to TARGET_WAITKIND_IGNORE.
(linux_thread_alive): Use lwp_is_marked_dead.
(extended_event_reported): Delete.
(linux_wait_1): Check if waitstatus is TARGET_WAITKIND_IGNORE
instead of extended_event_reported.
(mark_lwp_dead): Don't set the 'dead' flag. Store the waitstatus
as well.
(lwp_is_marked_dead): New function.
(lwp_running): Use lwp_is_marked_dead.
* linux-low.h: Delete 'dead' field, and update 'waitstatus's
comment.
|
|
The "extended event with waitstatus" debug output is unreachable, as
it is guarded by "if (!report_to_gdb)". If extended_event_reported is
true, then so is report_to_gdb. Move it to where we print why we're
reporting an event to GDB.
Also, the debug output currently tries to print the wrong struct
target_waitstatus.
gdb/gdbserver/ChangeLog:
2015-08-06 Pedro Alves <palves@redhat.com>
* linux-low.c (linux_wait_1): Move fork event output out of the
!report_to_gdb check. Pass event_child->waitstatus to
target_waitstatus_to_string instead of ourstatus.
|
|
We only support tracepoint for aarch64. Although arm program can run
on aarch64, GDBserver doesn't support tracepoint for it.
gdb/gdbserver:
2015-08-04 Yao Qi <yao.qi@linaro.org>
* linux-aarch64-low.c (aarch64_supports_tracepoints): Return 0
if current_thread is 32 bit.
|
|
In multi-arch debugging, if GDB sends Z0 packet, GDBserver should be
able to do several things below:
- choose the right breakpoint instruction to insert according to the
information available, such as 'kind' in Z0 packet and address,
- choose the right breakpoint instruction to check memory writes and
validate inserted memory breakpoint
- be aware of different breakpoint instructions in $ARCH_breakpoint_at.
unfortunately GDBserver can't do them now. Although x86 GDBserver
supports multi-arch, it doesn't need to support them above because
breakpoint instruction on i686 and x86_64 is the same. However,
breakpoint instructions on aarch64 and arm (arm mode, thumb1, and thumb2)
are different.
I tried to teach aarch64 GDBserver backend to be really
multi-arch-capable in the following ways,
- linux_low_target return the right breakpoint instruction according to
the 'kind' in Z0 packet, and insert_memory_breakpoint can do the right
thing.
- once breakpoint is inserted, the breakpoint data and length is recorded
in each breakpoint object, so that validate_breakpoint and
check_mem_write can get the right breakpoint instruction from each
breakpoint object, rather than from global variable breakpoint_data.
- linux_low_target needs another hook function for pc increment after
hitting a breakpoint.
- let set_breakpoint_at, which is widely used for tracepoint, use the
'default' breakpoint instruction. We can always use aarch64 breakpoint
instruction since arm doesn't support tracepoint yet.
looks it is not a small piece of work, so I decide to disable Z0 packet
on multi-arch, which means aarch64 GDBserver only supports Z0 packet
if it is started to debug only one process (extended protocol is not
used) and process target description is 64-bit.
gdb/gdbserver:
2015-08-04 Yao Qi <yao.qi@linaro.org>
* linux-aarch64-low.c (aarch64_supports_z_point_type): Return
0 for Z_PACKET_SW_BP if it may be used in multi-arch debugging.
* server.c (extended_protocol): Remove "static".
* server.h (extended_protocol): Declare it.
|
|
gdb/gdbserver:
2015-08-04 Yao Qi <yao.qi@linaro.org>
* linux-aarch64-low.c (aarch64_get_pc): Get PC register on
both aarch64 and aarch32.
(aarch64_set_pc): Likewise.
|
|
This patch teaches aarch64-linux GDBserver use 32-bit arm target
description and regs_info if the elf file is 32-bit.
gdb/gdbserver:
2015-08-04 Yao Qi <yao.qi@linaro.org>
* configure.srv (case aarch64*-*-linux*): Append arm-with-neon.o
to srv_regobj and append arm-core.xml arm-vfpv3.xml and
arm-with-neon.xml to srv_xmlfiles.
* linux-aarch64-low.c: Include linux-aarch32-low.h.
(is_64bit_tdesc): New function.
(aarch64_linux_read_description): New function.
(aarch64_arch_setup): Call aarch64_linux_read_description.
(regs_info): Rename to regs_info_aarch64.
(aarch64_regs_info): Return right regs_info.
(initialize_low_arch): Call initialize_low_arch_aarch32.
|
|
This patch adds a new regs_info regs_info_aarch32 for aarch32, which
can be used by both aarch64 and arm backend.
gdb/gdbserver:
2015-08-04 Yao Qi <yao.qi@linaro.org>
* configure.srv (srv_tgtobj): Add linux-aarch32-low.o.
* linux-aarch32-low.c: New file.
* linux-aarch32-low.h: New file.
* linux-arm-low.c (arm_fill_gregset): Move it to
linux-aarch32-low.c.
(arm_store_gregset): Likewise.
(arm_fill_vfpregset): Call arm_fill_vfpregset_num
(arm_store_vfpregset): Caa arm_store_vfpregset_num.
(arm_arch_setup): Check if PTRACE_GETREGSET works.
(regs_info): Rename to regs_info_arm.
(arm_regs_info): Return regs_info_aarch32 if
have_ptrace_getregset is 1 and target description is
arm_with_neon or arm_with_vfpv3.
(initialize_low_arch): Don't call init_registers_arm_with_neon.
Call initialize_low_arch_aarch32 instead.
|
|
This patch moves variable have_ptrace_getregset from linux-x86-low.c
to linux-low.c, so that arm can use it too.
gdb/gdbserver:
2015-08-04 Yao Qi <yao.qi@linaro.org>
* linux-x86-low.c (have_ptrace_getregset): Move it to ...
* linux-low.c: ... here.
* linux-low.h (have_ptrace_getregset): Declare it.
|
|
Implicit void * -> function pointer conversion doesn't work in C++, so
in C++, we need to cast the result of dlsym. This adds a few typedefs
and macros that make this easy. GDBserver's version already had the
CHK macro, so I added it to GDB too.
Tested on x86_64 Fedora 20, native and gdbserver.
gdb/gdbserver/ChangeLog:
2015-08-04 Pedro Alves <palves@redhat.com>
* thread-db.c (struct thread_db): Use new typedefs.
(try_thread_db_load_1): Define local TDB_DLSYM macro and use it in
CHK calls.
(disable_thread_event_reporting): Cast result of dlsym to
destination function pointer type.
(thread_db_mourn): Use td_ta_delete_ftype.
gdb/ChangeLog:
2015-08-04 Pedro Alves <palves@redhat.com>
* nat/gdb_thread_db.h (td_init_ftype, td_ta_new_ftype)
(td_ta_map_lwp2thr_ftype, td_ta_thr_iter_ftype)
(td_ta_event_addr_ftype, td_ta_set_event_ftype)
(td_ta_clear_event_ftype, td_ta_event_getmsg_ftype)
(td_thr_validate_ftype, td_thr_get_info_ftype)
(td_thr_event_enable_ftype, td_thr_tls_get_addr_ftype)
(td_thr_tlsbase_ftype, td_symbol_list_ftype, td_ta_delete_ftype):
New typedefs.
* linux-thread-db.c (struct thread_db_info): Use new typedefs.
(try_thread_db_load_1): Define TDB_VERBOSE_DLSYM, TDB_DLSYM , CHK
local macros and use them instead of verbose_dlsym and dlsym
calls.
|
|
2015-08-03 Sandra Loosemore <sandra@codesourcery.com>
gdb/
* nios2-tdep.h: Include opcode/nios2.h here.
(NIOS2_CDX_OPCODE_SIZE): New.
(struct gdbarch_tdep): Add OP parameter to syscall_next_pc.
* nios2-tdep.c: Don't include opcode/nios2.h here.
(nios2_fetch_insn): For R2, try reading 2-byte instruction if
4-byte read fails.
(nios2_match_add, nios2_match_sub): Add cases for R2 encodings.
(nios2_match_addi, nios2_match_orhi): Likewise.
(nios2_match_stw, nios2_match_ldw): Likewise.
(nios2_match_rdctl): Likewise.
(nios2_match_stwm, nios2_match_ldwm): New.
(nios2_match_branch): Add cases for R2 encodings.
(nios2_match_jmpi, nios2_match_calli): Likewise.
(nios2_match_jmpr, nios2_match_callr): Likewise.
(nios2_match_break, nios2_match_trap): Likewise.
(nios2_in_epilogue_p): Add R2 support.
(nios2_analyze_prologue): Update comments. Recognize R2 CDX
prologues.
(nios2_breakpoint_from_pc): Handle R2 instructions.
(nios2_get_next_pc): Likewise. Adjust call to
tdep->syscall_next_pc.
* nios2-linux-tdep.c (nios2_r1_linux_rt_sigreturn_tramp_frame):
Renamed from nios2_linux_rt_sigreturn_tramp_frame. Use
instruction field macros instead of literal hex values.
(nios2_r2_linux_rt_sigreturn_tramp_frame): New.
(nios2_linux_syscall_next_pc): Adjust signature to pass OP.
Use size field from OP instead of assuming all instructions
are the same size.
(nios2_linux_init_abi): Register appropriate unwinder for mach.
gdb/gdbserver/
* linux-nios2-low.c (NIOS2_BREAKPOINT): Conditionalize for
arch variant.
(CDX_BREAKPOINT): Define for R2.
(nios2_breakpoint_at): Check for CDX_BREAKPOINT when R2.
(the_low_target): Add comments.
|
|
Running gdb.threads/fork-plus-threads.exp against gdbserver in
extended-remote mode, even though the test passes, we still see broken
behavior:
(gdb) PASS: gdb.threads/fork-plus-threads.exp: set detach-on-fork off
continue &
Continuing.
(gdb) PASS: gdb.threads/fork-plus-threads.exp: continue &
[New Thread 28092.28092]
[Thread 28092.28092] #2 stopped.
[New Thread 28094.28094]
[Inferior 2 (process 28092) exited normally]
[New Thread 28094.28105]
[New Thread 28094.28109]
...
[Thread 28174.28174] #18 stopped.
[New Thread 28185.28185]
[Inferior 10 (process 28174) exited normally]
[New Thread 28185.28196]
[Thread 28185.28185] #20 stopped.
Cannot remove breakpoints because program is no longer writable.
Further execution is probably impossible.
[Inferior 11 (process 28185) exited normally]
[Inferior 1 (process 28091) exited normally]
PASS: gdb.threads/fork-plus-threads.exp: reached breakpoint
info threads
No threads.
(gdb) PASS: gdb.threads/fork-plus-threads.exp: no threads left
info inferiors
Num Description Executable
* 1 <null> /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.threads/fork-plus-threads
(gdb) PASS: gdb.threads/fork-plus-threads.exp: only inferior 1 left
All the "[Thread FOO] #NN stopped." above are bogus, as well as the
"Cannot remove breakpoints because program is no longer writable.",
which is a consequence.
The problem is that when we intercept a fork event, we should report
the event for the parent, only, and leave the child stopped, but not
report its stop event. GDB later decides whether to follow the parent
or the child. But because handle_extended_wait does not set the
child's last_status.kind to TARGET_WAITKIND_STOPPED, a
stop_all_threads/unstop_all_lwps sequence (e.g., from trying to access
memory) by mistake ends up queueing a SIGSTOP on the child, resuming
it, and then when that SIGSTOP is intercepted, because the LWP has
last_resume_kind set to resume_stop, gdbserver reports the stop to
GDB, as GDB_SIGNAL_0:
...
>>>> entering unstop_all_lwps
unstopping all lwps
proceed_one_lwp: lwp 1600
client wants LWP to remain 1600 stopped
proceed_one_lwp: lwp 1828
Client wants LWP 1828 to stop. Making sure it has a SIGSTOP pending
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sending sigstop to lwp 1828
pc is 0x3615ebc7cc
Resuming lwp 1828 (continue, signal 0, stop expected)
continue from pc 0x3615ebc7cc
unstop_all_lwps done
sigchld_handler
<<<< exiting unstop_all_lwps
handling possible target event
>>>> entering linux_wait_1
linux_wait_1: [<all threads>]
my_waitpid (-1, 0x40000001)
my_waitpid (-1, 0x1): status(137f), 1828
LWFE: waitpid(-1, ...) returned 1828, ERRNO-OK
LLW: waitpid 1828 received Stopped (signal) (stopped)
pc is 0x3615ebc7cc
Expected stop.
LLW: resume_stop SIGSTOP caught for LWP 1828.1828.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
linux_wait_1 ret = LWP 1828.1828, 1, 0
<<<< exiting linux_wait_1
Writing resume reply for LWP 1828.1828:1
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Tested on x86_64 Fedora 20, extended-remote.
gdb/gdbserver/ChangeLog:
2015-07-30 Pedro Alves <palves@redhat.com>
* linux-low.c (handle_extended_wait): Set the child's last
reported status to TARGET_WAITKIND_STOPPED.
|
|
After previous patch, we don't need global variable arm_hwcap. This
patch is to remove it.
gdb/gdbserver:
2015-07-30 Yao Qi <yao.qi@linaro.org>
* linux-arm-low.c (arm_hwcap): Remove it.
(arm_read_description): New local variable arm_hwcap. Don't
set arm_hwcap to zero.
|
|
arm_hwcap is a global variable, and we should avoid using it as much
as we can. Instead of checking arm_hwcap, we can check whether
regcache->tdesc is a certain kind of target description. This is
what this patch does.
gdb/gdbserver:
2015-07-30 Yao Qi <yao.qi@linaro.org>
* linux-arm-low.c (arm_fill_wmmxregset): Don't use arm_hwcap.
Use regcache->tdesc instead.
(arm_store_wmmxregset): Likewise.
(arm_fill_vfpregset): Likewise.
(arm_store_vfpregset): Likewise.
|
|
In order to align with arm-linux-nat.c counterparts, we don't use
arm_num_regs and arm_regmap in functions arm_fill_gregset and
arm_store_gregset. Instead, we use register numbers. With this
patch applied, arm_fill_gregset and arm_store_gregset don't need
arm_num_regs and arm_regmap, and they will be moved to a separate
file shared for both arm and aarch64 in the following patch.
gdb/gdbserver:
2015-07-30 Yao Qi <yao.qi@linaro.org>
* linux-arm-low.c: Include arch/arm.h.
(arm_fill_gregset): Don't use arm_num_regs and arm_regmap.
(arm_store_gregset): Likewise.
|
|
Since Pedro's ptrace cleanups, the MIPS buildbot compilation fails.
Code in MIPS native uses ptrace with 3 arguments, where ptrace requires
4. When looking at the definition of ptrace in
/usr/include/sys/ptrace.h, it shows that it takes a variable number of
arguments. The wrapper macro in nat/gdb_ptrace.h takes a fixed number
of arguments (4). That would explain why it used to work and stopped.
I am pushing this as obvious, tell me if there is any problem.
I built-tested this with a MIPS toolchain (ct-ng), but I don't have any
setup to test it. At least it should put back the buildbot builder in a
better shape.
gdb/ChangeLog:
* mips-linux-nat.c (write_watchpoint_regs): Add NULL as ptrace's 4th
parameter.
(mips_linux_new_thread): Likewise.
* nat/mips-linux-watch.c (mips_linux_read_watch_registers): Likewise.
gdb/gdbserver/ChangeLog:
* linux-mips-low.c (mips_linux_prepare_to_resume): Add NULL as
ptrace's 4th parameter.
|
|
We don't use PTRACE_PEEKUSR/PTRACE_POKEUSR on aarch64-linux, so don't
need to set srv_linux_usrregs. This patch removes that line.
gdb/gdbserver:
2015-07-27 Yao Qi <yao.qi@linaro.org>
* configure.srv (case aarch64*-*-linux*): Don't set
srv_linux_usrregs.
|
|
So that we pick the enum __ptrace_request fix everywhere.
gdb/ChangeLog:
2015-07-24 Pedro Alves <palves@redhat.com>
* aarch64-linux-nat.c: Include nat/gdb_ptrace.h instead of
sys/ptrace.h.
* alpha-linux-nat.c: Likewise.
* amd64-linux-nat.c: Likewise.
* arm-linux-nat.c: Likewise.
* hppa-linux-nat.c: Likewise.
* i386-linux-nat.c: Likewise.
* ia64-linux-nat.c: Likewise.
* linux-fork.c: Likewise.
* linux-nat.c: Likewise.
* m32r-linux-nat.c: Likewise.
* m68klinux-nat.c: Likewise.
* mips-linux-nat.c: Likewise.
* nat/linux-btrace.c: Likewise.
* nat/linux-ptrace.c: Likewise.
* nat/linux-ptrace.h
* nat/mips-linux-watch.c: Likewise.
* nat/x86-linux-dregs.c: Likewise.
* ppc-linux-nat.c: Likewise.
* s390-linux-nat.c: Likewise.
* spu-linux-nat.c: Likewise.
* tilegx-linux-nat.c: Likewise.
* x86-linux-nat.c: Likewise.
* xtensa-linux-nat.c: Likewise.
gdb/gdbserver/ChangeLog:
2015-07-24 Pedro Alves <palves@redhat.c: Likewise.om>
* linux-aarch64-low.c: Include nat/gdb_ptrace.h instead of
sys/ptrace.h.
* linux-arm-low.c: Likewise.
* linux-cris-low.c: Likewise.
* linux-crisv32-low.c: Likewise.
* linux-low.c: Likewise.
* linux-m68k-low.c: Likewise.
* linux-mips-low.c: Likewise.
* linux-nios2-low.c: Likewise.
* linux-s390-low.c: Likewise.
* linux-sparc-low.c: Likewise.
* linux-tic6x-low.c: Likewise.
* linux-tile-low.c: Likewise.
* linux-x86-low.c: Likewise.
|
|
Building in C++ mode issues ~40 warnings like this:
../../src/gdb/linux-nat.c: In function ‘int linux_handle_extended_wait(lwp_info*, int, int)’:
../../src/gdb/linux-nat.c:2016:51: warning: invalid conversion from ‘int’ to ‘__ptrace_request’ [-fpermissive]
ptrace (PTRACE_GETEVENTMSG, pid, 0, &new_pid);
The issue is that in glibc, ptrace's first parameter is an enum.
That's not a problem if we pick the PTRACE_XXX requests from
sys/ptrace.h, as those will be values of the corresponding enum.
However, we have fallback definitions for PTRACE_XXX symbols when the
system headers miss them (such as PTRACE_GETEVENTMSG above), and those
are plain integer constants. E.g., nat/linux-ptrace.h:
#define PTRACE_GETEVENTMSG 0x4201
One idea would be to fix this by defining those fallbacks like:
-#define PTRACE_GETEVENTMSG 0x4201
+#define PTRACE_GETEVENTMSG ((enum __ptrace_request) 0x4201)
However, while glibc's ptrace uses enum __ptrace_request for first
parameter:
extern long int ptrace (enum __ptrace_request __request, ...) __THROW;
other libc's, like e.g., Android's bionic do not -- in that case, the
first parameter is int:
long ptrace(int request, pid_t pid, void * addr, void * data);
So the fix I came up is to make configure/ptrace.m4 also detect the
type of the ptrace's first parameter and defin PTRACE_TYPE_ARG1, as
already does the for parameters 3-4, and then simply wrap ptrace with
a macro that casts the first argument to the detected type. (I'm
leaving adding a nicer wrapper for when we drop building in C).
While this adds the wrapper, GNU/Linux files won't use it until the
next patch, which makes all native GNU/Linux files include
gdb_ptrace.h.
gdb/ChangeLog:
2015-07-24 Pedro Alves <palves@redhat.com>
* ptrace.m4 (ptrace tests): Test in C++ mode. Try with 'enum
__ptrace_request as first parameter type instead of int.
(PTRACE_TYPE_ARG1): Define.
* nat/gdb_ptrace.h [!PTRACE_TYPE_ARG5] (ptrace): Define as wrapper
that casts first argument to PTRACE_TYPE_ARG1.
* config.in: Regenerate.
* configure: Regenerate.
gdb/gdbserver/ChangeLog:
2015-07-24 Pedro Alves <palves@redhat.com>
* config.in: Regenerate.
* configure: Regenerate.
|
|
This factors the ptrace checks out of gdb's configure.ac to a new
ptrace.m4 file, and then makes gdbserver's configure.ac source it too.
gdb/ChangeLog:
2015-07-24 Pedro Alves <palves@redhat.com>
* acinclude.m4: Include ptrace.m4.
* configure.ac: Call GDB_AC_PTRACE and move ptrace checks ...
* ptrace.m4: ... to this new file.
gdb/gdbserver/ChangeLog:
2015-07-24 Pedro Alves <palves@redhat.com>
* acinclude.m4: Include ../ptrace.m4.
* configure.ac: Call GDB_AC_PTRACE.
* config.in, configure: Regenerate.
|
|
As the result of the previous patch, new_inferior is no longer used.
This patch is to remove it.
gdb/gdbserver:
2015-07-24 Yao Qi <yao.qi@linaro.org>
* linux-low.c (linux_create_inferior): Remove setting to
proc->priv->new_inferior.
(linux_attach): Likewise.
(linux_low_filter_event): Likewise.
* linux-low.h (struct process_info_private) <new_inferior>: Remove.
|
|
Nowadays, when --wrapper is used, GDBserver skips extra traps/stops
in the wrapper program, and stops at the first instruction of the
program to be debugged. However, GDBserver created target description
in the first stop of inferior, and the executable of the inferior
is the wrapper program rather than the program to be debugged. In
this way, the target description can be wrong if the architectures
of wrapper program and program to be debugged are different. This
is shown by some fails in gdb.server/wrapper.exp on buildbot.
We are testing i686-linux GDB (Fedora-i686) on an x86_64-linux box
(fedora-x86-64-4) in buildbot, such configuration causes fails in
gdb.server/wrapper.exp like this:
spawn /home/gdb-buildbot-2/fedora-x86-64-4/fedora-i686/build/gdb/testsuite/../../gdb/gdbserver/gdbserver --once --wrapper env TEST=1 -- :2346 /home/gdb-buildbot-2/fedora-x86-64-4/fedora-i686/build/gdb/testsuite/outputs/gdb.server/wrapper/wrapper
Process /home/gdb-buildbot-2/fedora-x86-64-4/fedora-i686/build/gdb/testsuite/outputs/gdb.server/wrapper/wrapper created; pid = 8795
Can't debug 64-bit process with 32-bit GDBserver
Exiting
target remote localhost:2346
localhost:2346: Connection timed out.
(gdb) FAIL: gdb.server/wrapper.exp: setting breakpoint at marker
See https://sourceware.org/ml/gdb-testers/2015-q3/msg01541.html
In this case, program to be debugged ("wrapper") is 32-bit but wrapper
program ("/usr/bin/env") is 64-bit, so GDBserver gets the 64-bit
target description instead of 32-bit.
The root cause of this problem is that GDBserver creates target
description too early, and the rationale of fix could be creating
target description once the GDBserver skips extra traps and inferior
stops at the first instruction of the program we want to debug. IOW,
when GDBserver skips extra traps, the inferior's tdesc is NULL, and
mywait and its callees shouldn't use inferior's tdesc, so in this
patch, we skip code that requires register access, see changes in
linux_resume_one_lwp_throw and need_step_over_p.
In linux_low_filter_event, if target description isn't initialised and
GDBserver attached the process, we create target description immediately,
because GDBserver don't have to skip extra traps for attach, IOW, it
makes no sense to use --attach and --wrapper together. Otherwise, the
process is launched by GDBserver, we keep the status pending, and return.
After GDBserver skipped extra traps in start_inferior, we call a
target_ops hook arch_setup to initialise target description there.
gdb/gdbserver:
2015-07-24 Yao Qi <yao.qi@linaro.org>
* linux-low.c (linux_arch_setup): New function.
(linux_low_filter_event): If proc->tdesc is NULL and
proc->attached is true, call the_low_target.arch_setup.
Otherwise, keep status pending, and return.
(linux_resume_one_lwp_throw): Don't call get_pc if
thread->while_stepping isn't NULL. Don't call
get_thread_regcache if proc->tdesc is NULL.
(need_step_over_p): Return 0 if proc->tdesc is NULL.
(linux_target_ops): Install arch_setup.
* server.c (start_inferior): Call the_target->arch_setup.
* target.h (struct target_ops) <arch_setup>: New field.
(target_arch_setup): New marco.
* lynx-low.c (lynx_target_ops): Update.
* nto-low.c (nto_target_ops): Update.
* spu-low.c (spu_target_ops): Update.
* win32-low.c (win32_target_ops): Update.
|
|
Nowadays, we set proc->priv->new_inferior to 1 inside linux_add_process,
and new_inferior is used as a flag to initialise target description later.
linux_add_process is used for the three cases, fork/vfork event
(handle_extended_wait), run the program (linux_create_inferior), and
attach to the process (linux_attach). In the first case, the child's
target description is copied from parent's, so we don't need to initialise
target description again later, which means we don't need to set
proc->priv->new_inferior to 1 in this case. For the rest of two cases,
we need this flag.
This patch move the code setting proc->priv->new_inferior to 1 inside
linux_add_process to linux_create_inferior and linux_attach. No
functionality is changed.
gdb/gdbserver:
2015-07-24 Yao Qi <yao.qi@linaro.org>
* linux-low.c (linux_add_process): Don't set
proc->priv->new_inferior.
(linux_create_inferior): Set proc->priv->new_inferior to 1.
(linux_attach): Likewise.
|
|
This patch is to refactor function start_inferior that signal_pid
is return in one place.
gdb/gdbserver:
2015-07-24 Yao Qi <yao.qi@linaro.org>
* server.c (start_inferior): Code refactor.
|
|
When I run gdb.server/ext-restart.exp, I get the following GDB internal
error,
run^M
The program being debugged has been started already.^M
Start it from the beginning? (y or n) y^M
Sending packet: $vKill;53c5#3d...Packet received: OK^M
Packet vKill (kill) is supported^M
Sending packet: $vFile:close:6#b6...Packet received: F0^M
Sending packet: $vFile:close:3#b3...Packet received: F0^M
Starting program: /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/gdb.server/ext-restart ^M
Sending packet: $QDisableRandomization:1#cf...Packet received: OK^M
Sending packet: $R0#82...Sending packet: $qC#b4...Packet received: QCp53c5.53c5^M <-- [1]
Sending packet: $qAttached:53c5#c9...Packet received: E01^M
warning: Remote failure reply: E01^M
....
0x00002aaaaaaac2d0 in ?? () from target:/lib64/ld-linux-x86-64.so.2^M
/home/yao/SourceCode/gnu/gdb/git/gdb/thread.c:88: internal-error: inferior_thread: Assertion `tp' failed.^M
A problem internal to GDB has been detected,^M
further debugging may prove unreliable.^M
Quit this debugging session? (y or n) FAIL: gdb.server/ext-restart.exp: run to main (GDB internal error)
Resyncing due to internal error.
the test is to restart the program, to make sure GDBserver handles
packet 'R' correctly. From the GDBserver output, we can see,
Remote debugging from host 127.0.0.1^M
Process /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/gdb.server/ext-restart created; pid = 21445^M
GDBserver restarting^M
Process /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/gdb.server/ext-restart created; pid = 21446^M
Killing process(es): 21446
we first start process 21445(0x53c5), kill it and restart a new process
21446. However, in the gdb output above [1], we can see that the reply
of qC is still the old process id rather than the new one. Looks
general_thread isn't up to date after GDBserver receives R packet.
This patch is to update general_thread after call start_inferior.
gdb/gdbserver:
2015-07-24 Yao Qi <yao.qi@linaro.org>
* server.c (process_serial_event): Set general_thread.
gdb/testsuite:
2015-07-24 Yao Qi <yao.qi@linaro.org>
* gdb.server/ext-restart.exp: New file.
|
|
|
|
There are also some duplication on getting HW watchpoint/breakpoint
registers info between GDB and GDBserver. This patch moves them
to nat/aarch64-linux-hw-point.c.
Note that ENABLE_NLS is not defined in GDBserver, so it should be OK
to use _( markup.
gdb:
2015-07-21 Yao Qi <yao.qi@linaro.org>
* aarch64-linux-nat.c (aarch64_linux_get_debug_reg_capacity):
Move it to nat/aarch64-linux-hw-point.c.
(aarch64_linux_child_post_startup_inferior): Update.
* nat/aarch64-linux-hw-point.c (aarch64_linux_get_debug_reg_capacity):
New function.
* nat/aarch64-linux-hw-point.h (aarch64_linux_get_debug_reg_capacity):
Declare it.
gdb/gdbserver:
2015-07-21 Yao Qi <yao.qi@linaro.org>
* linux-aarch64-low.c (aarch64_arch_setup): Remove code and call
aarch64_linux_get_debug_reg_capacity.
|
|
When I look at test fails related to watchpoint on aarch64-linux,
I find there are some code duplicates between GDB and GDBserver.
This patch is to move some of them to a nat/aarch64-linux-hw-point.{h,c}.
The only change I do is about the dr_changed_t typedef, which was
ULONGEST in GDB and 'unsigned long long' in GDBserver. Each bit
of dr_changed_t represents a status of each HW breakpoint or
watchpoint register, and the max number of HW breakpoint or watchpoint
registers is 16, so the width of 'unsigned long long' is sufficient.
gdb:
2015-07-17 Yao Qi <yao.qi@linaro.org>
* Makefile.in (HFILES_NO_SRCDIR): Add
nat/aarch64-linux-hw-point.h.
(aarch64-linux-hw-point.o): New rule.
* nat/aarch64-linux-hw-point.h: New file.
* nat/aarch64-linux-hw-point.c: New file.
* aarch64-linux-nat.c: Include nat/aarch64-linux-hw-point.h.
(AARCH64_HBP_MAX_NUM): Move to nat/aarch64-linux-hw-point.h.
(AARCH64_HWP_MAX_NUM, AARCH64_HBP_ALIGNMENT): Likewise.
(AARCH64_HWP_ALIGNMENT): Likewise.
(AARCH64_HWP_MAX_LEN_PER_REG): Likewise.
(AARCH64_DEBUG_NUM_SLOTS, AARCH64_DEBUG_ARCH): Likewise.
(AARCH64_DEBUG_ARCH_V8, DR_MARK_ALL_CHANGED): Likewise.
(DR_MARK_N_CHANGED, DR_CLEAR_CHANGED): Likewise.
(DR_HAS_CHANGED, DR_N_HAS_CHANGE): Likewise.
(aarch64_num_bp_regs, aarch64_num_wp_regs): Likewise.
(struct aarch64_debug_reg_state): Likewise.
(struct arch_lwp_info): Likewise.
(aarch64_linux_set_debug_regs): Likewise.
(aarch64_notify_debug_reg_change): Remove static.
(aarch64_align_watchpoint): Likewise.
(DR_CONTROL_ENABLED, DR_CONTROL_LENGTH): Likewise.
(aarch64_watchpoint_length): Likewise.
(aarch64_point_encode_ctrl_reg): Likewise
(aarch64_point_is_aligned): Likewise.
(aarch64_dr_state_insert_one_point): Likewise.
(aarch64_dr_state_remove_one_point): Likewise.
(aarch64_handle_breakpoint): Likewise.
(aarch64_handle_aligned_watchpoint): Likewise.
(aarch64_handle_unaligned_watchpoint): Likewise.
(aarch64_handle_watchpoint): Likewise.
* config/aarch64/linux.mh (NAT_FILE): Add
aarch64-linux-hw-point.o.
gdb/gdbserver:
2015-07-17 Yao Qi <yao.qi@linaro.org>
* Makefile.in (aarch64-linux-hw-point.o): New rule.
* configure.srv (srv_tgtobj): Append aarch64-linux-hw-point.o.
* linux-aarch64-low.c: Include nat/aarch64-linux-hw-point.h.
(AARCH64_HBP_MAX_NUM): Move to nat/aarch64-linux-hw-point.h.
(AARCH64_HWP_MAX_NUM, AARCH64_HBP_ALIGNMENT): Likewise.
(AARCH64_HWP_ALIGNMENT): Likewise.
(AARCH64_HWP_MAX_LEN_PER_REG): Likewise.
(AARCH64_DEBUG_NUM_SLOTS, AARCH64_DEBUG_ARCH): Likewise.
(aarch64_num_bp_regs, aarch64_num_wp_regs): Likewise.
(AARCH64_DEBUG_ARCH_V8, DR_MARK_ALL_CHANGED): Likewise.
(DR_MARK_N_CHANGED, DR_CLEAR_CHANGED): Likewise.
(DR_HAS_CHANGED, DR_N_HAS_CHANGE): Likewise.
(struct aarch64_debug_reg_state): Likewise.
(struct arch_lwp_info): Likewise.
(aarch64_align_watchpoint): Likewise.
(DR_CONTROL_ENABLED, DR_CONTROL_LENGTH): Likewise.
(aarch64_watchpoint_length): Likewise.
(aarch64_point_encode_ctrl_reg): Likewise
(aarch64_point_is_aligned): Likewise.
(aarch64_align_watchpoint): Likewise.
(aarch64_linux_set_debug_regs):
(aarch64_dr_state_insert_one_point): Likewise.
(aarch64_dr_state_remove_one_point): Likewise.
(aarch64_handle_breakpoint): Likewise.
(aarch64_handle_aligned_watchpoint): Likewise.
(aarch64_handle_unaligned_watchpoint): Likewise.
(aarch64_handle_watchpoint): Likewise.
|
|
Some functions on handling HW watchpoint in GDB and GDBserver looks the
same except the code getting debug register state from current inferior.
In GDB, we get debug register state like this:
state = aarch64_get_debug_reg_state (ptid_get_pid (inferior_ptid));
while in GDBserver, we get debug register state like this:
state = aarch64_get_debug_reg_state ();
This patch is to move two lines above out of some functions, and pass
aarch64_debug_reg_state to these functions, in this way, these functions
are the same, and can be moved to a common place.
gdb:
2015-07-17 Yao Qi <yao.qi@linaro.org>
* aarch64-linux-nat.c (aarch64_handle_breakpoint): Add argument
state and don't call aarch64_get_debug_reg_state. All callers
update.
(aarch64_linux_insert_hw_breakpoint): Call
aarch64_get_debug_reg_state earlier.
(aarch64_linux_remove_hw_breakpoint): Likewise.
(aarch64_handle_aligned_watchpoint): Add argument state and
don't call aarch64_get_debug_reg_state. All callers update.
(aarch64_handle_unaligned_watchpoint): Likewise.
(aarch64_handle_watchpoint): Add argument state.
(aarch64_linux_insert_watchpoint): Call aarch64_get_debug_reg_state
earlier.
(aarch64_linux_remove_watchpoint): Likewise.
gdb/gdbserver:
2015-07-17 Yao Qi <yao.qi@linaro.org>
* linux-aarch64-low.c (aarch64_handle_breakpoint): Add argument state
and don't aarch64_get_debug_reg_state. All callers update.
(aarch64_handle_aligned_watchpoint): Likewise.
(aarch64_handle_unaligned_watchpoint): Likewise.
(aarch64_handle_watchpoint): Likewise.
(aarch64_insert_point): Call aarch64_get_debug_reg_state earlier.
(aarch64_remove_point): Likewise.
|
|
Some functions in aarch64-linux-nat.c and linux-aarch64-low.c looks
the same except for the code printing debug message. In GDB, we use
fprintf_unfiltered (gdb_stdlog, ...) while in GDBserver, we use
fprintf (stderr, ...). This patch is to change them to use debug_printf
so that these functions are the same, and I can move them to a common
place in the following patch.
gdb:
2015-07-17 Yao Qi <yao.qi@linaro.org>
* aarch64-linux-nat.c (aarch64_show_debug_reg_state): Use
debug_printf.
(aarch64_handle_unaligned_watchpoint): Likewise.
gdb/gdbserver:
2015-07-17 Yao Qi <yao.qi@linaro.org>
* linux-aarch64-low.c (aarch64_show_debug_reg_state): Use
debug_printf.
(aarch64_handle_unaligned_watchpoint): Likewise.
|
|
ddc98fbf2fd9e244a215a4d09e559180dc573a14 Create empty nat/linux-maps.[ch] and common/target-utils.[ch]
6e5b4429db0d66e2d0b27e1bcfe4709f3dae73ed Move gdb_regex* to common/
f7af1fcd759fa126612018a5916cf808df7bb8bc Prepare linux_find_memory_regions_full & co. for move
9904185cfde13d6c6849f1f042c8e3b74974cf08 Move linux_find_memory_regions_full & co.
700ca40f6fc1addd7238f4ab57f76c095ad3c99f gdbserver build-id attribute generator
ca5268b6be265580b91ef75c1a1a9815f581ae42 Validate symbol file using build-id
0a94970d663a053c523f23ac0d71deb25a77f709 Tests for validate symbol file using build-id
gdb/ChangeLog
2015-07-15 Jan Kratochvil <jan.kratochvil@redhat.com>
Revert the previous 6 commits:
Create empty nat/linux-maps.[ch] and common/target-utils.[ch].
Move gdb_regex* to common/
Prepare linux_find_memory_regions_full & co. for move
Move linux_find_memory_regions_full & co.
gdbserver build-id attribute generator
Validate symbol file using build-id
gdb/gdbserver/ChangeLog
2015-07-15 Jan Kratochvil <jan.kratochvil@redhat.com>
Revert the previous 3 commits:
Move gdb_regex* to common/
Move linux_find_memory_regions_full & co.
gdbserver build-id attribute generator
gdb/doc/ChangeLog
2015-07-15 Jan Kratochvil <jan.kratochvil@redhat.com>
Revert the previous 2 commits:
gdbserver build-id attribute generator
Validate symbol file using build-id
gdb/testsuite/ChangeLog
2015-07-15 Jan Kratochvil <jan.kratochvil@redhat.com>
Revert the previous commit:
Tests for validate symbol file using build-id.
|
|
Producer part of the new "build-id" XML attribute.
gdb/ChangeLog
2015-07-15 Aleksandar Ristovski <aristovski@qnx.com
Jan Kratochvil <jan.kratochvil@redhat.com>
gdbserver build-id attribute generator.
* features/library-list-svr4.dtd (library-list-svr4): New
'build-id' attribute.
gdb/doc/ChangeLog
2015-07-15 Aleksandar Ristovski <aristovski@qnx.com
Jan Kratochvil <jan.kratochvil@redhat.com>
gdbserver build-id attribute generator.
* gdb.texinfo (Library List Format for SVR4 Targets): Add
'build-id' in description, example, new attribute in dtd.
gdb/gdbserver/ChangeLog
2015-07-15 Aleksandar Ristovski <aristovski@qnx.com
Jan Kratochvil <jan.kratochvil@redhat.com>
gdbserver build-id attribute generator.
* linux-low.c (nat/linux-maps.h, search.h, rsp-low.h): Include.
(ElfXX_Ehdr, ElfXX_Phdr, ElfXX_Nhdr): New.
(ELFXX_FLD, ELFXX_SIZEOF, ELFXX_ROUNDUP, BUILD_ID_INVALID): New.
(find_phdr): New.
(get_dynamic): Use find_pdhr to traverse program headers.
(struct mapping_entry, mapping_entry_s, free_mapping_entry_vec)
(compare_mapping_entry_range, struct find_memory_region_callback_data)
(read_build_id, find_memory_region_callback, lrfind_mapping_entry)
(get_hex_build_id): New.
(linux_qxfer_libraries_svr4): Add optional build-id attribute
to reply XML document.
|
|
This should be just a move with no changes.
gdb/ChangeLog
2015-07-15 Aleksandar Ristovski <aristovski@qnx.com
Jan Kratochvil <jan.kratochvil@redhat.com>
Move linux_find_memory_regions_full & co.
* linux-tdep.c (nat/linux-maps.h): Include.
(gdb_regex.h): Remove the include.
(enum filterflags, struct smaps_vmflags, read_mapping, decode_vmflags)
(mapping_is_anonymous_p, dump_mapping_p): Moved to nat/linux-maps.c.
(linux_find_memory_region_ftype): Moved typedef to nat/linux-maps.h.
(linux_find_memory_regions_full): Moved definition to nat/linux-maps.c.
* nat/linux-maps.c: Include ctype.h, target/target-utils.h, gdb_regex.h
and target/target.h.
(struct smaps_vmflags, read_mapping, decode_vmflags)
(mapping_is_anonymous_p, dump_mapping_p): Move from linux-tdep.c.
(linux_find_memory_regions_full): Move from linux-tdep.c.
* nat/linux-maps.h (read_mapping): New declaration.
(linux_find_memory_region_ftype, enum filterflags): Moved from
linux-tdep.c.
(linux_find_memory_regions_full): New declaration.
* target.c (target/target-utils.h): Include.
(read_alloc_pread_ftype): Moved typedef to target/target-utils.h.
(read_alloc, read_stralloc_func_ftype, read_stralloc): Moved
definitions to target/target-utils.c.
* target.h (target_fileio_read_stralloc): Move it to target/target.h.
* target/target-utils.c (read_alloc, read_stralloc): Move definitions
from target.c.
* target/target-utils.h (read_alloc_pread_ftype): New typedef.
(read_alloc): New declaration.
(read_stralloc_func_ftype): New typedef.
(read_stralloc): New declaration.
* target/target.h (target_fileio_read_stralloc): Move it from target.h.
gdb/gdbserver/ChangeLog
2015-07-15 Aleksandar Ristovski <aristovski@qnx.com
Jan Kratochvil <jan.kratochvil@redhat.com>
* target.c: Include target/target-utils.h and fcntl.h.
(target_fileio_read_stralloc_1_pread, target_fileio_read_stralloc_1)
(target_fileio_read_stralloc): New functions.
|
|
Later patches need regex support also in gdbserver.
gdb/ChangeLog
2015-07-15 Jan Kratochvil <jan.kratochvil@redhat.com>
* Makefile.in (HFILES_NO_SRCDIR): Change gdb_regex.h to
common/gdb_regex.h.
(COMMON_OBS): Add gdb_regex.o.
(gdb_regex.o): New.
* common/common.m4 (GDB_AC_COMMON): Add gdb_use_included_regex,
--without-included-regex and USE_INCLUDED_REGEX.
* common/gdb_regex.c: New file from utils.c functions.
* common/gdb_regex.h: Move it here from gdb_regex.h, update include
file wrapping define name.
* configure: Rebuilt.
* configure.ac (gdb_use_included_regex, --without-included-regex)
(USE_INCLUDED_REGEX): Move them to common/common.m4.
* gdb_regex.h: Move it to common/gdb_regex.h.
* utils.c: Remove include gdb_regex.h.
(do_regfree_cleanup, make_regfree_cleanup, get_regcomp_error)
(compile_rx_or_error): Move them to common/gdb_regex.c.
gdb/gdbserver/ChangeLog
2015-07-15 Jan Kratochvil <jan.kratochvil@redhat.com>
* Makefile.in (OBS): Add gdb_regex.o.
(gdb_regex.o): New.
* config.in: Rebuilt.
* configure: Rebuilt.
|
|
Prepare new files for later move.
gdb/ChangeLog
2015-07-15 Aleksandar Ristovski <aristovski@qnx.com
Jan Kratochvil <jan.kratochvil@redhat.com>
Create empty nat/linux-maps.[ch] and common/target-utils.[ch].
* Makefile.in (HFILES_NO_SRCDIR); Add nat/linux-maps.h,
common/target-utils.h.
(COMMON_OBS): Add target-utils.o.
(linux-maps.o, target-utils.o): New.
* target/target-utils.c: New file.
* target/target-utils.h: New file.
* config/i386/linux.mh (NATDEPFILES): Add linux-maps.o.
* config/i386/linux64.mh (NATDEPFILES): Ditto.
* nat/linux-maps.c: New file.
* nat/linux-maps.h: New file.
gdb/gdbserver/ChangeLog
2015-07-15 Aleksandar Ristovski <aristovski@qnx.com
Jan Kratochvil <jan.kratochvil@redhat.com>
Create empty nat/linux-maps.[ch] and common/target-utils.[ch].
* Makefile.in (OBS): Add target-utils.o.
(linux-maps.o, target-utils.o): New.
* configure.srv (srv_linux_obj): Add linux-maps.o.
|
|
gdb/gdbserver/ChangeLog:
* linux-aarch64-low.c (aarch64_supports_range_stepping): New
function, return 1.
(the_low_target): Install it.
|
|
gdb/gdbserver/Changelog:
* linux-aarch64-low.c (aarch64_supports_range_stepping): New
function, return 1.
(the_low_target): Install it.
|
|
If the process disappears (e.g., killed with "kill -9" from the shell)
while it was stopped under GDBserver's control, and the GDBserver
tries to kill it, GDBserver asserts:
(gdb) shell kill -9 23084
(gdb) kill
...
Killing process(es): 23084
/home/pedro/gdb/mygit/src/gdb/gdbserver/linux-low.c:972: A problem internal to GDBserver has been detected.
kill_wait_lwp: Assertion `res > 0' failed.
...
gdb/gdbserver/ChangeLog:
2015-07-14 Pedro Alves <palves@redhat.com>
* linux-low.c (kill_wait_lwp): Don't assert if waitpid fails.
Instead, ignore ECHILD, and throw an error for other errnos.
|
|
Building with C++ catches a buglet here:
../../../src/gdb/gdbserver/event-loop.c:205:19: warning: invalid conversion from ‘gdb_client_data {aka void*}’ to ‘void**’ [-fpermissive]
event_ptr->data = data;
^
This works in practice because gdb_client_data is a pointer already
(hence in C we get an implicit conversion), and nothing deferences the
pointer. It's passed from client at event registration/creation time,
only to pass straight back to client callback.
Well, that and nothing in gdbserver uses the event data anyway.
gdb/gdbserver/ChangeLog:
2015-07-10 Pedro Alves <palves@redhat.com>
* event-loop.c (struct callback_event) <data>: Change type to
gdb_client_data instance instead of gdb_client_data pointer.
(append_callback_event): Adjust.
|
|
This patch cleans up the comments for each linux_target_ops methods. We
should mention which method each function implements but there is no
need to duplicate information already mentionned in the base target_ops
or linux_target_ops definitions.
gdb/gdbserver/ChangeLog:
* linux-aarch64-low.c: Add comments for each linux_target_ops
method. Remove comments already covered in target_ops and
linux_target_ops definitions.
(the_low_target): Add comments for each unimplemented method.
|
|
gdb/gdbserver/ChangeLog:
* linux-aarch64-low.c (aarch64_supports_tracepoints): New
function. Return 1.
(the_low_target): Install it.
|
|
Hi,
I happen to read the comments in regs_info below,
struct regs_info
{
...
/* Info used when accessing registers with PTRACE_PEEKUSER /
PTRACE_POKEUSER. This can be NULL if all registers are
transferred with regsets .*/
struct usrregs_info *usrregs;
that usrregs can be NULL if all registers are transferred with
regsets, which is exactly what aarch64-linux does. This patch
is to set usrregs to NULL in regs_info and remove
aarch64_usrregs_info and aarch64_regmap.
gdb/gdbserver:
2015-07-09 Yao Qi <yao.qi@linaro.org>
* linux-aarch64-low.c (aarch64_regmap): Remove.
(aarch64_usrregs_info): Remove.
(regs_info): Set field usrregs to NULL.
|
|
Adds a new command "record btrace pt" to configure the kernel to use
Intel(R) Processor Trace instead of Branch Trace Strore.
The "record btrace" command chooses the tracing format automatically.
Intel(R) Processor Trace support requires Linux 4.1 and libipt.
gdb/
* NEWS: Announce new commands "record btrace pt" and "record pt".
Announce new options "set|show record btrace pt buffer-size".
* btrace.c: Include "rsp-low.h".
Include "inttypes.h".
(btrace_add_pc): Add forward declaration.
(pt_reclassify_insn, ftrace_add_pt, btrace_pt_readmem_callback)
(pt_translate_cpu_vendor, btrace_finalize_ftrace_pt)
(btrace_compute_ftrace_pt): New.
(btrace_compute_ftrace): Support BTRACE_FORMAT_PT.
(check_xml_btrace_version): Update version check.
(parse_xml_raw, parse_xml_btrace_pt_config_cpu)
(parse_xml_btrace_pt_raw, parse_xml_btrace_pt)
(btrace_pt_config_cpu_attributes, btrace_pt_config_children)
(btrace_pt_children): New.
(btrace_children): Add support for "pt".
(parse_xml_btrace_conf_pt, btrace_conf_pt_attributes): New.
(btrace_conf_children): Add support for "pt".
* btrace.h: Include "intel-pt.h".
(btrace_pt_error): New.
* common/btrace-common.c (btrace_format_string, btrace_data_fini)
(btrace_data_empty): Support BTRACE_FORMAT_PT.
* common/btrace-common.h (btrace_format): Add BTRACE_FORMAT_PT.
(struct btrace_config_pt): New.
(struct btrace_config)<pt>: New.
(struct btrace_data_pt_config, struct btrace_data_pt): New.
(struct btrace_data)<pt>: New.
* features/btrace-conf.dtd (btrace-conf)<pt>: New.
(pt): New.
* features/btrace.dtd (btrace)<pt>: New.
(pt, pt-config, cpu): New.
* nat/linux-btrace.c (perf_event_read, perf_event_read_all)
(perf_event_pt_event_type, kernel_supports_pt)
(linux_supports_pt): New.
(linux_supports_btrace): Support BTRACE_FORMAT_PT.
(linux_enable_bts): Free tinfo on error.
(linux_enable_pt): New.
(linux_enable_btrace): Support BTRACE_FORMAT_PT.
(linux_disable_pt): New.
(linux_disable_btrace): Support BTRACE_FORMAT_PT.
(linux_fill_btrace_pt_config, linux_read_pt): New.
(linux_read_btrace): Support BTRACE_FORMAT_PT.
* nat/linux-btrace.h (struct btrace_tinfo_pt): New.
(struct btrace_target_info)<pt>: New.
* record-btrace.c (set_record_btrace_pt_cmdlist)
(show_record_btrace_pt_cmdlist): New.
(record_btrace_print_pt_conf): New.
(record_btrace_print_conf): Support BTRACE_FORMAT_PT.
(btrace_ui_out_decode_error): Support BTRACE_FORMAT_PT.
(cmd_record_btrace_pt_start): New.
(cmd_record_btrace_start): Support BTRACE_FORMAT_PT.
(cmd_set_record_btrace_pt, cmd_show_record_btrace_pt): New.
(_initialize_record_btrace): Add new commands.
* remote.c (PACKET_Qbtrace_pt, PACKET_Qbtrace_conf_pt_size): New.
(remote_protocol_features): Add "Qbtrace:pt".
Add "Qbtrace-conf:pt:size".
(remote_supports_btrace): Support BTRACE_FORMAT_PT.
(btrace_sync_conf): Support PACKET_Qbtrace_conf_pt_size.
(remote_enable_btrace): Support BTRACE_FORMAT_PT.
(_initialize_remote): Add new commands.
gdbserver/
* linux-low.c: Include "rsp-low.h"
(linux_low_encode_pt_config, linux_low_encode_raw): New.
(linux_low_read_btrace): Support BTRACE_FORMAT_PT.
(linux_low_btrace_conf): Support BTRACE_FORMAT_PT.
(handle_btrace_enable_pt): New.
(handle_btrace_general_set): Support "pt".
(handle_btrace_conf_general_set): Support "pt:size".
doc/
* gdb.texinfo (Process Record and Replay): Spell out that variables
and registers are not available during btrace replay.
Describe the new "record btrace pt" command.
Describe the new "set|show record btrace pt buffer-size" options.
(General Query Packets): Describe the new Qbtrace:pt and
Qbtrace-conf:pt:size packets.
Expand "bts" to "Branch Trace Store".
Update the branch trace DTD.
|
|
This patch lets GDBServer handle software breakpoints instead of relying
on GDB.
gdb/gdbserver/ChangeLog:
* linux-aarch64-low.c (aarch64_supports_z_point_type): Enable for
Z_PACKET_SW_BP.
|