This patch constifies the target_ops method to_detach.
This is a small cleanup, but also, I think, a bug-prevention fix,
since gdb already acts as if the "args" argument here was const.
In particular, top.c:quit_force calls kill_or_detach via
iterate_over_inferiors. kill_or_detach calls target_detach, passing
the same argument each time. So, if one of these methods was not
const-correct, then kill_or_detach would change its behavior in a
strange way.
I could not build every target I modified in this patch. I've
inspected them all by hand, though. Many targets do not use the
"args" parameter; a couple pass it to atoi; and a few pass it on to
the to_detach method of the target beneath. The only code that
required a real change was in linux-nat.c, and that only needed the
introduction of a temporary variable for const-correctness.
2013-11-08 Tom Tromey <tromey@redhat.com>
* aix-thread.c (aix_thread_detach): Update.
* corelow.c (core_detach): Update.
* darwin-nat.c (darwin_detach): Update.
* dec-thread.c (dec_thread_detach): Update.
* gnu-nat.c (gnu_detach): Update.
* go32-nat.c (go32_detach): Update.
* inf-ptrace.c (inf_ptrace_detach): Update.
* inf-ttrace.c (inf_ttrace_detach): Update.
* linux-fork.c (linux_fork_detach): Update.
* linux-fork.h (linux_fork_detach): Update.
* linux-nat.c (linux_nat_detach): Update. Introduce "tem"
local for const-correctness.
* linux-thread-db.c (thread_db_detach): Update.
* monitor.c (monitor_detach): Update.
* nto-procfs.c (procfs_detach): Update.
* procfs.c (procfs_detach): Update.
* record.c (record_detach): Update.
* record.h (record_detach): Update.
* remote-m32r-sdi.c (m32r_detach): Update.
* remote-mips.c (mips_detach): Update.
* remote-sim.c (gdbsim_detach): Update.
* remote.c (remote_detach_1, remote_detach)
(extended_remote_detach): Update.
* sol-thread.c (sol_thread_detach): Update.
* target.c (target_detach): Make "args" const.
(init_dummy_target): Update.
* target.h (struct target_ops) <to_detach>: Make argument const.
(target_detach): Likewise.
* windows-nat.c (windows_detach): Update.
* python/py-breakpoint.c (bppy_get_temporary): New function.
(bppy_init): New keyword: temporary. Parse it and set breakpoint
to temporary if True.
2013-11-07 Phil Muldoon <pmuldoon@redhat.com>
* gdb.python/py-breakpoint.exp: Add temporary breakpoint tests.
2013-11-07 Phil Muldoon <pmuldoon@redhat.com>
* gdb.texinfo (Breakpoints In Python): Document temporary
option in breakpoint constructor, and add documentation to the
temporary attribute.
This patch does some cleanups, removing some language-related stuff.
Note that mi_cmd_var_info_expression uses varobj_language_string,
which is redundant, because we can get language name from
lang->la_natural_name.
varobj_language_string doesn't have "Ada", which looks like a bug to
me. With this patch applied, this problem doesn't exist, because the
language name is got from the same place (field la_natural_name).
gdb:
2013-11-07 Yao Qi <yao@codesourcery.com>
* mi/mi-cmd-var.c: Include "language.h".
(mi_cmd_var_info_expression): Get language name from
language_defn.
* varobj.c (varobj_language_string): Remove.
(variable_language): Remove declaration.
(languages): Remove.
(varobj_get_language): Change the type of return value.
(variable_language): Remove.
* varobj.h (enum varobj_languages): Remove.
(varobj_language_string): Remove declaration.
(varobj_get_language): Update declaration.
gdb/doc:
2013-11-07 Yao Qi <yao@codesourcery.com>
* gdb.texinfo (GDB/MI Variable Objects): Update doc about the
output of "-var-info-expression".
Hi,
When I add another name of language, I find field 'la_name' can be
'const char *'. This patch is to constify it.
gdb:
2013-11-07 Yao Qi <yao@codesourcery.com>
* language.c (language_str): Return const char *.
(add_language): Add const to 'language_names'
* language.h (struct language_defn) <la_name>: Add const.
(language_str: Update declaration.
When checking for the presence of the TDB regset, the current code
interprets ENODATA from PTRACE_GETREGSET as an indication that the TDB
regset *could* occur on this system, but the inferior stopped outside
a transaction. However, the Linux kernel actually reports ENODATA
even on systems without the transactional execution facility. Thus
the logic is now changed to check the TE field in the HWCAP as well.
This version also checks the existence of the TDB regset -- just to be
on the safe side when running on TE-enabled hardware with a kernel
that does not offer the TDB regset for some reason.
gdb/
* s390-linux-nat.c (s390_read_description): Consider the TE field
in the HWCAP for determining 'have_regset_tdb'.
gdbserver/
* linux-s390-low.c (HWCAP_S390_TE): New define.
(s390_arch_setup): Consider the TE field in the HWCAP for
determining 'have_regset_tdb'.
When reading objects with corrupt debug information it is possible that
the sibling chain can form a loop, which leads to an infinite loop and
memory exhaustion.
Avoid this situation by disregarding and DW_AT_sibling values that point
to a lower address than the current entry.
gdb/ChangeLog:
2013-11-06 Will Newton <will.newton@linaro.org>
PR gdb/12866
* dwarf2read.c (skip_one_die): Sanity check DW_AT_sibling
values. (read_partial_die): Likewise.
When Bash is started non-interactively, it runs the script pointed by
the BASH_ENV environment variable, not .bashrc. While at it, mention
Z shell in the warning too, and mention non-interactive mode
explicitly.
gdb/doc/
2013-11-06 Pedro Alves <palves@redhat.com>
* gdb.texinfo (Starting) <set/show startup-with-shell>: Mention
non-interactive mode.
(Environment) <shell startup files warning>: Mention
non-interactive mode. Mention .zshenv for Z shell, and talk about
BASH_ENV instead of .bashrc for BASH.
This patch is to add a test case to on the performance of GDB handling
load and unload of shared library.
In V4:
- Handle malloc and dlopen failure,
- Document test parameters.
In V3, there are some changes,
- Adapt to perf test framework changes.
- Measure load and unload separately.
In V2, there are some changes,
- A new proc gdb_produce_source to produce source files. I tried to
move all source file generation code out of solib.exp, but
compilation step still needs to know the generated file names. I
have to hard-code the file names in compilation step, which is not
good to me, so I give up on this moving.
- SOLIB_NUMBER -> SOLIB_COUNT
- New variable SOLIB_DLCLOSE_REVERSED_ORDER to control the order of
iterating a list of shared libs to dlclose them.
- New variable GDB_PERFORMANCE to enable these perf test cases.
- Remove dlsym call in solib.c.
- Update solib.py for the updated framework.
gdb/testsuite/
* lib/gdb.exp (gdb_produce_source): New procedure.
* gdb.perf/solib.c: New.
* gdb.perf/solib.exp: New.
* gdb.perf/solib.py: New.
This patch adds a basic framework to do performance testing for GDB.
perftest.py is about the test case, testresult.py is about test
results, and how are they saved. reporter.py is about how results
are reported (in what format). measure.py is about measuring the
execution of tests by a collection of measurements.
In V5:
- Simplify perftest.exp.
In V4:
- Rename MeasurementCPUTime to MeasurementCpuTime,
- Add 'pass' in empty method,
- Simplify string comparison in perftest.exp.
- Rename GDB_PERFORMANCE to GDB_PERFTEST_MODE and rename
GDB_PERFORMANCE_TIMEOUT to GDB_PERFTEST_TIMEOUT.
In V3, there are some changes,
- Add wall time measurement, cpu time measurement and vmsize
measurement.
- Rename SingleStatisticTestCase to TestCaseWithBasicMeasurements,
which measures cpu time, wall time, and memory (vmsize).
- GDB_PERFORMANCE=run|compile|both to control the mode of perf
testing.
- New GDB_PERFORMANCE_TIMEOUT to specify the timeout.
- Split proc prepare to proc compile and startup.
- Disable GC while doing measurements.
In V2, there are several changes to address Doug and Sanimir's
comments.
- Add copyright header and docstring in perftest/__init__.py
- Remove config.py.
- Fix docstring format.
- Rename classes "SingleVariable" to "SingleStatistic".
- Don't extend gdb.Function in class TestCase. Add a new method run
to run the test case so that we can pass parameters to test.
- Allow to customize whether to warm up and to append test log.
- Move time measurement into test harness. Add a new class
Measurement for a specific measurement and a new class Measure to
measure them for a given test case.
- A new class ResultFactory to create instances of TestResult.
- New file lib/perftest.exp, which is to do some preparations and
cleanups to simplify each *.exp file.
- Skip compilation step if GDB_PERFORMANCE_SKIP_COMPILE is set.
gdb/testsuite/
2013-11-06 Yao Qi <yao@codesourcery.com>
* lib/perftest.exp: New.
* gdb.perf/lib/perftest/__init__.py: New.
* gdb.perf/lib/perftest/measure.py: New.
* gdb.perf/lib/perftest/perftest.py: New.
* gdb.perf/lib/perftest/reporter.py: New.
* gdb.perf/lib/perftest/testresult.py: New.
We add a new dir gdb.perf in testsuite for all performance tests.
However, current 'make check' logic will either run dejagnu in
directory testsuite or iterate all gdb.* directories which has *.exp
files. Both of them will run tests in gdb.perf. We want to achieve:
1) typical 'make check' should not run performance tests. In each perf
test case, GDB_PERFTEST_MODE is checked. If it doesn't exist, return.
2) run perf tests easily. We add a new makefile target 'check-perf'.
gdb:
2013-11-06 Yao Qi <yao@codesourcery.com>
* Makefile.in (check-perf): New target.
gdb/testsuite:
2013-11-06 Yao Qi <yao@codesourcery.com>
* Makefile.in (check-perf): New target.
* configure.ac (AC_OUTPUT): Output Makefile in gdb.perf.
* configure: Re-generated.
* gdb.perf/Makefile.in: New.
This switches "make check" to fully parallel mode.
One primary issue facing full parallelization is the overhead of
"runtest". On my machine, if I "touch gdb.base/empty.exp", making a
new file, and then "time runtest.exp", it takes 0.08 seconds.
Multiply this by the 1008 (in my configuration) tests and you get ~80
seconds. This is the overhead that would theoretically be present if
all tests were run in parallel.
However, the problem isn't nearly as bad as this, for two reasons.
First, you must divide by the number of jobs, assuming perfect
parallelization -- reasonably true for small -j numbers, based on the
results I see.
Second, the current test suite parallelization approach bundles the
tests, largely by directory, but also splitting up gdb.base into two
halves.
I was curious to see how the current bundling played out in practice,
so I ran "make -j1 check RUNTEST='/bin/time runtest'". This invokes
the parallel mode (thus the bundling) and then shows the time taken by
each invocation of runtest.
Then, I ran "/bin/time make -j3 check". (See below about -j2.)
The time for the entire -j3 test run was the same as the time for
"gdb.base1". What this means is that gdb.base1 is currently the
time-limiting run, preventing further parallelization gains.
So, I reason, whatever overhead we see from full parallelization will
only be seen by "-j1" and "-j2".
I then tried a -j2 test run. This does take longer than a -j3 build,
meaning that the gdb.base1 job finishes and then proceeds to other
runtest invocations.
Finally I tried a -j2 test run with the appended patch.
This was 9% slower than the -j2 run without the patch.
I think that is a reasonable slowdown for what is probably a rare
case. I believe this patch will yield faster test results for all -j
values greater than 2. For -j3 on my machine, the test suite is a few
seconds faster; I didn't try any larger -j values.
For -j1, I went ahead and changed the Makefile so that, if no -j
option is given, then the "check-single" mode is used. You can still
use "make -j1 check" to get single-job parallel-mode, though of course
there's no good reason to do so.
This change is likely to speed up the plain "make check" scenario a
little as we will now bypass dg-extract-results.sh.
One drawback of this change is that "make -jN check" is now much more
verbose. I generally only look at the .sum and .log files, but
perhaps this will bother some.
Another interesting question is scalability of the result. The
slowest test, which limits the scalability, took 80.78 seconds. The
mean of the remaining tests is 1.08 seconds. (Note that this is just
a rough estimate, since there are still outliers.)
This means we can run 80.78 / 1.08 =~ 74 tests in the time available.
And, in this data set (slightly older than the above, but materially
the same) there were 948 tests. So, I think the current test suite
should scale ok up to about -j12.
We could improve this number if need be by breaking up the biggest
tests.
2013-11-04 Tom Tromey <tromey@redhat.com>
* Makefile.in (TEST_DIRS): Remove.
(TEST_TARGETS, check-parallel): Rewrite.
(check-gdb.%, BASE1_FILES, BASE2_FILES, check-gdb.base%)
(subdir_do, subdirs): Remove.
(do-check-parallel, check/%): New targets.
(clean): Remove outputs, temp, and cache directories.
(saw_dash_j): New variable.
(CHECK_TARGET): Use it.
(check): Depend on all, site.exp. Rewrite.
(check-single): Remove dependencies.
(slow_tests, all_tests, reordered_tests): New variables.
A couple of Fission tests rely on the current directory layout. This
assumption is not valid in parallel mode.
This patch fixes the problem by removing the relative directory from
the .S files and instead having the tests set debug-file-directory
before opening the main file.
2013-11-04 Tom Tromey <tromey@redhat.com>
* gdb.dwarf2/fission-base.S: Remove "gdb.dwarf/".
* gdb.dwarf2/fission-base.exp: Set debug-file-directory
before loading binfile.
* gdb.dwarf2/fission-loclists.S: Remove "gdb.dwarf/".
* gdb.dwarf2/fission-loclists.exp: Set debug-file-directory
before loading binfile.
A few tests run an inferior that execs some other program. The name
of this exec'd program is compiled in. These tests assume the current
test suite directory layout, but fail in parallel mode.
This patch fixes these tests by letting the .exp files pass in the
directory names at compile time.
2013-11-04 Tom Tromey <tromey@redhat.com>
* gdb.base/foll-exec.c (main): Use BASEDIR.
* gdb.base/foll-exec.exp: Define BASEDIR during compilation.
* gdb.base/foll-vfork.c (main): Use BASEDIR.
* gdb.base/foll-vfork.exp: Define BASEDIR during compilation.
* gdb.multi/bkpt-multi-exec.c (main): Use BASEDIR.
* gdb.multi/bkpt-multi-exec.exp: Define BASEDIR during compilation.
argv0-symlink.exp doesn't work properly if standard_output_file puts
files into a per-test subdirectory. That's because it assumes that
files appear in $subdir, which is no longer true.
This patch fixes the problem by computing the correct directory at
runtime.
Tested both with and without GDB_PARALLEL on x86-64 Fedora 18.
2013-11-04 Tom Tromey <tromey@redhat.com>
* gdb.base/argv0-symlink.exp: Compute executable's directory
dynamically.
This introduces a new relative_filename proc to gdb.exp and changes
some tests to use it. This helps make these tests parallel-safe.
2013-11-04 Tom Tromey <tromey@redhat.com>
* gdb.base/fullname.exp: Use standard_output_file,
relative_filename.
* gdb.base/hashline1.exp: Use standard_testfile,
standard_output_file, relative_filename, clean_restart.
* gdb.base/hashline2.exp: Use standard_testfile,
standard_output_file.
* gdb.base/hashline3.exp: Use standard_testfile,
standard_output_file, relative_filename.
* lib/gdb.exp (relative_filename): New proc.
This updates the fileio test to be parallel-safe.
2013-11-04 Tom Tromey <tromey@redhat.com>
* gdb.base/fileio.c (test_open, test_write, test_read)
(test_lseek, test_close, test_stat, test_fstat)
(test_isatty, test_system, test_rename, test_unlink):
Use OUTDIR define.
* gdb.base/fileio.exp: Define OUTDIR during compilation.
Use standard_output_file.
This fixes the "checkpoint" test to use the standard output directory.
This makes the test be parallel-safe.
2013-11-04 Tom Tromey <tromey@redhat.com>
* gdb.base/checkpoint.c (main): Use PI_TXT and COPY1_TXT
defines.
* gdb.base/checkpoint.exp: Define PI_TXT and COPY1_TXT during
compilation. Use prepare_for_testing, standard_output_file.
This makes more changes in gdb.base to make it parallel-safe. I think
the changes in this particular patch are relatively straightforward,
so I've grouped them all together.
2013-11-04 Tom Tromey <tromey@redhat.com>
* gdb.base/advance.exp: Use standard_testfile and
prepare_for_testing.
* gdb.base/bigcore.exp: Use standard_output_file. "cd" to
appropriate directory when local.
* gdb.base/dump.exp: Use standard_output_file. Update all
"dump" and "restore" filenames.
* gdb.base/interact.exp: Use standard_output_file.
* gdb.base/jit-so.exp: Don't download file when local.
* gdb.base/jit.exp (compile_jit_test): Don't download file
when local.
* gdb.base/list.exp: Use gdb_remote_download.
* gdb.base/maint.exp: Use standard_output_file.
* gdb.base/prelink.exp: Use standard_output_file.
* gdb.base/save-bp.exp: Use standard_output_file.
* gdb.base/sepdebug.exp: Use standard_testfile,
standard_output_file.
(test_different_dir): Don't declare objdir.
* gdb.base/solib-search.exp: Use standard_output_file.
* gdb.base/step-line.exp: Use gdb_remote_download.
* gdb.base/trace-commands.exp: Use standard_output_file.
This fixes gdb.trace to be parallel-safe.
2013-11-04 Tom Tromey <tromey@redhat.com>
* gdb.trace/mi-traceframe-changed.exp: Pass -DTFILE_DIR
to compilation. Use standard_output_file.
(test_tfind_tfile): Update.
* gdb.trace/tfile.c (write_basic_trace_file)
(write_error_trace_file): Use TFILE_DIR.
* gdb.trace/tfile.exp: Pass -DTFILE_DIR to compilation. Use
standard_output_file.
This fixes gdb.mi to be parallel-safe.
2013-11-04 Tom Tromey <tromey@redhat.com>
* gdb.mi/mi-cmd-param-changed.exp (test_command_param_changed):
Use "dwarf2 always-disassemble" for the "maint set" test.
* gdb.mi/mi-file-transfer.exp (test_file_transfer): Use
standard_output_file.
* gdb.mi/mi-logging.exp: Use standard_output_file.
This fixes the gdb.xml tests to be parallel-safe.
2013-11-04 Tom Tromey <tromey@redhat.com>
* gdb.xml/tdesc-arch.exp: Use standard_output_file. Make
downloads conditional on remote host.
(set_arch): Likewise.
* gdb.xml/tdesc-regs.exp: Use gdb_remote_download.
(load_description): Use standard_output_file.
This fixes the gdb.gdb tests to be parallel-safe, by ensuring that the
new "xgdb" file ends up in the standard output directory during the
tests.
2013-11-04 Tom Tromey <tromey@redhat.com>
* gdb.gdb/selftest.exp: Use standard_output_file.
* lib/selftest-support.exp (do_self_tests): Use
standard_output_file.
This fixes up gdb.stabs/weird.exp for parallel testing. This just
means using gdb_remote_download and standard_output_file, so that the
tests end up in the right place.
2013-11-04 Tom Tromey <tromey@redhat.com>
* gdb.stabs/weird.exp: Use gdb_remote_download and
standard_output_file.
This fixes some parallelization thinkos from a while ago. I'm not
sure how the problems ever slipped through. In addition to a thinko
fix in twice.exp, this also finishes fixing it up for parallelization.
2013-11-04 Tom Tromey <tromey@redhat.com>
* gdb.base/gcore-buffer-overflow.exp: Use
standard_output_file, not standard_testfile.
* gdb.base/twice.exp: Use standard_testfile, not
standard_output_file. Use gdb_remote_download.
Currently a proc in gdb.exp toggles the expect (and thus dejagnu)
logging. This is not a super idea, but it is there to avoid putting
some preprocessor output into the log.
In the right circumstances, this can result in the log file being
mysteriously truncated. I think this happens because it doesn't
necessarily write to the correct log file again.
The fix is to use "log_file -info" to save the previous log file.
2013-11-04 Tom Tromey <tromey@redhat.com>
* lib/gdb.exp (get_compiler_info): Use log_file -info and
restore from that.
I noticed a large (100MB) restore took hours to complete. The problem
is memory_xfer_partial repeatedly mallocs and memcpys the entire
100MB buffer for breakpoint shadow handling only to find a small
portion of it is actually written.
The testcase that originally took hours now takes 50 seconds.
gdb/
2013-07-29 Anton Blanchard <anton@samba.org>
* target.c (memory_xfer_partial): Cap write to 4KB.
As discussed on the GDB ML[1], libc probes for longjmp were not being
loaded if a custom <arch>_get_longjmp_target function was not
implemented.
This is trivially fixed by moving the 'if (!gdbarch_get_longjmp_target_p
(gdbarch))' down, just bellow libc probe code and above the per-objfile
cache lookup.
While the condition could also be removed altogether with no
side-effects, it is in fact an optimization to avoid searching for
symbols if the arch doesn't provide support for get_longjmp_target().
This has been tested on PPC and PPC64.
[1] https://sourceware.org/ml/gdb/2013-10/msg00191.html
gdb/
2013-11-01 Tiago Stürmer Daitx <tdaitx@linux.vnet.ibm.com>
* breakpoint.c (create_longjmp_master_breakpoint): Allow libc
probe scan even when the arch provides no get_longjmp_target.
IMO, it doesn't make sense to map random syscall, fork, etc. events to
GDB_SIGNAL_TRAP, and possible have the debuggee see that trap. This
just seems conceptually wrong to me - these aren't real signals a
debuggee would ever see. In fact, when stopped for those events, on
Linux, the debuggee isn't in a signal-stop -- there's no way to
resume-and-deliver-signal at that point, for example. E.g., when
stopped at a fork event:
(gdb) catch fork
Catchpoint 2 (fork)
(gdb) c
Continuing.
Catchpoint 2 (forked process 4570), 0x000000323d4ba7c4 in __libc_fork () at ../nptl/sysdeps/unix/sysv/linux/fork.c:131
131 pid = ARCH_FORK ();
(gdb) set debug infrun 1
(gdb) signal SIGTRAP
Continuing with signal SIGTRAP.
infrun: clear_proceed_status_thread (process 4566)
infrun: proceed (addr=0xffffffffffffffff, signal=5, step=0)
infrun: resume (step=0, signal=5), trap_expected=0, current thread [process 4566] at 0x323d4ba7c4
infrun: wait_for_inferior ()
infrun: target_wait (-1, status) =
infrun: 4566 [process 4566],
infrun: status->kind = exited, status = 0
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_EXITED
[Inferior 1 (process 4566) exited normally]
infrun: stop_stepping
(gdb)
Note the signal went nowhere. It was swallowed.
Resuming with a SIGTRAP from a syscall event does queue the signal,
but doesn't deliver it immediately, like "signal SIGTRAP" from a real
signal would. It's still an artificial SIGTRAP:
(gdb) catch syscall
Catchpoint 2 (any syscall)
(gdb) c
Continuing.
Catchpoint 2 (call to syscall clone), 0x000000323d4ba7c4 in __libc_fork () at ../nptl/sysdeps/unix/sysv/linux/fork.c:131
131 pid = ARCH_FORK ();
(gdb) set debug infrun 1
(gdb) signal SIGTRAP
Continuing with signal SIGTRAP.
infrun: clear_proceed_status_thread (process 4622)
infrun: proceed (addr=0xffffffffffffffff, signal=5, step=0)
infrun: resume (step=0, signal=5), trap_expected=0, current thread [process 4622] at 0x323d4ba7c4
infrun: wait_for_inferior ()
infrun: target_wait (-1, status) =
infrun: 4622 [process 4622],
infrun: status->kind = exited syscall
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_SYSCALL_RETURN
infrun: syscall number = '56'
infrun: BPSTAT_WHAT_STOP_NOISY
infrun: stop_stepping
Catchpoint 2 (returned from syscall clone), 0x000000323d4ba7c4 in __libc_fork () at ../nptl/sysdeps/unix/sysv/linux/fork.c:131
131 pid = ARCH_FORK ();
(gdb) c
Continuing.
infrun: clear_proceed_status_thread (process 4622)
infrun: proceed (addr=0xffffffffffffffff, signal=144, step=0)
infrun: resume (step=0, signal=0), trap_expected=0, current thread [process 4622] at 0x323d4ba7c4
infrun: wait_for_inferior ()
infrun: target_wait (-1, status) =
infrun: 4622 [process 4622],
infrun: status->kind = stopped, signal = SIGTRAP
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x323d4ba7c4
infrun: random signal 5
Program received signal SIGTRAP, Trace/breakpoint trap.
infrun: stop_stepping
0x000000323d4ba7c4 in __libc_fork () at ../nptl/sysdeps/unix/sysv/linux/fork.c:131
131 pid = ARCH_FORK ();
(gdb)
In all the above, I used 'signal SIGTRAP' to emulate 'handle SIGTRAP
pass'. As described in "keep_going", 'handle SIGTRAP pass' does have
its place:
/* Do not deliver GDB_SIGNAL_TRAP (except when the user
explicitly specifies that such a signal should be delivered
to the target program). Typically, that would occur when a
user is debugging a target monitor on a simulator: the target
monitor sets a breakpoint; the simulator encounters this
breakpoint and halts the simulation handing control to GDB;
GDB, noting that the stop address doesn't map to any known
breakpoint, returns control back to the simulator; the
simulator then delivers the hardware equivalent of a
GDB_SIGNAL_TRAP to the program being debugged. */
... and I've made use of that myself when implementing/debugging
stubs/monitors. But in these cases, treating these events as SIGTRAP
possibly injects signals in the debuggee they'd never see otherwise,
because you need to use ptrace to enable these special events, which
aren't real signals.
There's more. Take this bit of handle_inferior_event, where we
determine whether a real signal (TARGET_WAITKIND_STOPPED) was random
or not:
if (ecs->event_thread->suspend.stop_signal == GDB_SIGNAL_TRAP)
ecs->random_signal
= !((bpstat_explains_signal (ecs->event_thread->control.stop_bpstat,
GDB_SIGNAL_TRAP)
!= BPSTAT_SIGNAL_NO)
|| stopped_by_watchpoint
|| ecs->event_thread->control.trap_expected
|| (ecs->event_thread->control.step_range_end
&& (ecs->event_thread->control.step_resume_breakpoint
== NULL)));
else
{
enum bpstat_signal_value sval;
sval = bpstat_explains_signal (ecs->event_thread->control.stop_bpstat,
ecs->event_thread->suspend.stop_signal);
ecs->random_signal = (sval == BPSTAT_SIGNAL_NO);
if (sval == BPSTAT_SIGNAL_HIDE)
ecs->event_thread->suspend.stop_signal = GDB_SIGNAL_TRAP;
}
Note that the
if (sval == BPSTAT_SIGNAL_HIDE)
ecs->event_thread->suspend.stop_signal = GDB_SIGNAL_TRAP;
bit is only reacheable for signals != GDB_SIGNAL_TRAP. AFAICS, sval
can only be BPSTAT_SIGNAL_HIDE if nothing in the bpstat returns
BPSTAT_SIGNAL_PASS. So that excludes a "catch signal" for the signal
in question in the bpstat. All other catchpoints that aren't based on
breakpoints behind the scenes call process_event_stop_test directly
(don't pass through here) (well, almost all: TARGET_WAITKIND_LOADED
does have a fall through, but only for STOP_QUIETLY or
STOP_QUIETLY_NO_SIGSTOP, which still return before this code is
reached). Catchpoints that are implemented as breakpoints behind the
scenes can only appear in the bpstat if the signal was GDB_SIGNAL_TRAP
(bkpt_breakpoint_hit returns false otherwise). So that leaves a
target reporting a hardware watchpoint hit with a signal other than
GDB_SIGNAL_TRAP. And even then it looks quite wrong to me to
magically convert the signal into a GDB_SIGNAL_TRAP here too -- if the
user has set SIGTRAP to "handle pass", the program will see a trap
that gdb invented, not one the program would ever see without gdb in
the picture.
Tested on x86_64 Fedora 17.
gdb/
2013-10-31 Pedro Alves <palves@redhat.com>
* infrun.c (handle_syscall_event): Don't set or clear stop_signal.
(handle_inferior_event) <TARGET_WAITKIND_FORKED,
TARGET_WAITKIND_VFORKED>: Don't set stop_signal to
GDB_SIGNAL_TRAP, or clear it. Pass GDB_SIGNAL_0 to
bpstat_explains signal, instead of GDB_SIGNAL_TRAP.
<bpstat handling>: If the bpstat chain wants the signal to be
hidden, then set stop_signal to GDB_SIGNAL_0 instead of
GDB_SIGNAL_TRAP.
Correct the patterns in the gdb_test_multiple invocation.
testsuite/
2013-10-30 Andreas Arnez <arnez@linux.vnet.ibm.com>
* gdb.arch/s390-multiarch.exp (test_linux_v2): Add $gdb_prompt to
the patterns in gdb_test_multiple.
As suggested before, rename the S/390-related source files (tdep and nat)
such that "-linux-" occurs in the file name, like with other GNU/Linux
targets. Since no other operating system is currently supported by GDB
on this architecture, this isn't strictly necessary. But the old names
sometimes caused GDB contributors to miss these files when performing a
change that affects all GNU/Linux targets. The latest such incident was
observed here:
https://sourceware.org/ml/gdb-patches/2013-09/msg00619.html
gdb/
2013-10-30 Andreas Arnez <arnez@linux.vnet.ibm.com>
* s390-tdep.h: Rename to...
* s390-linux-tdep.h: ...here.
* s390-tdep.c: Rename to...
* s390-linux-tdep.c: ...here. Adjust #include.
* s390-nat.c: Rename to...
* s390-linux-nat.c: ...here. Adjust #include.
* config/s390/s390.mh: Rename to...
* config/s390/linux.mh: ...here. Reflect rename s390-nat.o ->
s390-linux-nat.o.
* configure.host: Reflect host rename "s390" -> "linux".
* configure.tgt: Reflect rename s390-tdep.o -> s390-linux-tdep.o.
* Makefile.in (ALL_TARGET_OBS): Likewise.
(HFILES_NO_SRCDIR): Reflect rename s390-tdep.h ->
s390-linux-tdep.h.
(ALLDEPFILES): Reflect rename of .c files.
gdb/
2013-10-30 Andreas Arnez <arnez@linux.vnet.ibm.com>
* s390-nat.c: Whitespace cleanup.
* s390-tdep.c: Likewise.
* s390-tdep.h: Remove empty line at end of file.
I tried to build gdb on the AIX machine in the GCC compile farm
(gcc111), but it failed in a couple of spots because gdb uses "reg" as
a variable name and the AIX <curses.h> defines "reg" to "register".
I saw that we already had a workaround for this lurking in utils.c, so
I just moved that to gdb_curses.h.
This fixed the problem on AIX and still builds on x86-64 Fedora 18.
2013-10-29 Tom Tromey <tromey@redhat.com>
* utils.c (reg): Move undefinition...
* gdb_curses.h: ... here. Update comment to mention AIX.