Commit Graph

34491 Commits

Author SHA1 Message Date
Pedro Alves 6d03af93d2 Make 'make check TESTS="..."' work from GDB's build dir.
I noticed 'make check TESTS="..."' works when ran from gdb/testsuite/,
but TESTS is ignored when "make check" is ran from gdb/.

The issue is that TESTS isn't being passed to the testsuite subdir
make invocation.

gdb/
2014-03-12  Pedro Alves  <palves@redhat.com>

	* Makefile.in (TARGET_FLAGS_TO_PASS): Add TESTS.
2014-03-12 19:52:00 +00:00
Tom Tromey b3ccfe11d3 fix regressions with target-async
A patch in the target cleanup series caused a regression when using
record with target-async.  Version 4 of the patch is here:

    https://sourceware.org/ml/gdb-patches/2014-03/msg00159.html

The immediate problem is that record supplies to_can_async_p and
to_is_async_p methods, but does not supply a to_async method.  So,
when target-async is set, record claims to support async -- but if the
underlying target does not support async, then the to_async method
call will end up in that method's default implementation, namely
tcomplain.

This worked previously because the record target used to provide a
to_async method; one that (erroneously, only at push time) checked the
other members of the target stack, and then simply dropped to_async
calls in the "does not implement async" case.

My first thought was to simply drop tcomplain as the default for
to_async.  This works, but Pedro pointed out that the only reason
record has to supply to_can_async_p and to_is_async_p is that these
default to using the find_default_run_target machinery -- and these
defaults are only needed by "run" and "attach".

So, a nicer solution presents itself: change run and attach to
explicitly call into the default run target when needed; and change
to_is_async_p and to_can_async_p to default to "return 0".  This makes
the target stack simpler to use and lets us remove the method
implementations from record.  This is also in harmony with other plans
for the target stack; namely trying to reduce the impact of
find_default_run_target.  This approach makes it clear that
find_default_is_async_p is not needed -- it is asking whether a target
that may not even be pushed is actually async, which seems like a
nonsensical question.

While an improvement, this approach proved to introduce the same bug
when using the core target.  Looking a bit deeper, the issue is that
code in "attach" and "run" may need to use either the current target
stack or the default run target -- but different calls into the target
API in those functions could wind up querying different targets.

This new patch makes the target to use more explicit in "run" and
"attach".  Then these commands explicitly make the needed calls
against that target.  This ensures that a single target is used for
all relevant operations.  This lets us remove a couple find_default_*
functions from various targets, including the dummy target.  I think
this is a decent understandability improvement.

One issue I see with this patch is that the new calls in "run" and
"attach" are not very much like the rest of the target API.  I think
fundamentally this is due to bad factoring in the target API, which
may need to be fixed for multi-target.  Tackling that seemed ambitious
for a regression fix.

While working on this I noticed that there don't seem to be any test
cases that involve both target-async and record, so this patch changes
break-precsave.exp to add some.  It also changes corefile.exp to add
some target-async tests; these pass with current trunk and with this
patch applied, but fail with the v1 patch.

This patch differs from v4 in that it moves initialization of
to_can_async_p and to_supports_non_stop into inf-child, adds some
assertions to complete_target_initialization, and adds some comments
to target.h.

Built and regtested on x86-64 Fedora 20.

2014-03-12  Tom Tromey  <tromey@redhat.com>

	* inf-child.c (return_zero): New function.
	(inf_child_target): Set to_can_async_p, to_supports_non_stop.
	* aix-thread.c (aix_thread_inferior_created): New function.
	(aix_thread_attach): Remove.
	(init_aix_thread_ops): Don't set to_attach.
	(_initialize_aix_thread): Register inferior_created observer.
	* corelow.c (init_core_ops): Don't set to_attach or
	to_create_inferior.
	* exec.c (init_exec_ops): Don't set to_attach or
	to_create_inferior.
	* infcmd.c (run_command_1): Use find_run_target.  Make direct
	target calls.
	(attach_command): Use find_attach_target.  Make direct target
	calls.
	* record-btrace.c (init_record_btrace_ops): Don't set
	to_create_inferior.
	* record-full.c (record_full_can_async_p, record_full_is_async_p):
	Remove.
	(init_record_full_ops, init_record_full_core_ops): Update.  Don't
	set to_create_inferior.
	* target.c (complete_target_initialization): Add assertion.
	(target_create_inferior): Remove.
	(find_default_attach, find_default_create_inferior): Remove.
	(find_attach_target, find_run_target): New functions.
	(find_default_is_async_p, find_default_can_async_p)
	(target_supports_non_stop, target_attach): Remove.
	(init_dummy_target): Don't set to_create_inferior or
	to_supports_non_stop.
	* target.h (struct target_ops) <to_attach>: Add comment.  Remove
	TARGET_DEFAULT_FUNC.
	<to_create_inferior>: Add comment.
	<to_can_async_p, to_is_async_p, to_supports_non_stop>: Use
	TARGET_DEFAULT_RETURN.
	<to_can_async_p, to_supports_non_stop, to_can_run>: Add comments.
	(find_attach_target, find_run_target): Declare.
	(target_create_inferior): Remove.
	(target_has_execution_1): Update comment.
	(target_supports_non_stop): Remove.
	* target-delegates.c: Rebuild.

2014-03-12  Tom Tromey  <tromey@redhat.com>

	* gdb.base/corefile.exp (corefile_test_run, corefile_test_attach):
	New procs.  Add target-async tests.
	* gdb.reverse/break-precsave.exp (precsave_tests): New proc.
	Add target-async tests.
2014-03-12 13:05:58 -06:00
Andreas Arnez 646f441776 Fix dw2-ifort-parameter.exp on PPC64
On PPC64, 'func' and 'main' are function descriptors and don't point
to the actual code.  Thus the usage of these symbols in the DWARF
assembler source was broken.  The patch introduces new labels
func_start and func_end for this purpose.
2014-03-12 16:22:19 +01:00
Andreas Arnez 288c211f8c Migrate dw2-ifort-parameter.exp to Dwarf::assemble
A "side effect" of the migration to Dwarf::assemble is that the DWARF
address size is now automatically adjusted to the target architecture.
The original assembler source hard-coded the DWARF address size to 4,
even on 64-bit architectures.  This address size mismatch caused a
test case failure on s390x due to a wrong result from DW_OP_deref.
2014-03-12 16:22:19 +01:00
Andreas Arnez e0c0f156b4 Exploit 'prepare_for_testing' etc. for 'Dwarf::assemble'-generated files
Now that prepare_for_testing etc. can cope with absolute path names,
this can be exploited for test cases with generated source files.
This is just to simplify the code and shouldn't cause any functional
change.
2014-03-12 16:22:18 +01:00
Andreas Arnez 0e5c45554b gdb.exp: Support absolute path name args in 'prepare_for_testing' etc.
Test cases that produce source files in the build directory have not
been able to use prepare_for_testing and friends.  This was because
build_executable_from_specs unconditionally prepended the source
directory path name to its arguments.
2014-03-12 16:22:18 +01:00
Pedro Alves 91f83b0228 inf-child.h: Update comment.
Like inf-child.c, this file is no longer used exclusively by Unix
targets anymore.

gdb/
2014-03-12  Pedro Alves  <palves@redhat.com>

        * inf-child.h: Update comment to not mention Unix.
2014-03-12 11:55:02 +00:00
Pedro Alves f1aea813c8 inf-child.c: Update comments.
This file is no longer used exclusively by Unix targets anymore.

gdb/
2014-03-12  Pedro Alves  <palves@redhat.com>

	* inf-child.c: Update top comment to not mention Unix.  Add
	generic comment describing how this target is meant to be used.
	(inf_child_post_attach, inf_child_post_startup_inferior)
	(inf_child_follow_fork, inf_child_pid_to_exec_file): Don't mention
	Unix in comment.
2014-03-12 11:33:59 +00:00
Pedro Alves ee8e9165af Make the nto-procfs.c target inherit inf-child.c.
So that all native targets inherit a single "superclass".

Target methods that are set to or do the same as inf-child.c's are
removed.

Not tested.

gdb/
2014-03-12  Pedro Alves  <palves@redhat.com>

	* nto-procfs.c: Include inf-child.h.
	(procfs_ops): Delete global.
	(procfs_can_run): Delete method.
	(procfs_detach, procfs_mourn_inferior): Unpush the passed in
	target pointer instead of referencing procfs_ops.
	(procfs_prepare_to_store): Delete.
	(init_procfs_ops): Delete function.
	(procfs_target): New function, based on init_procfs_ops, but
	inherit inf_child_target.
	(_initialize_procfs): Use procfs_target.
2014-03-12 11:24:41 +00:00
Pedro Alves 51a9c8c5f8 Make the windows-nat.c target inherit inf-child.c.
So that all native targets inherit a single "superclass".

Target methods that are set to or do the same as inf-child.c's are
removed.

Tested by cross building on Fedora 17, and then confirming that

./gdb.exe ./gdb.exe -ex "set pagination off" -ex "start"

under Wine still works.

Also, Joel tested this with Adacore's internal testsuite.

gdb/
2014-03-12  Pedro Alves  <palves@redhat.com>

	* windows-nat.c: Include inf-child.h.
	(windows_ops): Delete global.
	(windows_open, windows_prepare_to_store, windows_can_run): Delete
	methods.
	(init_windows_ops): Delete function.
	(windows_target): New function, based on init_windows_ops, but
	inherit inf_child_target.
	(_initialize_windows_nat): Use windows_target.  Install x86
	specific target methods here.
2014-03-12 11:21:47 +00:00
Doug Evans c1966e261a * guile/guile.c (call_initialize_gdb_module): New function.
(initialize_guile): Replace call to scm_init_guile with call to
	scm_with_guile.
2014-03-11 00:04:53 -04:00
Joel Brobecker 023db19c6b Missing space before '(' in ada-lang.c::ada_evaluate_subexp
gdb/ChangeLog:

        * ada-lang.c (ada_evaluate_subexp): Add missing space before '('
        in call to TYPE_CODE macro.
2014-03-10 14:46:55 +01:00
Joel Brobecker 8668be63cf Minor style change in the previous commits' ChangeLog entry. 2014-03-10 14:44:30 +01:00
Jerome Guitton 5ec18f2b48 [Ada] Full view of tagged type with ptype
When evaluating an expression, if it is of a tagged type, GDB reads
the tag in memory and deduces the full view. At parsing time, however,
this operation is done only in the case of OP_VAR_VALUE. ptype does
not go through a full evaluation of expressions so it may return some
odd results:

 (gdb) print c.menu_name
 $1 = 0x0
 (gdb) ptype $
 type = system.strings.string_access
 (gdb) ptype c.menu_name
 type = <void>

This change removes this peculiarity by extending the tag resolution
to UNOP_IND and STRUCTOP_STRUCT. As in the case of OP_VAR_VALUE, this
implies switching from EVAL_AVOID_SIDE_EFFECTS to EVAL_NORMAL when a
tagged type is dereferenced.

gdb/
	* ada-lang.c (ada_evaluate_subexp): Resolve tagged types to
	full view in the case of UNOP_IND and STRUCTOP_STRUCT.

gdb/testsuite/

	* gdb.ada/tagged_access: New testcase.
2014-03-10 14:40:35 +01:00
Hui Zhu 7d03f2eb64 Remove "hardware" from comments of "target_insert_breakpoint"
This function is for simple breakpoint.  So I post a patch to remove "hardware".

Thanks,
Hui

2014-03-10  Hui Zhu  <hui@codesourcery.com>

	* target.h (target_insert_breakpoint): Remove "hardware" from its
	comments.
2014-03-10 15:42:26 +08:00
Doug Evans c5164cbc32 * dwarf2read.c (read_str_index): Rename local dwo_name to objf_name. 2014-03-07 17:33:12 -08:00
Doug Evans c4a3fee29d read_cutu_die_from_dwo: Misc minor cleanups.
* dwarf2read.c (read_cutu_die_from_dwo): Fix function comment.
	Remove unused local comp_dir_attr.  Assert exactly one of
	stub_comp_unit_die, stub_comp_dir is non-NULL.
2014-03-07 16:38:26 -08:00
Joel Brobecker 3156469ca8 target.h: Expands complete_target_initialization and add_target comments.
Expand a bit the comments to answer some questions I had when looking
at why a target of mine would not have some default methods set.

gdb/ChangeLog:

        * target.h (complete_target_initialization, add_target):
        Add comment.
2014-03-07 16:26:35 -08:00
Pedro Alves c1a7b7c6f8 Make the go32-nat.c target inherit inf-child.c.
So that all native targets inherit a single "superclass".

Target methods that are set to or do the same as inf-child.c's are
removed.

Tested by cross building on Fedora 17.

gdb/
2014-03-07  Pedro Alves  <palves@redhat.com>

	* go32-nat.c: Include inf-child.h.
	(go32_ops): Delete global.
	(go32_close, go32_detach, go32_prepare_to_store, go32_can_run):
	Delete methods.
	(go32_create_inferior): Push the passed in target pointer instead
	of referencing go32_ops.
	(init_go32_ops): Delete function.  Moved parts to _initialize_go32_nat.
	(go32_target): New function, based on init_go32_ops, but inherit
	inf_child_target.
	(_initialize_go32_nat): Use go32_target.  Move parts of
	init_go32_ops here.
2014-03-07 15:36:50 +00:00
Markus Metzger 847fc4f296 btrace, test: fix gdb.btrace/data test
The format of the output changed.  Fix the test.

testsuite/
	* gdb.btrace/data.exp: Update expected output.
2014-03-07 10:05:42 +01:00
Joel Brobecker d3c1a85fda Fix sol-thread.c build failure.
Some updates where needed after the minimal symbol handling got changed
a little. This patch makes those changes.

gdb/ChangeLog:

        * sol-thread.c: #include "symtab.h", "minsym.h" and "objfiles.h".
        (ps_pglobal_lookup): Use BMSYMBOL_VALUE_ADDRESS instead of
        SYMBOL_VALUE_ADDRESS.
        (info_cb): MSYMBOL_PRINT_NAME instead of SYMBOL_PRINT_NAME.
2014-03-06 08:04:58 -08:00
Yao Qi 5fa1d40e97 Remove argument optional_p from get_tracepoint_by_number
This patch is to remove parameter optional_p as it is always true,
in order to simplify get_tracepoint_by_number.

'optional_p' was added by this change,

1999-11-18  Tom Tromey  <tromey@cygnus.com>

	* tracepoint.h (get_tracepoint_by_number): Updated
	declaration.
	* tracepoint.c (trace_pass_command): Better error message.
	Fixed logic when `all' not specified.
	(get_tracepoint_by_number): Added `optional_p' argument.  Fixed
	all callers.

but after this patch,

 FYI: remove `static's from cli-utils.c
 https://sourceware.org/ml/gdb-patches/2011-03/msg00636.html

'optional_p' passed to get_tracepoint_by_number become always true.

gdb:

2014-03-06  Yao Qi  <yao@codesourcery.com>

	* breakpoint.c (get_tracepoint_by_number): Remove argument
	optional_p.  All callers updated.  Adjust comments.  Update
	output message.
	* breakpoint.h (get_tracepoint_by_number): Update declaration.
2014-03-06 15:03:38 +08:00
Yao Qi 0c13193f33 Handle parse number error in goto_bookmark_command
In GDB mainline, the error message for goto-bookmark
isn't perfect.

 (gdb) goto-bookmark 1.1
 goto-bookmark: no bookmark found for ''.

This patch tweaks the error message by checking the return value of
get_number.  With patch applied, it becomes:

 (gdb) goto-bookmark 1.1
 goto-bookmark: invalid bookmark number '1.1'.

gdb:

2014-03-06  Yao Qi  <yao@codesourcery.com>

	* reverse.c (goto_bookmark_command): Add local 'p'.  Emit error
	early if get_number returns zero.  Use 'p' instead of 'args'.
2014-03-06 15:03:30 +08:00
Yao Qi 2217da06d8 Add a newline in output messages
Hi,
GDB prints two warnings in one single line, as below:

 (gdb) p 1.2
 $1 = 1.2
 (gdb) enable $1.2
 History value must have integer type.Bad breakpoint number '$1'

This patch adds '\n' at the end of message.

gdb:

2014-03-06  Yao Qi  <yao@codesourcery.com>

	* cli/cli-utils.c (get_number_trailer): Add '\n' at the end of
	message.
2014-03-06 14:36:54 +08:00
Yao Qi cc3da68801 Fix PR16508
This patch fixes PR16508, which is about MI "-trace-find frame-number 0"
behaves differently from CLI "tfind 0".  In CLI, we check both
status->running and status->filename, but in MI, we only check
status->running, which looks wrong to me.  This patch moves the code
of checking to a new function check_trace_running, and use it in
both CLI and MI.

This patch also adds a test case pr16508.exp, which fails without this
fix, and passes with the fix applied.

  FAIL: gdb.trace/pr16508.exp: interpreter-exec mi "-trace-find frame-number 0"

gdb:

2014-03-06  Yao Qi  <yao@codesourcery.com>

	PR breakpoints/16508
	* tracepoint.c (check_trace_running): New function.
	(trace_find_command): Move code to check_trace_running and
	call check_trace_running.
	(trace_find_pc_command): Likewise.
	(trace_find_tracepoint_command): Likewise.
	(trace_find_line_command): Likewise.
	(trace_find_range_command): Likewise.
	* tracepoint.h (check_trace_running): Likewise.
	* mi/mi-main.c (mi_cmd_trace_find): Call check_trace_running.

gdb/testsuite:

2014-03-06  Yao Qi  <yao@codesourcery.com>

	* gdb.trace/pr16508.exp: New file.
2014-03-06 11:33:06 +08:00
Yao Qi 6a5f844b29 Change the default implementation of to_traceframe_info to tcomplain
This patch is to change the default implementation of to_traceframe_info
from 'return NULL' to tcomplain, which is intended.  If new target
supports tracepoint, this method should be implemented, otherwise,
an error is thrown.

gdb:

2014-03-06  Yao Qi  <yao@codesourcery.com>

	* target.h (struct target_ops) <to_traceframe_info>: Use
	TARGET_DEFAULT_NORETURN (tcomplain ()).
	* target-delegates.c: Regenerated.
2014-03-06 09:39:50 +08:00
Pedro Alves 0f26cec1fd PR gdb/16575: stale breakpoint instructions in the code cache
In non-stop mode, or rather, breakpoints always-inserted mode, the
code cache can easily end up with stale breakpoint instructions:

All it takes is filling a cache line when breakpoints already exist in
that memory region, and then delete the breakpoint.

Vis. (from the new test):

 (gdb) set breakpoint always-inserted on
 (gdb) b 23
 Breakpoint 2 at 0x400540: file ../../../src/gdb/testsuite/gdb.base/breakpoint-shadow.c, line 23.
 (gdb) b 24
 Breakpoint 3 at 0x400547: file ../../../src/gdb/testsuite/gdb.base/breakpoint-shadow.c, line 24.
 disass main
 Dump of assembler code for function main:
    0x000000000040053c <+0>:     push   %rbp
    0x000000000040053d <+1>:     mov    %rsp,%rbp
 => 0x0000000000400540 <+4>:     movl   $0x1,-0x4(%rbp)
    0x0000000000400547 <+11>:    movl   $0x2,-0x4(%rbp)
    0x000000000040054e <+18>:    mov    $0x0,%eax
    0x0000000000400553 <+23>:    pop    %rbp
    0x0000000000400554 <+24>:    retq
 End of assembler dump.

So far so good.  Now flush the code cache:

 (gdb) set code-cache off
 (gdb) set code-cache on

Requesting a disassembly works as expected, breakpoint shadowing is
applied:

 (gdb) disass main
 Dump of assembler code for function main:
    0x000000000040053c <+0>:     push   %rbp
    0x000000000040053d <+1>:     mov    %rsp,%rbp
 => 0x0000000000400540 <+4>:     movl   $0x1,-0x4(%rbp)
    0x0000000000400547 <+11>:    movl   $0x2,-0x4(%rbp)
    0x000000000040054e <+18>:    mov    $0x0,%eax
    0x0000000000400553 <+23>:    pop    %rbp
    0x0000000000400554 <+24>:    retq
 End of assembler dump.

However, now delete the breakpoints:

 (gdb) delete
 Delete all breakpoints? (y or n) y

And disassembly shows the old breakpoint instructions:

 (gdb) disass main
 Dump of assembler code for function main:
    0x000000000040053c <+0>:     push   %rbp
    0x000000000040053d <+1>:     mov    %rsp,%rbp
 => 0x0000000000400540 <+4>:     int3
    0x0000000000400541 <+5>:     rex.RB cld
    0x0000000000400543 <+7>:     add    %eax,(%rax)
    0x0000000000400545 <+9>:     add    %al,(%rax)
    0x0000000000400547 <+11>:    int3
    0x0000000000400548 <+12>:    rex.RB cld
    0x000000000040054a <+14>:    add    (%rax),%al
    0x000000000040054c <+16>:    add    %al,(%rax)
    0x000000000040054e <+18>:    mov    $0x0,%eax
    0x0000000000400553 <+23>:    pop    %rbp
    0x0000000000400554 <+24>:    retq
 End of assembler dump.

Those breakpoint instructions are no longer installed in target memory
they're stale in the code cache.  Easily confirmed by just disabling
the code cache:

 (gdb) set code-cache off
 (gdb) disass main
 Dump of assembler code for function main:
    0x000000000040053c <+0>:     push   %rbp
    0x000000000040053d <+1>:     mov    %rsp,%rbp
 => 0x0000000000400540 <+4>:     movl   $0x1,-0x4(%rbp)
    0x0000000000400547 <+11>:    movl   $0x2,-0x4(%rbp)
    0x000000000040054e <+18>:    mov    $0x0,%eax
    0x0000000000400553 <+23>:    pop    %rbp
    0x0000000000400554 <+24>:    retq
 End of assembler dump.


I stumbled upon this when writing a patch to infrun.c, that made
handle_inferior_event & co fill in the cache before breakpoints were
removed from the target.  Recall that wait_for_inferior flushes the
dcache for every event.  So in that case, always-inserted mode was not
necessary to trigger this.  It's just a convenient way to expose the
issue.

The dcache works at the raw memory level.  We need to update it
whenever memory is written, no matter what kind of target memory
object was originally passed down by the caller.  The issue is that
the dcache update code isn't reached when a caller explicitly writes
raw memory.  Breakpoint insertion/removal is one such case --
mem-break.c uses target_write_read_memory/target_write_raw_memory.

The fix is to move the dcache update code from memory_xfer_partial_1
to raw_memory_xfer_partial so that it's always reachable.

When we do that, we can actually simplify a series of things.
memory_xfer_partial_1 no longer needs to handle writes for any kind of
memory object, and therefore dcache_xfer_memory no longer needs to
handle writes either.  So the latter (dcache_xfer_memory) and its
callees can be simplified to only care about reads.  While we're
touching dcache_xfer_memory's prototype, might as well rename it to
reflect that fact that it only handles reads, and make it follow the
new target_xfer_status/xfered_len style.  This made me notice that
dcache_xfer_memory loses the real error status if a memory read fails:
we could have failed to read due to TARGET_XFER_E_UNAVAILABLE, for
instance, but we always return TARGET_XFER_E_IO, hence the FIXME note.
I felt that fixing that fell out of the scope of this patch.

Currently dcache_xfer_memory handles the case of a write failing.  The
whole cache line is invalidated when that happens.  However,
dcache_update, the sole mechanism for handling writes that will remain
after the patch, does not presently handle that scenario.  That's a
bug.  The patch makes it handle that, by passing down the
target_xfer_status status from the caller, so that it can better
decide what to do itself.  While I was changing the function's
prototype, I constified the myaddr parameter, getting rid of the need
for the cast as seen in its existing caller.

Tested on x86_64 Fedora 17, native and gdbserver.

gdb/
2014-03-05  Pedro Alves  <palves@redhat.com>

	PR gdb/16575
	* dcache.c (dcache_poke_byte): Constify ptr parameter.  Return
	void.  Update comment.
	(dcache_xfer_memory): Delete.
	(dcache_read_memory_partial): New, based on the read bits of
	dcache_xfer_memory.
	(dcache_update): Add status parameter.  Use ULONGEST for len, and
	adjust.  Discard cache lines if the reason for the update was
	error.
	* dcache.h (dcache_xfer_memory): Delete declaration.
	(dcache_read_memory_partial): New declaration.
	(dcache_update): Update prototype.
	* target.c (raw_memory_xfer_partial): Update the dcache here.
	(memory_xfer_partial_1): Don't handle dcache writes here.

gdb/testsuite/
2014-03-05  Pedro Alves  <palves@redhat.com>

	PR gdb/16575
	* gdb.base/breakpoint-shadow.exp (compare_disassembly): New
	procedure.
	(top level): Adjust to use it.  Add tests that exercise breakpoint
	interaction with the code-cache.
2014-03-05 14:18:28 +00:00
Mike Frysinger b2b255bdf3 sim: constify prog_name
There's no need for the prog_name handed down to the core to be mutable,
so add const markings to it and all the related funcs.
2014-03-05 01:42:44 -05:00
Tom Tromey 5d9cf8a4d3 move probes to be per-bfd
This patch moves the probe data from the objfile to the per-BFD
object.  This lets the probes be shared between different inferiors
(and different objfiles when dlmopen is in use, should gdb ever handle
that).

2014-03-03  Tom Tromey  <tromey@redhat.com>

	* elfread.c (probe_key): Change to bfd_data.
	(elf_get_probes, probe_key_free, _initialize_elfread): Probes are
	now per-BFD, not per-objfile.
	* stap-probe.c (stap_probe_destroy): Update comment.
	(handle_stap_probe): Allocate on the per-BFD obstack.
2014-03-03 12:47:25 -07:00
Tom Tromey 729662a522 change probes to be program-space-independent
This changes the probes to be independent of the program space.

After this, when a probe's address is needed, it is determined by
applying offsets at the point of use.

This introduces a bound_probe object, similar to bound minimal
symbols.  Objects of this type are used when it's necessary to pass a
probe and its corresponding objfile.

This removes the backlink from probe to objfile, which was primarily
used to fetch the architecture to use.

This adds a get_probe_address function which calls a probe method to
compute the probe's relocated address.  Similarly, it adds an objfile
parameter to the semaphore methods so they can do the relocation
properly as well.

2014-03-03  Tom Tromey  <tromey@redhat.com>

	* break-catch-throw.c (fetch_probe_arguments): Use bound probes.
	* breakpoint.c (create_longjmp_master_breakpoint): Use
	get_probe_address.
	(add_location_to_breakpoint, bkpt_probe_insert_location)
	(bkpt_probe_remove_location): Update.
	* breakpoint.h (struct bp_location) <probe>: Now a bound_probe.
	* elfread.c (elf_symfile_relocate_probe): Remove.
	(elf_probe_fns): Update.
	(insert_exception_resume_breakpoint): Change type of "probe"
	parameter to bound_probe.
	(check_exception_resume): Update.
	* objfiles.c (objfile_relocate1): Don't relocate probes.
	* probe.c (bound_probe_s): New typedef.
	(parse_probes): Use get_probe_address.  Set sal's objfile.
	(find_probe_by_pc): Return a bound_probe.
	(collect_probes): Return a VEC(bound_probe_s).
	(compare_probes): Update.
	(gen_ui_out_table_header_info): Change type of "probes"
	parameter.  Update.
	(info_probes_for_ops): Update.
	(get_probe_address): New function.
	(probe_safe_evaluate_at_pc): Update.
	* probe.h (struct probe_ops) <get_probe_address>: New field.
	<set_semaphore, clear_semaphore>: Add objfile parameter.
	(struct probe) <objfile>: Remove field.
	<arch>: New field.
	<address>: Update comment.
	(struct bound_probe): New.
	(find_probe_by_pc): Return a bound_probe.
	(get_probe_address): Declare.
	* solib-svr4.c (struct probe_and_action) <address>: New field.
	(hash_probe_and_action, equal_probe_and_action): Update.
	(register_solib_event_probe): Add address parameter.
	(solib_event_probe_at): Update.
	(svr4_create_probe_breakpoints): Add objfile parameter.  Use
	get_probe_address.
	* stap-probe.c (struct stap_probe) <sem_addr>: Update comment.
	(stap_get_probe_address): New function.
	(stap_can_evaluate_probe_arguments, compute_probe_arg)
	(compile_probe_arg): Update.
	(stap_set_semaphore, stap_clear_semaphore): Compute semaphore's
	address.
	(handle_stap_probe): Don't relocate the probe.
	(stap_relocate): Remove.
	(stap_gen_info_probes_table_values): Update.
	(stap_probe_ops): Remove stap_relocate.
	* symfile-debug.c (debug_sym_relocate_probe): Remove.
	(debug_sym_probe_fns): Update.
	* symfile.h (struct sym_probe_fns) <sym_relocate_probe>: Remove.
	* symtab.c (init_sal): Use memset.
	* symtab.h (struct symtab_and_line) <objfile>: New field.
	* tracepoint.c (start_tracing, stop_tracing): Update.
2014-03-03 12:47:20 -07:00
Tom Tromey ff8879201a comment fixes
This fixes up a few mildly erroneous comments in probe.h.

2014-03-03  Tom Tromey  <tromey@redhat.com>

	* probe.h (parse_probes, find_probe_by_pc)
	(find_probes_in_objfile): Fix comments.
2014-03-03 12:36:43 -07:00
Doug Evans f0407826d9 * infrun.c (handle_signal_stop): Replace test for
TARGET_WAITKIND_STOPPED with an assert.
2014-03-02 16:51:35 -05:00
Doug Evans 35e6a7111e guile/scm-objfile.c (ofscm_mark_objfile_smob): Fix typo in comment. 2014-03-02 10:30:46 -08:00
Doug Evans 667f9d0bdd guile/lib/gdb/printing.scm (append-pretty-printer!): Fix thinko. 2014-03-02 09:17:46 -08:00
Mark Kettenis dc92ace053 Silence ARI warning.
gdb/ChangeLog:

        * obsd-nat.c: Include "gdb_wait.h" instead of <sys/wait.h>.
2014-03-01 17:13:47 +01:00
Mark Kettenis a900370fa1 Enable rhreads support on OpenBSD/i386.
gdb/ChangeLog:

        * i386obsd-nat.c: Include "obsd-nat.h".
        (_initialize_i386obsd_nat): Call obsd_add_target instead of
        add_target.
        * config/i386/obsd.mh (NATDEPFILES): Add obsd-nat.o.
2014-03-01 15:29:34 +01:00
Mark Kettenis b72a79813d Eliminate pointer signedness warning.
gdb/ChangeLog:

        * i386obsd-nat.c (i386obsd_supply_pcb): Cast 'sf' to 'gdb_byte *'.
2014-03-01 13:10:32 +01:00
Mark Kettenis 8fd408f130 Fix ChangeLog. 2014-03-01 12:03:30 +01:00
Mark Kettenis 96c70abaef Enable rthreads support on OpenBSD/mips64.
gdb/ChangeLog:

        * mips64obsd-nat.c: Include "obsd-nath".
        (_initialize_mips64obsd_nat): Call obsd_add_target instead of
        add_target
        * config/mips/obsd64.mh (NATDEPFILES): Add obsd-nat.o.
2014-03-01 12:00:19 +01:00
Mark Kettenis 874a80af9f Enable rthreads support on OpenBSD/amd64.
gdb/ChangeLog:

        * amd64obsd-nat.c (_initialize_amd64obsd_nat): Call
        obsd_add_target instead of add_target.
        * config/i386/obsd64.mh (NATDEPFILES): Add obsd-nat.o.
2014-03-01 11:49:58 +01:00
Siva Chandra 9cf953733a Remove the unnecesary argument METHOD to valops.c:find_oload_champ.
* valops.c (find_oload_champ): Remove unneccesary argument METHOD.
	(find_overload_match): Update call to find_oload_champ.
	(find_oload_champ_namespace_loop): Likewise
2014-02-28 15:03:22 -08:00
Mark Kettenis 025cac40e2 Add sparc64obsd-nat.c to ALLDEPFILES.
gdb/ChangeLog:

        * Makefile.in (ALLDEPFILES): Add sparc64obsd-nat.c.
2014-02-28 23:23:40 +01:00
Mark Kettenis 1ed586ce1d Enable rthreads supports on OpenBSD/sparc64.
gdb/ChangeLog:

        * configure.host (sparc64-*-openbsd*): Set gdb_host to obsd64.
        * config/sparc/obsd64.mh: New file.
        * sparc64obsd-nat.c: New file.
2014-02-28 23:07:55 +01:00
Mark Kettenis ab4756af55 Stupid git never fucking does what I want! 2014-02-28 22:58:57 +01:00
Mark Kettenis 863e4da4b6 Support rthreads on OpenBSD 5.2 and later.
OpenBSD 5.2 and later have a proper threads implementation based on
kernel threads.  Debugging support is provided through additional
ptrace(2) requests, so this diff extends the generic code in
inf-ptrace.c with OpenBSD-specific code to discover additional threads.

gdb/ChangeLog:

        * obsd-nat.h: New file.
        * obsd-nat.c: New file.
        * Makefile.in (HFILES_NO_SRCDIR): Add obsd-nat.h.
        (ALLDEPFILES): Add obsd-nat.c.
2014-02-28 22:45:51 +01:00
Tom Tromey 89de4da46b constify ui_out_impl
This patch constifies ui_out_impl in struct ui_out, and various
instances of ui_out_impl.

This removes a couple of FIXME comments (near cli_ui_out_impl and
mi_ui_out_impl) that did not make sense to me.

Tested by rebuilding.

2014-02-28  Tom Tromey  <tromey@redhat.com>

	* cli-out.c (cli_ui_out_impl): Now const.  Remove comment.
	* cli-out.h (cli_ui_out_impl): Now const.
	* mi/mi-out.c (mi_ui_out_impl): Now const.  Remove comment.
	* ui-out.c (struct ui_out) <impl>: Now const.
	(default_ui_out_impl): Now const.
	(ui_out_new): Make 'impl' parameter const.
	* ui-out.h (ui_out_new): Update.
2014-02-28 08:51:15 -07:00
Mark Kettenis c725e7b687 Prevent compiler warning.
GCC 4.2.1 complains about first_l_name may be used uninitialized, and my brain
agrees.

gdb/ChangeLog:

        * solib-svr4.c (svr4_read_so_list): Initialize first_l_name to 0.
2014-02-27 21:51:08 +01:00
Mark Kettenis 670b46b3a9 StackGhost cookie is per-process.
gdb/ChangeLog:

        * sparc-nat.c (sparc_xfer_wcookie): Always use process ID.
2014-02-27 21:22:29 +01:00
Jan Kratochvil c91550fc5d Additional PR 8882 fix.
runtest gdb.base/corefile.exp

==23174== ERROR: AddressSanitizer: heap-use-after-free on address 0x604400008c88 at pc 0x68f0be bp 0x7fffae9d7490 sp
0x7fffae9d7480
READ of size 8 at 0x604400008c88 thread T0
    #0 0x68f0bd in svr4_read_so_list (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0x68f0bd)
    #1 0x68f64e in svr4_current_sos_direct (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0x68f64e)
    #2 0x68f757 in svr4_current_sos (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0x68f757)
    #3 0xcebbff in update_solib_list (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xcebbff)
0x604400008c88 is located 8 bytes inside of 1104-byte region [0x604400008c80,0x6044000090d0)
freed by thread T0 here:
    #0 0x7f52677500f9 (/lib64/libasan.so.0+0x160f9)
    #1 0xd2c68a in xfree (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xd2c68a)
    #2 0xceb364 in free_so (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xceb364)
    #3 0xca59f8 in do_free_so (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xca59f8)
    #4 0x93432a in do_my_cleanups (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0x93432a)
    #5 0x934406 in do_cleanups (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0x934406)
    #6 0x68efa9 in svr4_read_so_list (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0x68efa9)

I did not notice it during my review in:
	Re: [PATCH v2] Skip vDSO when reading SO list (PR 8882)
	https://sourceware.org/ml/gdb-patches/2013-09/msg00888.html

gdb/
2014-02-27  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Additional PR 8882 fix.
	* solib-svr4.c (svr4_read_so_list): Change first to first_l_name.

Message-ID: <20140226220918.GA10431@host2.jankratochvil.net>
2014-02-27 21:16:04 +01:00
Pedro Alves 2fa0369e51 Linux waitpid/__WALL emulation wrapper: If WNOHANG is set, don't touch sigprocmask.
Just a small optimization.  No need to block/unblock signals if we're
not going to call sigsuspend.

gdb/
2014-02-27  Pedro Alves  <palves@redhat.com>

	* nat/linux-waitpid.c (my_waitpid): Only block signals if WNOHANG
	isn't set.
2014-02-27 14:44:16 +00:00
Pedro Alves fa96cb382c Teach GDBserver's Linux backend about no unwaited-for children (TARGET_WAITKIND_NO_RESUMED).
GDBserver currently hangs forever in waitpid if the leader thread
exits before other threads, or if all resumed threads exit - e.g.,
next over a thread exit with sched-locking on.  This is exposed by
leader-exit.exp.  leader-exit.exp is part of a series of tests for a
set of related problems.  See
<http://www.sourceware.org/ml/gdb-patches/2011-10/msg00704.html>:

 "
 To recap, on the Linux kernel, ptrace/waitpid don't allow reaping the
 leader thread until all other threads in the group are reaped.  When
 the leader exits, it goes zombie, but waitpid will not return an exit
 status until the other threads are gone.  This is presently exercised
 by the gdb.threads/leader-exit.exp test.  The fix for that test, in
 linux-nat.c:wait_lwp, handles the case where we see the leader gone
 when we're stopping all threads to report an event to some other
 thread to the core.

 (...)

 The latter bit about not blocking if there no resumed threads in the
 process also applies to some other thread exiting, not just the main
 thread.  E.g., this test starts a thread, and runs to a breakpoint in
 that thread:

 ...
 (gdb) c
 Continuing.
 [New Thread 0x7ffff75a4700 (LWP 23397)]
 [Switching to Thread 0x7ffff75a4700 (LWP 23397)]

 Breakpoint 2, thread_a (arg=0x0) at ../../../src/gdb/testsuite/gdb.threads/no-unwaited-for-left.c:28
 28        return 0; /* break-here */
 (gdb) info threads
 * 2 Thread 0x7ffff75a4700 (LWP 23397)  thread_a (arg=0x0) at ../../../src/gdb/testsuite/gdb.threads/no-unwaited-for-left.c:28
   1 Thread 0x7ffff7fcb720 (LWP 23391)  0x00007ffff7bc606d in pthread_join (threadid=140737343276800, thread_return=0x0) at pthread_join.c:89

 The thread will exit as soon as we resume it.  But if we only resume
 that thread, leaving the rest of the threads stopped:

 (gdb) set scheduler-locking on
 (gdb) c
 Continuing.
 ^C^C^C^C^C^C^C^C
 "

This patch fixes the issues by implementing TARGET_WAITKIND_NO_RESUMED
on GDBserver, similarly to what the patch above did for native
Linux GDB.

gdb.threads/leader-exit.exp now passes.

gdb.threads/no-unwaited-for-left.exp now at least errors out instead
of hanging:

 continue
 Continuing.
 warning: Remote failure reply: E.No unwaited-for children left.

 [Thread 15454] #1 stopped.
 0x00000034cf408e60 in pthread_join (threadid=140737353922368, thread_return=0x0) at pthread_join.c:93
 93          lll_wait_tid (pd->tid);
 (gdb) FAIL: gdb.threads/no-unwaited-for-left.exp: continue stops when the main thread exits

The gdb.threads/non-ldr-exc-*.exp tests are skipped because GDBserver
unfortunately doesn't support fork/exec yet, but I'm confident this
fixes the related issues.

I'm leaving modeling TARGET_WAITKIND_NO_RESUMED in the RSP for a
separate pass.

(BTW, in case of error in response to a vCont, it would be better for
GDB to query the target for the current thread, or re-select one,
instead of assuming current inferior_ptid is still the selected
thread.)

This implementation is a little different from GDB's, because I'm
avoiding bringing in more of this broken use of waitpid(PID) into
GDBserver.  Specifically, this avoids waitpid(PID) when stopping all
threads.  There's really no need for wait_for_sigstop to wait for each
LWP in turn.  Instead, with some refactoring, we make it reuse
linux_wait_for_event.

gdb/gdbserver/
2014-02-27  Pedro Alves  <palves@redhat.com>

	PR 12702
	* inferiors.h (A_I_NEXT, ALL_INFERIORS_TYPE, ALL_PROCESSES): New
	macros.
	* linux-low.c (delete_lwp, handle_extended_wait): Add debug
	output.
	(last_thread_of_process_p): Take a PID argument instead of a
	thread pointer.
	(linux_wait_for_lwp): Delete.
	(num_lwps, check_zombie_leaders, not_stopped_callback): New
	functions.
	(linux_low_filter_event): New function, party factored out from
	linux_wait_for_event.
	(linux_wait_for_event): Rename to ...
	(linux_wait_for_event_filtered): ... this.  Add new filter ptid
	argument.  Partly rewrite.  Always use waitpid(-1, WNOHANG) and
	sigsuspend.  Check for zombie leaders.
	(linux_wait_for_event): Reimplement as wrapper around
	linux_wait_for_event_filtered.
	(linux_wait_1): Handle TARGET_WAITKIND_NO_RESUMED.  Assume that if
	a normal or signal exit is seen, it's the whole process exiting.
	(wait_for_sigstop): No longer a for_each_inferior callback.
	Rewrite on top of linux_wait_for_event_filtered.
	(stop_all_lwps): Call wait_for_sigstop directly.
	* server.c (resume, handle_target_event): Handle
	TARGET_WAITKIND_NO_RESUMED.
2014-02-27 14:30:08 +00:00
Pedro Alves d632a0971c Move linux-nat.c:status_to_str to nat/linux-waitpid.c.
So that gdbserver's Linux backend can use it too.

gdb/
2014-02-27  Pedro Alves  <palves@redhat.com>

	PR 12702
	* linux-nat.c (status_to_str): Moved to nat/linux-waitpid.c.
	* nat/linux-waitpid.c: Include string.h.
	(status_to_str): Moved here and made extern.
	* nat/linux-waitpid.h (status_to_str): New declaration.
2014-02-27 14:30:08 +00:00
Hui Zhu 2ebd5a3520 Move ptid_match to common/ptid.c.
So that gdbserver can use it too.

gdb/
2014-02-27  Hui Zhu  <hui@codesourcery.com>

	PR 12702
	* infrun.c (ptid_match): Move ...
	* common/ptid.c (ptid_match): ... here.
	* inferior.h (ptid_match): Move ...
	* common/ptid.h (ptid_match): ... here.
2014-02-27 14:30:07 +00:00
Mark Kettenis 3cdd631f17 Call common OpenBSD ABI init code on OpenBSD/mips64.
* mips64obsd-tdep.c (mips64obsd_init_abi): Call obsd_init_abi.
        * configure.tgt (mips64*-*-openbsd*): Add obsd-tdep.c to
        gdb_target_obs.
2014-02-27 14:07:10 +01:00
Mark Kettenis bee30a640c Add gdbarch auxv parsing for OpenBSD.
gdb/Changelog:

        * obsd-tdep.c (obsd_auxv_parse): New function.
        (obsd_init_abi): Set auxv_parse.
2014-02-27 13:47:00 +01:00
Mark Kettenis 27a48a9223 Add auxv parsing to the architecture vector.
Necessary to fix parsing auxv entries from core files on systems that use
the layout specified by ELF instead of the incompatible variant used by Linux.

gdb/Changelog:

        * gdbarch.sh (auxv_parse): New.
        * gdbarch.h: Regenerated.
        * gdbarch.c: Regenerated.
        * auxv.c (target_auxv_parse): Call gdbarch_parse_auxv if provided.
2014-02-27 13:40:15 +01:00
Ludovic Courtès 7a5a839f3a guile: Add 'history-append!' procedure.
gdb/
2014-02-26  Ludovic Courtès  <ludo@gnu.org>

	* guile/scm-value.c (gdbscm_history_append_x): New function.
	(value_functions): Add it.

gdb/testsuite/
2014-02-26  Ludovic Courtès  <ludo@gnu.org>

	* gdb.guile/scm-value.exp (test_value_in_inferior): Add
	test for 'history-append!'.

gdb/doc/
2014-02-26  Ludovic Courtès  <ludo@gnu.org>

	* gdb/doc/guile.texi (Basic Guile): Document 'history-append!'.
2014-02-26 22:59:42 +01:00
Joel Brobecker d763de106f gdbserver/Windows: Rely purely on event info when handling DLL load event
This is the GDBserver counterpart of a change we recently made in
GDB to only rely on get_image_name to determine its name.

This simplification, in turn, allows us to remove a fair amount of
functions and globals which now become unused.

gdb/gdbserver/ChangeLog:

	* win32-low.c (psapi_get_dll_name,
	* win32_CreateToolhelp32Snapshot): Delete.
	(win32_CreateToolhelp32Snapshot, win32_Module32First)
	(win32_Module32Next, load_toolhelp, toolhelp_get_dll_name):
	Delete.
	(handle_load_dll): Add function description.
	Remove code using psapi_get_dll_name and toolhelp_get_dll_name.
2014-02-26 12:05:18 -08:00
Joel Brobecker 850a0f76c2 windows: Factorize handling of DLL load address offset
This patch is a small cleanup that moves the magic 0x1000 offset
to apply to a DLL's base address inside the win32_add_one_solib
function, rather than delegate that reponsibility to its callers.

gdb/gdbserver/ChangeLog:

	* win32-low.c (win32_add_one_solib): Add 0x1000 to load_addr.
	Add comment.
	(win32_add_all_dlls): Remove 0x1000 offset applied to DLL
	base address when calling win32_add_one_solib.
	(handle_load_dll): Delete local variable load_addr.
	Remove 0x1000 offset applied to DLL base address when calling
	win32_add_one_solib.
	(handle_unload_dll): Add comment.
2014-02-26 12:03:52 -08:00
Joel Brobecker f25b3fc334 gdbserver/windows: Ignore DLL load/unload events during child initialization.
This GDBserver patch mirrors a change made in GDB wich aims at
simplifying DLL handling during the inferior initialization
(process creation during the "run", or during an "attach").
Instead of processing each DLL load event, which is sometimes
incomplete, we ignore these events until the inferior has completed
its startup phase, and then just iterate over all DLLs via
EnumProcessModules.

As a side-effect, it fixes a small bug where win32_ensure_ntdll_loaded
was missing a 0x1000 offset in the DLL base address. This problem
should only be visible on the 64bit version of Windows 8.1, since
this is the only platform where win32_ensure_ntdll_loaded is actually
needed.

gdb/gdbserver/ChangeLog:

	* win32-low.c (win32_add_all_dlls): Renames
	win32_ensure_ntdll_loaded.  Rewrite function documentation.
	Adjust implementation to always load all DLLs.
	Add 0x1000 offset to DLL base address when calling
	win32_add_one_solib.
	(child_initialization_done): New static global.
	(do_initial_child_stuff): Set child_initialization_done to
	zero during child initialization, and 1 after.  Replace call
	to win32_ensure_ntdll_loaded by call to win32_add_all_dlls.
	Add comment.
	(match_dll_by_basename, dll_is_loaded_by_basename): Delete.
	(handle_unload_dll): Add function documentation.
	(get_child_debug_event): Ignore load and unload DLL events
	during child initialization.
2014-02-26 12:02:44 -08:00
Joel Brobecker 31aa7e4ee9 DWARF: Read constant-class addresses correctly
Starting with DWARF version 4, the description of the DW_AT_high_pc
attribute was amended to say:

   if it is of class constant, the value is an unsigned integer offset
   which when added to the low PC gives the address of the first
   location past the last instruction associated with the entity.

A change was made in Apr 27th, 2012 to reflect that change:

  | commit 91da14142c
  | Author: Mark Wielaard <mjw@redhat.com>
  | Date:   Fri Apr 27 18:55:19 2012 +0000
  |
  |     * dwarf2read.c (dwarf2_get_pc_bounds): Check DW_AT_high_pc form to
  |     see whether it is an address or a constant offset from DW_AT_low_pc.
  |     (dwarf2_record_block_ranges): Likewise.
  |     (read_partial_die): Likewise.

Unfortunately, this new interpretation is now used regardless of
the CU's DWARF version. It turns out that one of WindRiver's compilers
(FTR: Diabdata 4.4) is generating DWARF version 2 info with
DW_AT_high_pc attributes improperly using the data4 form. Because of
that, we miscompute all high PCs incorrectly. This leads to a lot of
symtabs having overlapping ranges, which in turn causes havoc in
pc-to-symtab-and-line translations.

One visible effect is when inserting a breakpoint on a given function:

    (gdb) b world
    Breakpoint 1 at 0x4005c4

The source location of the breakpoint is missing. The output should be:

    (gdb) b world
    Breakpoint 1 at 0x4005c8: file dw2-rel-hi-pc-world.c, line 24.

What happens in this case is that the pc-to-SAL translation first
starts be trying to find the symtab associated to our PC using
each symtab's ranges. Because of the high_pc miscomputation,
many symtabs end up matching, and the heuristic trying to select
the most probable one unfortunately returns one that is unrelated
(it really had no change in this case to do any better). Once we
have the wrong symtab, the start searching the associated linetable,
where the addresses are correct, thus finding no match, and therefore
no SAL.

This patch is an attempt at handling the situation as gracefully
as we can, without guarantees.  It introduces a new function
"attr_value_as_address" which uses the correct accessor for getting
the value of a given attribute.  It then adjust the code throughout
this unit to use this function instead of assuming that addresses always
have the DW_FORM_addr format.

It also fixes the original issue of miscomputing the high_pc
by limiting the new interpretation of constant form DW_AT_high_pc
attributes to units using DWARF version 4 or later.

gdb/ChangeLog:

        * dwarf2read.c (attr_value_as_address): New function.
        (dwarf2_find_base_address, read_call_site_scope): Use
        attr_value_as_address in place of DW_ADDR.
        (dwarf2_get_pc_bounds): Use attr_value_as_address to get
        the low and high addresses.  Slight rework of the handling
        of the high pc being a constant form, and limit it to
        DWARF verson 4 or higher.
        (dwarf2_record_block_ranges): Likewise.
        (read_partial_die): Likewise.
        (new_symbol_full): Use attr_value_as_address in place of DW_ADDR.

gdb/testsuite/ChangeLog:

        * gdb.dwarf2/dw2-abs-hi-pc-hello-dbg.S: New file.
        * gdb.dwarf2/dw2-abs-hi-pc-hello.c: New file.
        * gdb.dwarf2/dw2-abs-hi-pc-world-dbg.S: New file.
        * gdb.dwarf2/dw2-abs-hi-pc-world.c: New file.
        * gdb.dwarf2/dw2-abs-hi-pc.c: New file.
        * gdb.dwarf2/dw2-abs-hi-pc.exp: New file.

Tested on x86_64-linux.
2014-02-26 11:43:23 -08:00
Tom Tromey 9b333ba340 make "file" use the BFD cache better
Right now the "file" command will discard the exec_bfd and then
possibly open a new one.

If this ends up reopening the same file, it can cause needless work by
gdb -- destroying all the per-BFD data just to re-read it again.

This patch changes the code to hold a reference to the old exec_bfd
while opening the new one.

The possible downside of this is a higher peak memory use.

2014-02-26  Tom Tromey  <tromey@redhat.com>

	* exec.c (exec_file_attach): Hold a reference to exec_bfd.
2014-02-26 12:11:18 -07:00
Tom Tromey 5f6cac4085 add short-circuit logic to elfread.c
If minimal symbols have already been read into a per-BFD object, then
a symbol reader can skip re-reading them.  This changes the ELF reader
to do so.

We only skip the work if the file is ELF+DWARF.  If it has stabs or
mdebug sections, then I think extra information is computed during the
minsym creation pass; and so we must still repeat it.  Eventually even
this will go away, once all symbol types have switched to being
progspace-independent.  In the meantime this has no negative effect --
it is just a missing optimization for a small set of users.

This change also required a somewhat non-obvious change to the OBJSTAT
accounting code.  If a symbol reader skips re-reading minimal symbols,
then the corresponding OBJSTAT will not be updated.  This leads to a
test failure in gdb.base/maint.exp.

To fix this, I've moved the needed stat field out of objfile and into
the per-BFD object.

2014-02-26  Tom Tromey  <tromey@redhat.com>

	* elfread.c (elf_read_minimal_symbols): Return early if
	minimal symbols have already been read.  Add "ei" parameter.
	(elf_symfile_read): Call elf_read_minimal_symbols earlier.
	* minsyms.c (prim_record_minimal_symbol_full): Update.
	* objfiles.h (struct objstats) <n_minsyms>: Move...
	(struct objfile_per_bfd_storage) <n_minsyms>: ... here.
	* symmisc.c (print_objfile_statistics): Update.
2014-02-26 12:11:18 -07:00
Tom Tromey 2750ef2799 split out elf_read_minimal_symbols
This is just a simple refactoring in elfread.c to split out the
minsym-reading code into its own function.

2014-02-26  Tom Tromey  <tromey@redhat.com>

	* elfread.c (elf_read_minimal_symbols): New function, from
	elf_symfile_read.
	(elf_symfile_read): Call it.
2014-02-26 12:11:18 -07:00
Tom Tromey 34643a32c6 move minimal symbols to per-bfd
Now that minimal symbols are independent of the program space, we can
move them to the per-BFD object.  This lets us save memory in the
multi-inferior case; and, once the symbol readers are updated, time.

The other prerequisite for this move is that all the objects referred
to by the minimal symbols have a lifetime at least as long as the
per-BFD object.  I think this is satisfied partially by this patch
(moving the copied names there) and partially by earlier patches
moving the demangled name hash.

This patch contains a bit of logic to avoid creating new minimal
symbols if they have already been read for a given BFD.  This allows
us to avoid trying to update all the symbol readers for this
condition.  At first glance this may seem like a hack, but some symbol
readers mix psym and minsym reading, and would require logic just like
this regardless -- and it is simpler and less error-prone to just do
the work in a central spot.

2014-02-26  Tom Tromey  <tromey@redhat.com>

	* minsyms.c (lookup_minimal_symbol, iterate_over_minimal_symbols)
	(lookup_minimal_symbol_text, lookup_minimal_symbol_by_pc_name)
	(lookup_minimal_symbol_solib_trampoline)
	(lookup_minimal_symbol_by_pc_section_1)
	(lookup_minimal_symbol_and_objfile): Update.
	(prim_record_minimal_symbol_full): Use the per-BFD obstack.
	Don't allocate a minimal symbol if minsyms have already been read.
	(build_minimal_symbol_hash_tables): Update.
	(install_minimal_symbols): Do nothing if minsyms already read.
	Use the per-BFD obstack.
	(terminate_minimal_symbol_table): Use the per-BFD obstack.
	* objfiles.c (allocate_objfile): Call
	terminate_minimal_symbol_table later.
	(have_minimal_symbols): Update.
	* objfiles.h (struct objfile_per_bfd_storage) <msymbols,
	minimal_symbol_count, msymbol_hash, msymbol_demangled_hash>:
	Move from struct objfile.
	<minsyms_read>: New field.
	(struct objfile) <msymbols, minimal_symbol_count,
	msymbol_hash, msymbol_demangled_hash>: Move.
	(ALL_OBJFILE_MSYMBOLS): Update.
	* symfile.c (read_symbols): Set minsyms_read.
	(reread_symbols): Update.
	* symmisc.c (dump_objfile, dump_msymbols): Update.
2014-02-26 12:11:17 -07:00
Tom Tromey 2273f0ac95 change minsyms not to be relocated at read-time
This removes the runtime offsets from minsyms.  Instead, these offsets
will now be applied whenever the minsym's address is computed.

This patch redefines MSYMBOL_VALUE_ADDRESS to actually use the offsets
from the given objfile.  Then, it updates all the symbol readers,
changing them so that they do not add in the section offset when
creating the symbol.

This change also lets us remove relocation of minsyms from
objfile_relocate1 and also msymbols_sort.

2014-02-26  Tom Tromey  <tromey@redhat.com>

	* minsyms.c (msymbols_sort): Remove.
	* minsyms.h (msymbols_sort): Remove.
	* objfiles.c (objfile_relocate1): Don't relocate minsyms.
	* symtab.h (MSYMBOL_VALUE_ADDRESS): Use objfile offsets.
	* elfread.c (elf_symtab_read): Don't add section offsets.
	* xcoffread.c (record_minimal_symbol): Don't add section offset
	to minimal symbol address.
	* somread.c (text_offset, data_offset): Remove.
	(som_symtab_read): Don't add section offsets to minimal symbol
	addresses.
	* coff-pe-read.c (add_pe_forwarded_sym, read_pe_exported_syms):
	Don't add section offsets to minimal symbols.
	* coffread.c (coff_symtab_read): Don't add section offsets
	to minimal symbol addresses.
	* machoread.c (macho_symtab_add_minsym): Don't add section offset
	to minimal symbol addresses.
	* mipsread.c (read_alphacoff_dynamic_symtab): Don't add
	section offset to minimal symbol addresses.
	* mdebugread.c (parse_partial_symbols): Don't add section
	offset to minimal symbol addresses.
	* dbxread.c (read_dbx_dynamic_symtab): Don't add section
	offset to minimal symbol addresses.
2014-02-26 12:11:17 -07:00
Tom Tromey 77e371c079 start change to progspace independence
This patch starts changing minimal symbols to be independent of the
program space.

Specifically, it adds a new objfile parameter to MSYMBOL_VALUE_ADDRESS
and changes all the code to use it.  This is needed so we can change
gdb to apply the section offset when a minsym's address is computed,
as opposed to baking the offsets into the symbol itself.

A few spots still need the unrelocated address.  For these, we
introduce MSYMBOL_VALUE_RAW_ADDRESS.

As a convenience, we also add the new macro BMSYMBOL_VALUE_ADDRESS,
which computes the address of a bound minimal symbol.  This just does
the obvious thing with the fields.

Note that this change does not actually enable program space
independence.  That requires more changes to gdb.  However, to ensure
that these changes compile properly, this patch does add the needed
section lookup code to MSYMBOL_VALUE_ADDRESS -- it just ensures it has
no effect at runtime by multiplying the offset by 0.

2014-02-26  Tom Tromey  <tromey@redhat.com>

	* ada-lang.c (ada_main_name): Update.
	(ada_add_standard_exceptions): Update.
	* ada-tasks.c (ada_tasks_inferior_data_sniffer): Update.
	* aix-thread.c (pdc_symbol_addrs, pd_enable): Update.
	* arm-tdep.c (skip_prologue_function, arm_skip_stub): Update.
	* auxv.c (ld_so_xfer_auxv): Update.
	* avr-tdep.c (avr_scan_prologue): Update.
	* ax-gdb.c (gen_var_ref): Update.
	* blockframe.c (get_pc_function_start)
	(find_pc_partial_function_gnu_ifunc): Update.
	* breakpoint.c (create_overlay_event_breakpoint)
	(create_longjmp_master_breakpoint)
	(create_std_terminate_master_breakpoint)
	(create_exception_master_breakpoint): Update.
	* bsd-uthread.c (bsd_uthread_lookup_address): Update.
	* c-valprint.c (c_val_print): Update.
	* coff-pe-read.c (add_pe_forwarded_sym): Update.
	* common/agent.c (agent_look_up_symbols): Update.
	* dbxread.c (find_stab_function_addr, end_psymtab): Update.
	* dwarf2loc.c (call_site_to_target_addr): Update.
	* dwarf2read.c (dw2_find_pc_sect_symtab): Update.
	* elfread.c (elf_gnu_ifunc_record_cache)
	(elf_gnu_ifunc_resolve_by_got): Update.
	* findvar.c (default_read_var_value): Update.
	* frame.c (inside_main_func): Update.
	* frv-tdep.c (frv_frame_this_id): Update.
	* glibc-tdep.c (glibc_skip_solib_resolver): Update.
	* gnu-v3-abi.c (gnuv3_get_typeid, gnuv3_skip_trampoline):
	Update.
	* hppa-hpux-tdep.c (hppa64_hpux_search_dummy_call_sequence)
	(hppa_hpux_find_dummy_bpaddr): Update.
	* hppa-tdep.c (hppa_symbol_address): Update.
	* infcmd.c (until_next_command): Update.
	* jit.c (jit_read_descriptor, jit_breakpoint_re_set_internal):
	Update.
	* linespec.c (minsym_found, add_minsym): Update.
	* linux-nat.c (get_signo): Update.
	* linux-thread-db.c (inferior_has_bug): Update.
	* m32c-tdep.c (m32c_return_value)
	(m32c_m16c_address_to_pointer): Update.
	* m32r-tdep.c (m32r_frame_this_id): Update.
	* m68hc11-tdep.c (m68hc11_get_register_info): Update.
	* machoread.c (macho_resolve_oso_sym_with_minsym): Update.
	* maint.c (maintenance_translate_address): Update.
	* minsyms.c (lookup_minimal_symbol_by_pc_name): Update.
	(frob_address): New function.
	(lookup_minimal_symbol_by_pc_section_1): Use raw addresses,
	frob_address.  Rename parameter to "pc_in".
	(compare_minimal_symbols, compact_minimal_symbols): Use raw
	addresses.
	(find_solib_trampoline_target, minimal_symbol_upper_bound):
	Update.
	* mips-linux-tdep.c (mips_linux_skip_resolver): Update.
	* mips-tdep.c (mips_skip_pic_trampoline_code): Update.
	* objc-lang.c (find_objc_msgsend): Update.
	* objfiles.c (objfile_relocate1): Update.
	* obsd-tdep.c (obsd_skip_solib_resolver): Update.
	* p-valprint.c (pascal_val_print): Update.
	* parse.c (write_exp_msymbol): Update.
	* ppc-linux-tdep.c (ppc_linux_spe_context_lookup)
	(ppc_elfv2_skip_entrypoint): Update.
	* ppc-sysv-tdep.c (convert_code_addr_to_desc_addr): Update.
	* printcmd.c (build_address_symbolic, msym_info)
	(address_info): Update.
	* proc-service.c (ps_pglobal_lookup): Update.
	* psymtab.c (find_pc_sect_psymtab_closer)
	(find_pc_sect_psymtab, find_pc_sect_symtab_from_partial):
	Change msymbol parameter to bound_minimal_symbol.
	* ravenscar-thread.c (get_running_thread_id): Update.
	* remote.c (remote_check_symbols): Update.
	* sh64-tdep.c (sh64_elf_make_msymbol_special): Use raw
	address.
	* sol2-tdep.c (sol2_skip_solib_resolver): Update.
	* solib-dsbt.c (lm_base): Update.
	* solib-frv.c (lm_base, main_got): Update.
	* solib-irix.c (locate_base): Update.
	* solib-som.c (som_solib_create_inferior_hook)
	(link_map_start): Update.
	* solib-spu.c (spu_enable_break, ocl_enable_break): Update.
	* solib-svr4.c (elf_locate_base, enable_break): Update.
	* spu-tdep.c (spu_get_overlay_table, spu_catch_start)
	(flush_ea_cache): Update.
	* stabsread.c (define_symbol, scan_file_globals): Update.
	* stack.c (find_frame_funname): Update.
	* symfile-debug.c (debug_qf_expand_symtabs_matching)
	(debug_qf_find_pc_sect_symtab): Update.
	* symfile.c (simple_read_overlay_table)
	(simple_overlay_update): Update.
	* symfile.h (struct quick_symbol_functions)
	<find_pc_sect_symtab>: Change type of msymbol to
	bound_minimal_symbol.
	* symmisc.c (dump_msymbols): Update.
	* symtab.c (find_pc_sect_symtab_via_partial)
	(find_pc_sect_psymtab, find_pc_sect_line, skip_prologue_sal)
	(search_symbols, print_msymbol_info): Update.
	* symtab.h (MSYMBOL_VALUE_RAW_ADDRESS): New macro.
	(MSYMBOL_VALUE_ADDRESS): Redefine.
	(BMSYMBOL_VALUE_ADDRESS): New macro.
	* tracepoint.c (scope_info): Update.
	* tui/tui-disasm.c (tui_find_disassembly_address)
	(tui_get_begin_asm_address): Update.
	* valops.c (find_function_in_inferior): Update.
	* value.c (value_static_field, value_fn_field): Update.
2014-02-26 12:11:17 -07:00
Tom Tromey 3b7344d5ab use bound_minsym as result for lookup_minimal_symbol et al
This patch changes a few minimal symbol lookup functions to return a
bound_minimal_symbol rather than a pointer to the minsym.  This change
helps prepare gdb for computing a minimal symbol's address at the
point of use.

Note that this changes even those functions that ostensibly search a
single objfile.  That was necessary because, in fact, those functions
can search an objfile and its separate debug objfiles; and it is
important for the caller to know in which objfile the minimal symbol
was actually found.

The bulk of this patch is mechanical.

2014-02-26  Tom Tromey  <tromey@redhat.com>

	* ada-lang.c (ada_update_initial_language): Update.
	(ada_main_name, ada_has_this_exception_support): Update.
	* ada-tasks.c (ada_tasks_inferior_data_sniffer): Update.
	* aix-thread.c (pdc_symbol_addrs, pd_enable): Update.
	* arm-tdep.c (arm_skip_stub): Update.
	* auxv.c (ld_so_xfer_auxv): Update.
	* avr-tdep.c (avr_scan_prologue): Update.
	* ax-gdb.c (gen_var_ref): Update.
	* breakpoint.c (struct breakpoint_objfile_data)
	<overlay_msym, longjmp_msym, terminate_msym, exception_msym>: Change
	type to bound_minimal_symbol.
	(create_overlay_event_breakpoint)
	(create_longjmp_master_breakpoint)
	(create_std_terminate_master_breakpoint)
	(create_exception_master_breakpoint): Update.
	* bsd-uthread.c (bsd_uthread_lookup_address): Update.
	* c-exp.y (classify_name): Update.
	* coffread.c (coff_symfile_read): Update.
	* common/agent.c (agent_look_up_symbols): Update.
	* d-lang.c (d_main_name): Update.
	* dbxread.c (find_stab_function_addr, end_psymtab): Update.
	* dec-thread.c (enable_dec_thread): Update.
	* dwarf2loc.c (call_site_to_target_addr): Update.
	* elfread.c (elf_gnu_ifunc_resolve_by_got): Update.
	* eval.c (evaluate_subexp_standard): Update.
	* findvar.c (struct minsym_lookup_data) <result>: Change type
	to bound_minimal_symbol.
	<objfile>: Remove.
	(minsym_lookup_iterator_cb, default_read_var_value): Update.
	* frame.c (inside_main_func): Update.
	* frv-tdep.c (frv_frame_this_id): Update.
	* gcore.c (call_target_sbrk): Update.
	* glibc-tdep.c (glibc_skip_solib_resolver): Update.
	* gnu-v3-abi.c (gnuv3_get_typeid, gnuv3_skip_trampoline):
	Update.
	* go-lang.c (go_main_name): Update.
	* hppa-hpux-tdep.c (hppa_hpux_skip_trampoline_code)
	(hppa_hpux_find_import_stub_for_addr): Update.
	* hppa-tdep.c (hppa_extract_17,	hppa_lookup_stub_minimal_symbol):
	Update.  Change return type.
	* hppa-tdep.h (hppa_lookup_stub_minimal_symbol): Change return
	type.
	* jit.c (jit_breakpoint_re_set_internal): Update.
	* linux-fork.c (inferior_call_waitpid, checkpoint_command):
	Update.
	* linux-nat.c (get_signo): Update.
	* linux-thread-db.c (inferior_has_bug): Update
	* m32c-tdep.c (m32c_return_value)
	(m32c_m16c_address_to_pointer): Update.
	* m32r-tdep.c (m32r_frame_this_id): Update.
	* m68hc11-tdep.c (m68hc11_get_register_info): Update.
	* machoread.c (macho_resolve_oso_sym_with_minsym): Update.
	* minsyms.c (lookup_minimal_symbol_internal): Rename to
	lookup_minimal_symbol.  Change return type.
	(lookup_minimal_symbol): Remove.
	(lookup_bound_minimal_symbol): Update.
	(lookup_minimal_symbol_text): Change return type.
	(lookup_minimal_symbol_solib_trampoline): Change return type.
	* minsyms.h (lookup_minimal_symbol, lookup_minimal_symbol_text)
	(lookup_minimal_symbol_solib_trampoline): Change return type.
	* mips-linux-tdep.c (mips_linux_skip_resolver): Update.
	* objc-lang.c (lookup_objc_class, lookup_child_selector)
	(value_nsstring, find_imps): Update.
	* obsd-tdep.c (obsd_skip_solib_resolver): Update.
	* p-lang.c (pascal_main_name): Update.
	* ppc-linux-tdep.c (ppc_linux_spe_context_lookup): Update.
	* ppc-sysv-tdep.c (convert_code_addr_to_desc_addr): Update.
	* proc-service.c (ps_pglobal_lookup): Update.
	* ravenscar-thread.c (get_running_thread_msymbol): Change
	return type.
	(has_ravenscar_runtime, get_running_thread_id): Update.
	* remote.c (remote_check_symbols): Update.
	* sol-thread.c (ps_pglobal_lookup): Update.
	* sol2-tdep.c (sol2_skip_solib_resolver): Update.
	* solib-dsbt.c (lm_base): Update.
	* solib-frv.c (lm_base, frv_relocate_section_addresses):
	Update.
	* solib-irix.c (locate_base): Update.
	* solib-som.c (som_solib_create_inferior_hook)
	(som_solib_desire_dynamic_linker_symbols, link_map_start):
	Update.
	* solib-spu.c (spu_enable_break): Update.
	* solib-svr4.c (elf_locate_base, enable_break): Update.
	* spu-tdep.c (spu_get_overlay_table, spu_catch_start)
	(flush_ea_cache): Update.
	* stabsread.c (define_symbol): Update.
	* symfile.c (simple_read_overlay_table): Update.
	* symtab.c (find_pc_sect_line): Update.
	* tracepoint.c (scope_info): Update.
	* tui-disasm.c (tui_get_begin_asm_address): Update.
	* value.c (value_static_field): Update.
2014-02-26 12:11:17 -07:00
Tom Tromey 40c1a00737 make MSYMBOL_VALUE_ADDRESS an rvalue
This changes MSYMBOL_VALUE_ADDRESS to be an rvalue.  In a later patch
we change this macro to compute its value; this patch introduces a
setter to make the break a bit cleaner.

2014-02-26  Tom Tromey  <tromey@redhat.com>

	* minsyms.c (prim_record_minimal_symbol_full): Use
	SET_MSYMBOL_VALUE_ADDRESS.
	* objfiles.c (objfile_relocate1): Use SET_MSYMBOL_VALUE_ADDRESS.
	* sh64-tdep.c (sh64_elf_make_msymbol_special): Use
	SET_MSYMBOL_VALUE_ADDRESS.
	* symtab.h (MSYMBOL_VALUE_ADDRESS): Expand to an rvalue.
	(SET_MSYMBOL_VALUE_ADDRESS): New macro.
2014-02-26 12:11:16 -07:00
Tom Tromey efd66ac669 change minsym representation
In a later patch we're going to change the minimal symbol address
calculation to apply section offsets at the point of use.  To make it
simpler to catch potential problem spots, this patch changes the
representation of minimal symbols and introduces new
minimal-symbol-specific variants of the various accessors.  This is
necessary because it would be excessively ambitious to try to convert
all the symbol types at once.

The core of this change is just renaming a field in minimal_symbol;
the rest is just a fairly mechanical rewording.

2014-02-26  Tom Tromey  <tromey@redhat.com>

	* symtab.h (struct minimal_symbol) <mginfo>: Rename from ginfo.
	(MSYMBOL_VALUE, MSYMBOL_VALUE_ADDRESS, MSYMBOL_VALUE_BYTES)
	(MSYMBOL_BLOCK_VALUE, MSYMBOL_VALUE_CHAIN, MSYMBOL_LANGUAGE)
	(MSYMBOL_SECTION, MSYMBOL_OBJ_SECTION, MSYMBOL_NATURAL_NAME)
	(MSYMBOL_LINKAGE_NAME, MSYMBOL_PRINT_NAME, MSYMBOL_DEMANGLED_NAME)
	(MSYMBOL_SET_LANGUAGE, MSYMBOL_SEARCH_NAME)
	(MSYMBOL_MATCHES_SEARCH_NAME, MSYMBOL_SET_NAMES): New macros.
	* ada-lang.c (ada_main_name): Update.
	(ada_lookup_simple_minsym): Update.
	(ada_make_symbol_completion_list): Update.
	(ada_add_standard_exceptions): Update.
	* ada-tasks.c (read_atcb, ada_tasks_inferior_data_sniffer): Update.
	* aix-thread.c (pdc_symbol_addrs, pd_enable): Update.
	* amd64-windows-tdep.c (amd64_skip_main_prologue): Update.
	* arm-tdep.c (skip_prologue_function): Update.
	(arm_skip_stack_protector, arm_skip_stub): Update.
	* arm-wince-tdep.c (arm_pe_skip_trampoline_code): Update.
	(arm_wince_skip_main_prologue): Update.
	* auxv.c (ld_so_xfer_auxv): Update.
	* avr-tdep.c (avr_scan_prologue): Update.
	* ax-gdb.c (gen_var_ref): Update.
	* block.c (call_site_for_pc): Update.
	* blockframe.c (get_pc_function_start): Update.
	(find_pc_partial_function_gnu_ifunc): Update.
	* breakpoint.c (create_overlay_event_breakpoint): Update.
	(create_longjmp_master_breakpoint): Update.
	(create_std_terminate_master_breakpoint): Update.
	(create_exception_master_breakpoint): Update.
	(resolve_sal_pc): Update.
	* bsd-uthread.c (bsd_uthread_lookup_address): Update.
	* btrace.c (ftrace_print_function_name, ftrace_function_switched):
	Update.
	* c-valprint.c (c_val_print): Update.
	* coff-pe-read.c (add_pe_forwarded_sym): Update.
	* coffread.c (coff_symfile_read): Update.
	* common/agent.c (agent_look_up_symbols): Update.
	* dbxread.c (find_stab_function_addr): Update.
	(end_psymtab): Update.
	* dwarf2loc.c (call_site_to_target_addr): Update.
	(func_verify_no_selftailcall): Update.
	(tailcall_dump): Update.
	(call_site_find_chain_1): Update.
	(dwarf_expr_reg_to_entry_parameter): Update.
	* elfread.c (elf_gnu_ifunc_record_cache): Update.
	(elf_gnu_ifunc_resolve_by_got): Update.
	* f-valprint.c (info_common_command): Update.
	* findvar.c (read_var_value): Update.
	* frame.c (get_prev_frame_1): Update.
	(inside_main_func): Update.
	* frv-tdep.c (frv_skip_main_prologue): Update.
	(frv_frame_this_id): Update.
	* glibc-tdep.c (glibc_skip_solib_resolver): Update.
	* gnu-v2-abi.c (gnuv2_value_rtti_type): Update.
	* gnu-v3-abi.c (gnuv3_rtti_type): Update.
	(gnuv3_skip_trampoline): Update.
	* hppa-hpux-tdep.c (hppa32_hpux_in_solib_call_trampoline): Update.
	(hppa64_hpux_in_solib_call_trampoline): Update.
	(hppa_hpux_skip_trampoline_code): Update.
	(hppa64_hpux_search_dummy_call_sequence): Update.
	(hppa_hpux_find_import_stub_for_addr): Update.
	(hppa_hpux_find_dummy_bpaddr): Update.
	* hppa-tdep.c (hppa_symbol_address)
	(hppa_lookup_stub_minimal_symbol): Update.
	* i386-tdep.c (i386_skip_main_prologue): Update.
	(i386_pe_skip_trampoline_code): Update.
	* ia64-tdep.c (ia64_convert_from_func_ptr_addr): Update.
	* infcall.c (get_function_name): Update.
	* infcmd.c (until_next_command): Update.
	* jit.c (jit_breakpoint_re_set_internal): Update.
	(jit_inferior_init): Update.
	* linespec.c (minsym_found): Update.
	(add_minsym): Update.
	* linux-fork.c (info_checkpoints_command): Update.
	* linux-nat.c (get_signo): Update.
	* linux-thread-db.c (inferior_has_bug): Update.
	* m32c-tdep.c (m32c_return_value): Update.
	(m32c_m16c_address_to_pointer): Update.
	(m32c_m16c_pointer_to_address): Update.
	* m32r-tdep.c (m32r_frame_this_id): Update.
	* m68hc11-tdep.c (m68hc11_get_register_info): Update.
	* machoread.c (macho_resolve_oso_sym_with_minsym): Update.
	* maint.c (maintenance_translate_address): Update.
	* minsyms.c (add_minsym_to_hash_table): Update.
	(add_minsym_to_demangled_hash_table): Update.
	(msymbol_objfile): Update.
	(lookup_minimal_symbol): Update.
	(iterate_over_minimal_symbols): Update.
	(lookup_minimal_symbol_text): Update.
	(lookup_minimal_symbol_by_pc_name): Update.
	(lookup_minimal_symbol_solib_trampoline): Update.
	(lookup_minimal_symbol_by_pc_section_1): Update.
	(lookup_minimal_symbol_and_objfile): Update.
	(prim_record_minimal_symbol_full): Update.
	(compare_minimal_symbols): Update.
	(compact_minimal_symbols): Update.
	(build_minimal_symbol_hash_tables): Update.
	(install_minimal_symbols): Update.
	(terminate_minimal_symbol_table): Update.
	(find_solib_trampoline_target): Update.
	(minimal_symbol_upper_bound): Update.
	* mips-linux-tdep.c (mips_linux_skip_resolver): Update.
	* mips-tdep.c (mips_stub_frame_sniffer): Update.
	(mips_skip_pic_trampoline_code): Update.
	* msp430-tdep.c (msp430_skip_trampoline_code): Update.
	* objc-lang.c (selectors_info): Update.
	(classes_info): Update.
	(find_methods): Update.
	(find_imps): Update.
	(find_objc_msgsend): Update.
	* objfiles.c (objfile_relocate1): Update.
	* objfiles.h (ALL_OBJFILE_MSYMBOLS): Update.
	* obsd-tdep.c (obsd_skip_solib_resolver): Update.
	* p-valprint.c (pascal_val_print): Update.
	* parse.c (write_exp_msymbol): Update.
	* ppc-linux-tdep.c (powerpc_linux_in_dynsym_resolve_code)
	(ppc_linux_spe_context_lookup, ppc_elfv2_skip_entrypoint): Update.
	* ppc-sysv-tdep.c (convert_code_addr_to_desc_addr): Update.
	* printcmd.c (build_address_symbolic): Update.
	(sym_info): Update.
	(address_info): Update.
	* proc-service.c (ps_pglobal_lookup): Update.
	* psymtab.c (find_pc_sect_psymtab_closer): Update.
	(find_pc_sect_psymtab): Update.
	* python/py-framefilter.c (py_print_frame): Update.
	* ravenscar-thread.c (get_running_thread_id): Update.
	* record-btrace.c (btrace_call_history, btrace_get_bfun_name):
	Update.
	* remote.c (remote_check_symbols): Update.
	* rs6000-tdep.c (rs6000_skip_main_prologue): Update.
	(rs6000_skip_trampoline_code): Update.
	* sh64-tdep.c (sh64_elf_make_msymbol_special): Update.
	* sol2-tdep.c (sol2_skip_solib_resolver): Update.
	* solib-dsbt.c (lm_base): Update.
	* solib-frv.c (lm_base): Update.
	(main_got): Update.
	* solib-irix.c (locate_base): Update.
	* solib-som.c (som_solib_create_inferior_hook): Update.
	(som_solib_desire_dynamic_linker_symbols): Update.
	(link_map_start): Update.
	* solib-spu.c (spu_enable_break): Update.
	(ocl_enable_break): Update.
	* solib-svr4.c (elf_locate_base): Update.
	(enable_break): Update.
	* spu-tdep.c (spu_get_overlay_table): Update.
	(spu_catch_start): Update.
	(flush_ea_cache): Update.
	* stabsread.c (define_symbol): Update.
	(scan_file_globals): Update.
	* stack.c (find_frame_funname): Update.
	(frame_info): Update.
	* symfile.c (simple_read_overlay_table): Update.
	(simple_overlay_update): Update.
	* symmisc.c (dump_msymbols): Update.
	* symtab.c (fixup_section): Update.
	(find_pc_sect_line): Update.
	(skip_prologue_sal): Update.
	(search_symbols): Update.
	(print_msymbol_info): Update.
	(rbreak_command): Update.
	(MCOMPLETION_LIST_ADD_SYMBOL): New macro.
	(completion_list_objc_symbol): Update.
	(default_make_symbol_completion_list_break_on): Update.
	* tracepoint.c (scope_info): Update.
	* tui/tui-disasm.c (tui_find_disassembly_address): Update.
	(tui_get_begin_asm_address): Update.
	* valops.c (find_function_in_inferior): Update.
	* value.c (value_static_field): Update.
	(value_fn_field): Update.
2014-02-26 12:11:16 -07:00
Tom Tromey 50e65b1713 introduce minimal_symbol_upper_bound
This introduces minimal_symbol_upper_bound and changes various bits of
code to use it.  Since this function is intimately tied to the
implementation of minimal symbol tables, I believe it belongs in
minsyms.c.

The new function is extracted from find_pc_partial_function_gnu_ifunc.
This isn't a "clean" move because the old function interleaved the
caching and the computation; but this doesn't make sense for the new
code.

2014-02-26  Tom Tromey  <tromey@redhat.com>

	* blockframe.c (find_pc_partial_function_gnu_ifunc): Use
	bound minimal symbols.  Move code that knows about minsym
	table layout...
	* minsyms.c (minimal_symbol_upper_bound): ... here.  New
	function.
	* minsyms.h (minimal_symbol_upper_bound): Declare.
	* objc-lang.c (find_objc_msgsend): Use bound minimal symbols,
	minimal_symbol_upper_bound.
2014-02-26 12:11:16 -07:00
Joel Brobecker 1b58801583 [Python] Make regexp collection printers work with typedefs as well.
Consider the following type for which we would like to provide
a pretty-printer and manage it via RegexpCollectionPrettyPrinter:

        typedef long time_t;

Currently, this does not work because this framework only considers
the type's tag name:

        typename = gdb.types.get_basic_type(val.type).tag
        if not typename:
            return None

This patch extends it to use the type's name if the basic type
does not have a tag name, thus allowing the framework to also
work with typedefs like the above.

gdb/ChangeLog:

        * python/lib/gdb/printing.py (RegexpCollectionPrettyPrinter):
        Use the type's name if its basic type does not have a tag.

gdb/testsuite/ChangeLog:

        * testsuite/gdb.python/py-pp-re-notag.c: New file.
        * testsuite/gdb.python/py-pp-re-notag.ex: New file.
        * testsuite/gdb.python/py-pp-re-notag.p: New file.
2014-02-26 11:04:12 -08:00
Joel Brobecker dbb9c2b1f2 Add comment in dwarf2read.c::read_subrange_type
This comment explains why we sometimes sign-extend the range type
bounds when we normally shouldn't have to.

gdb/ChangeLog:

        * dwarf2read.c (read_subrange_type): Add comment.
2014-02-26 10:54:27 -08:00
Joel Brobecker 55426c9d52 DWARF: Set enum type "flag_enum" and "unsigned" flags at type creation.
Consider the following Ada code:

   --  An array whose index is an enumeration type with 128 enumerators.
   type Enum_T is (Enum_000, Enum_001, [...], Enum_128);
   type Table is array (Enum_T) of Boolean;

When the compiler is configured to generate pure DWARF debugging info,
trying to print type Table's description yields:

    ptype pck.table
    type = array (enum_000 .. -128) of boolean

The expected output was:

    ptype pck.table
    type = array (enum_000 .. enum_128) of boolean

The DWARF debugging info for our array looks like this:

    <1><44>: Abbrev Number: 5 (DW_TAG_array_type)
       <45>   DW_AT_name        : pck__table
       <50>   DW_AT_type        : <0x28>
    <2><54>: Abbrev Number: 6 (DW_TAG_subrange_type)
       <55>   DW_AT_type        : <0x5c>
       <59>   DW_AT_lower_bound : 0
       <5a>   DW_AT_upper_bound : 128

The array index type is, by construction with the DWARF standard,
a subrange of our enumeration type, defined as follow:

    <2><5b>: Abbrev Number: 0
    <1><5c>: Abbrev Number: 7 (DW_TAG_enumeration_type)
       <5d>   DW_AT_name        : pck__enum_t
       <69>   DW_AT_byte_size   : 1
    <2><6b>: Abbrev Number: 8 (DW_TAG_enumerator)
       <6c>   DW_AT_name        : pck__enum_000
       <7a>   DW_AT_const_value : 0
    [etc]

Therefore, while processing these DIEs, the array index type ends
up being a TYPE_CODE_RANGE whose target type is our enumeration type.
But the problem is that we read the upper bound as a negative value
(-128), which is then used as is by the type printer to print the
array upper bound. This negative value explains the "-128" in the
output.

To understand why the range type's upper bound is read as a negative
value, one needs to look at how it is determined, in read_subrange_type:

  orig_base_type = die_type (die, cu);
  base_type = check_typedef (orig_base_type);
  [... high is first correctly read as 128, but then ...]
  if (!TYPE_UNSIGNED (base_type) && (high & negative_mask))
    high |= negative_mask;

The negative_mask is applied, here, because BASE_TYPE->FLAG_UNSIGNED
is not set. And the reason for that is because the base_type was only
partially constructed during the call to die_type. While the enum
is constructed on the fly by read_enumeration_type, its flag_unsigned
flag is only set later on, while creating the symbols corresponding to
the enum type's enumerators (see process_enumeration_scope), after
we've already finished creating our range type - and therefore too
late.

My first naive attempt at fixing this problem consisted in extracting
the part in process_enumeration_scope which processes all enumerators,
to generate the associated symbols, but more importantly set the type's
various flags when necessary. However, this does not always work well,
because we're still in the subrange_type's scope, and it might be
different from the scope where the enumeration type is defined.

So, instead, what this patch does to fix the issue is to extract
from process_enumeration_scope the part that determines whether
the enumeration type should have the flag_unsigned and/or the
flag_flag_enum flags set. It turns out that, aside from the code
implementing the loop, this part is fairly independent of the symbol
creation. With that part extracted, we can then use it at the end
of our enumeration type creation, to produce a type which should now
no longer need any adjustment.

Once the enumeration type produced is correctly marked as unsigned,
the subrange type's upper bound is then correctly read as an unsigned
value, therefore giving us an upper bound of 128 instead of -128.

gdb/ChangeLog:

        * dwarf2read.c (update_enumeration_type_from_children): New
        function, mostly extracted from process_structure_scope.
        (read_enumeration_type): Call update_enumeration_type_from_children.
        (process_enumeration_scope): Do not set THIS_TYPE's flag_unsigned
        and flag_flag_enum fields.

gdb/testsuite/ChangeLog:

        * gdb.dwarf2/arr-subrange.c, gdb.dwarf2/arr-subrange.exp: New files.
2014-02-26 10:39:25 -08:00
Pedro Alves 0dcb32c3ae Mention PR breakpoints/16292 in corresponding ChangeLog entry. 2014-02-26 16:33:13 +00:00
Pedro Alves f2fce0ca3d bsd-uthread.c: Don't install a to_xfer_partial method
Whatever the comment about deprecated_xfer_memory referred to,
deprecated_xfer_memory is gone now.  There's no need to install a
target method that just delegates, as that's what the default
delegator does already.

Tested by building an --enable-targets=all gdb on x86_64 Fedora 17.

gdb/
2014-02-26  Pedro Alves  <palves@redhat.com>

	* bsd-uthread.c (bsd_uthread_xfer_partial): Delete function.
	(bsd_uthread_target): Don't install bsd_uthread_xfer_partial as
	to_xfer_partial method.
2014-02-26 14:40:04 +00:00
Pedro Alves 7a44e40e8b eliminate target_ops->deprecated_xfer_memory
As no target uses it anymore, it can finally go away.

After removing the deprecated_xfer_memory handling from
default_xfer_partial, we can delete the latter, because the only thing
it does is delegate to the target beneath unconditionally, which is
what the delegator installed by target-delegates.c will do for us if
no to_xfer_partial method is installed.

This was the last user of de_fault, so that goes away too.

Tested on x86_64 Fedora 17.

gdb/
2014-02-26  Pedro Alves  <palves@redhat.com>

	* target.c (complete_target_initialization): Don't install
	default_xfer_partial as to_xfer_partial hook.
	(nomemory): Delete.
	(update_current_target): Don't INHERIT nor de_fault
	deprecated_xfer_memory.  Delete de_fault macro.
	(default_xfer_partial, deprecated_debug_xfer_memory): Delete.
	(setup_target_debug): Don't install a deprecated_xfer_memory hook.
	* target.h (struct target_ops) <deprecated_xfer_memory>: Delete
	field.
2014-02-26 14:39:23 +00:00
Pedro Alves bd265cd0bd go32-nat.c: Don't install a deprecated_xfer_memory method
This removes yet another instance of a deprecated_xfer_memory user.

Unfortunately djgpp's write_child function takes a non-const buffer
pointer, while GDB's xfer_partial api passes a const pointer.  To be
const-correct, we need to copy that buffer to a non-const buffer, and
pass the copy to write_child.  This is actually what
target.c:default_xfer_partial itself does, when calling into the
ops->deprecated_xfer_memory hook.

Tested by cross-building djgpp gdb, on x86-64 Fedora 17.

gdb/
2014-02-26  Pedro Alves  <palves@redhat.com>

	* go32-nat.c (my_write_child): New function.
	(go32_xfer_memory): Rewrite as to_xfer_partial helper.
	(go32_xfer_partial): New function.
	(init_go32_ops): Don't install a deprecated_xfer_memory hook.
	Instead install a to_xfer_partial hook.
2014-02-26 14:38:31 +00:00
Pedro Alves 9d46c4e5f5 nto-procfs.c: Don't install a deprecated_xfer_memory method
This removes yet another instance of a deprecated_xfer_memory user.

Completely untested.

gdb/
2014-02-26  Pedro Alves  <palves@redhat.com>

	* nto-procfs.c (procfs_xfer_memory): Adjust interface as a
	to_xfer_partial helper.  Rewrite.
	(procfs_xfer_partial): New function.
	(init_procfs_ops): Don't install a deprecated_xfer_memory hook.
	Install a to_xfer_partial hook.
2014-02-26 14:37:48 +00:00
Pedro Alves a1583b1fd9 remote-m32r-sdi.c: Don't install a deprecated_xfer_memory method
This removes yet another instance of a deprecated_xfer_memory user.

Tested by building a --enable-targets=all gdb, on x86-64 Fedora 17.

gdb/
2014-02-26  Pedro Alves  <palves@redhat.com>

	* remote-m32r-sdi.c (send_data): Constify 'buf' parameter.
	(m32r_xfer_memory): Adjust as a to_xfer_partial helper.
	(m32r_xfer_partial): New function.
	(init_m32r_ops): Don't install a deprecated_xfer_memory hook.
	Install a to_xfer_partial hook.
2014-02-26 14:37:14 +00:00
Pedro Alves 6df1b29f02 remote-mips.c: Don't install a deprecated_xfer_memory method
This removes another yet instance of a deprecated_xfer_memory user.

Tested by building a --enable-targets=all gdb, on x86-64 Fedora 17.

gdb/
2014-02-26  Pedro Alves  <palves@redhat.com>

	* remote-mips.c (mips_xfer_memory): Adjust as to_xfer_partial
	helper.
	(mips_xfer_partial): New function.
	(_initialize_remote_mips): Don't install a deprecated_xfer_memory
	hook.  Install a to_xfer_partial hook.
2014-02-26 14:36:03 +00:00
Joel Brobecker dc53a7adb5 DWARF: Add array DW_AT_bit_stride and DW_AT_byte_stride support
Consider the following declarations in Ada...

   type Item is range -32 .. 31;
   for Item'Size use 6;

   type Table is array (Natural range 0 .. 4) of Item;
   pragma Pack (Table);

... which declare a packed array whose elements are 6 bits long.
The debugger currently does not notice that the array is packed,
and thus prints values of this type incorrectly. This can be seen
in the "ptype" output:

    (gdb) ptype table
    type = array (0 .. 4) of foo.item

Normally, the debugger should print:

    (gdb) ptype table
    type = array (0 .. 4) of foo.item <packed: 6-bit elements>

The debugging information for this array looks like this:

        .uleb128 0xf    # (DIE (0x15c) DW_TAG_array_type)
        .long   .LASF9  # DW_AT_name: "pck__table"
        .byte   0x6     # DW_AT_bit_stride
        .long   0x1a9   # DW_AT_type
        .uleb128 0x10   # (DIE (0x16a) DW_TAG_subrange_type)
        .long   0x3b    # DW_AT_type
        .byte   0       # DW_AT_lower_bound
        .byte   0x4     # DW_AT_upper_bound
        .byte   0       # end of children of DIE 0x15c

The interesting part is the DW_AT_bit_stride attribute, which tells
the size of the array elements is 6 bits, rather than the normal
element type's size.

This patch adds support for this attribute by first creating
gdbtypes.c::create_array_type_with_stride, which is an enhanced
version of create_array_type taking an extra parameter as the stride.
The old create_array_type can then be re-implemented very simply
by calling the new create_array_type_with_stride.

We can then use this new function from dwarf2read, to create
arrays with or without stride.

gdb/ChangeLog:

        * gdbtypes.h (create_array_type_with_stride): Add declaration.
        * gdbtypes.c (create_array_type_with_stride): New function,
        renaming create_array_type, but with an added parameter
        called "bit_stride".
        (create_array_type): Re-implement using
        create_array_type_with_stride.
        * dwarf2read.c (read_array_type): Add support for DW_AT_byte_stride
        and DW_AT_bit_stride attributes.

gdb/testsuite/ChangeLog:

        * gdb.dwarf2/arr-stride.c: New file.
        * gdb.dwarf2/arr-stride.exp: New file.

The test, relying purely on generating an assembly file, only
verifies the type description of our array. But I was also
able to verify manually that the debugger print values of these
types correctly as well (which was not the case prior to this
patch).
2014-02-26 06:32:39 -08:00
Pedro Alves 12ab52e977 Multiple Ada task-specific breakpoints at the same address.
With the test changed as in the patch, against current mainline, we get:

 (gdb) PASS: gdb.ada/tasks.exp: info tasks before inserting breakpoint
 break break_me task 1
 Breakpoint 2 at 0x4030b0: file /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.ada/tasks/foo.adb, line 27.
 (gdb) PASS: gdb.ada/tasks.exp: break break_me task 1
 break break_me task 3
 Note: breakpoint 2 also set at pc 0x4030b0.
 Breakpoint 3 at 0x4030b0: file /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.ada/tasks/foo.adb, line 27.
 (gdb) PASS: gdb.ada/tasks.exp: break break_me task 3
 continue
 Continuing.
 [Switching to Thread 0x7ffff7dc7700 (LWP 27133)]

 Breakpoint 2, foo.break_me () at /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.ada/tasks/foo.adb:27
 27	      null;
 (gdb) FAIL: gdb.ada/tasks.exp: continue to breakpoint
 info tasks
    ID       TID P-ID Pri State                  Name
     1    63b010       48 Waiting on RV with 3   main_task
     2    63bd80    1  48 Accept or Select Term  task_list(1)
 *   3    63f510    1  48 Accepting RV with 1    task_list(2)
     4    642ca0    1  48 Accept or Select Term  task_list(3)
 (gdb) PASS: gdb.ada/tasks.exp: info tasks after hitting breakpoint

The breakpoint that caused a stop is breakpoint 3, but GDB end up
reporting (and running breakpoint commands of) "Breakpoint 2" instead.

The issue is that the bpstat_check_breakpoint_conditions logic of
"wrong thread" is missing the "wrong task" check.  This is usually
harmless, because the thread hop code in infrun.c code that handles
wrong-task-hitting-breakpoint does check for task-specific breakpoints
(within breakpoint_thread_match):

      /* Check if a regular breakpoint has been hit before checking
         for a potential single step breakpoint.  Otherwise, GDB will
         not see this breakpoint hit when stepping onto breakpoints.  */
      if (regular_breakpoint_inserted_here_p (aspace, stop_pc))
	{
	  if (!breakpoint_thread_match (aspace, stop_pc, ecs->ptid))
	    thread_hop_needed = 1;
	}

IOW, usually, when one only has a task specific breakpoint at a given
address, things work correctly.  Put another task-specific or
non-task-specific breakpoint there, and things break.

A patch that eliminates the special thread hop code in infrun.c is
what exposed this, as after that GDB solely relies on
bpstat_check_breakpoint_conditions to know whether the right or wrong
task hit a breakpoint.  IOW, given the latent bug, Ada task-specific
breakpoints become non-task-specific, and that is caught by the
testsuite, as:

 break break_me task 3
 Breakpoint 2 at 0x4030b0: file /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.ada/tasks/foo.adb, line 27.
 (gdb) PASS: gdb.ada/tasks.exp: break break_me task 3
 continue
 Continuing.
 [Switching to Thread 0x7ffff7fcb700 (LWP 17122)]

 Breakpoint 2, foo.break_me () at /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.ada/tasks/foo.adb:27
 27	      null;
 (gdb) PASS: gdb.ada/tasks.exp: continue to breakpoint
 info tasks
    ID       TID P-ID Pri State                  Name
     1    63b010       48 Waiting on RV with 2   main_task
 *   2    63bd80    1  48 Accepting RV with 1    task_list(1)
     3    63f510    1  48 Accept or Select Term  task_list(2)
     4    642ca0    1  48 Accept or Select Term  task_list(3)
 (gdb) FAIL: gdb.ada/tasks.exp: info tasks after hitting breakpoint

It was after seeing this that I thought of how to expose the bug with
current mainline.

Tested on x86_64 Fedora 17.

gdb/
2014-02-26  Pedro Alves  <palves@redhat.com>

	* breakpoint.c (bpstat_check_breakpoint_conditions): Handle
	task-specific breakpoints.

gdb/testsuite/
2014-02-26  Pedro Alves  <palves@redhat.com>

	* gdb.ada/tasks.exp: Set a task-specific breakpoint at break_me
	that won't ever trigger.  Make sure that GDB reports the correct
	breakpoint that caused the stop.
2014-02-26 14:22:33 +00:00
Pedro Alves d16461aeef Re-implement ia64-linux-nat.c::ia64_linux_xfer_partial
[description of this patch and ChangeLog entry by Joel Brobecker]
The recent implementation was questionable, and if it worked, it was
only by chance because the requested length is large enough that only
one read was sufficient.  Note that the implementation before that
also made that assumption, in the form of only handling
TARGET_OBJECT_UNWIND_TABLE xfer requests when offset was zero.

gdb/ChangeLog:

        * ia64-linux-nat.c (ia64_linux_xfer_partial): Reimplement
        handling of object == TARGET_OBJECT_UNWIND_TABLE.
2014-02-25 20:53:23 -05:00
Stan Shebs a8b1622022 Annotate comments for Doxygen. 2014-02-25 15:47:58 -08:00
Jan Kratochvil 71b7d79337 PR gdb/16626
gdb/testsuite/
2014-02-25  Jan Kratochvil  <jan.kratochvil@redhat.com>

	PR gdb/16626
	* gdb.base/auto-load.exp: Fix out-of-srctree run.

Message-ID: <87k3cjt3jl.fsf@fleche.redhat.com>
2014-02-25 20:47:09 +01:00
Tom Tromey b9e795ee55 remove target_ignore
This removes target_ignore, which isn't used any more.

2014-02-25  Tom Tromey  <tromey@redhat.com>

	* target.h (target_ignore): Don't declare.
	* target.c (target_ignore): Remove.
2014-02-25 11:17:35 -07:00
Jan Kratochvil 849c862eb2 PR gdb/16626
Fix auto-load 7.7 regression,
the regression affects any loading from /usr/share/gdb/auto-load .

5b2bf9471f is the first bad commit
commit 5b2bf9471f
Author: Doug Evans <xdje42@gmail.com>
Date:   Fri Nov 29 21:29:26 2013 -0800
    Move .debug_gdb_script processing to auto-load.c.
    Simplify handling of auto-loaded objfile scripts.

Fedora 20 x86_64
$ gdb -q /usr/lib64/libgobject-2.0.so
Reading symbols from /usr/lib64/libglib-2.0.so.0.3800.2...Reading symbols from
/usr/lib/debug/usr/lib64/libglib-2.0.so.0.3800.2.debug...done.
done.
(gdb) _

Fedora Rawhide x86_64
$ gdb -q /usr/lib64/libgobject-2.0.so
Reading symbols from /usr/lib64/libglib-2.0.so...Reading symbols from
/usr/lib/debug/usr/lib64/libglib-2.0.so.0.3990.0.debug...done.
done.
warning: File "/usr/lib64/libglib-2.0.so.0.3990.0-gdb.py" auto-loading has been declined by your `auto-load safe-path'
set to "$debugdir:$datadir/auto-load:/usr/bin/mono-gdb.py".
To enable execution of this file add
        add-auto-load-safe-path /usr/lib64/libglib-2.0.so.0.3990.0-gdb.py
line to your configuration file "/home/jkratoch/.gdbinit".
To completely disable this security protection add
        set auto-load safe-path /
line to your configuration file "/home/jkratoch/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
        info "(gdb)Auto-loading safe path"
(gdb) _

That is it tries to load "forbidden"
	/usr/lib64/libglib-2.0.so.0.3990.0-gdb.py
but it should load instead
	/usr/share/gdb/auto-load/usr/lib64/libglib-2.0.so.0.3990.0-gdb.py*
Although that is also not exactly this way, there does not exist any
	/usr/lib64/libglib-2.0.so.0.3990.0-gdb.py
despite regressed GDB says so.

gdb/
2014-02-24  Jan Kratochvil  <jan.kratochvil@redhat.com>

	PR gdb/16626
	* auto-load.c (auto_load_objfile_script_1): Change filename to
	debugfile.

gdb/testsuite/
2014-02-24  Jan Kratochvil  <jan.kratochvil@redhat.com>

	PR gdb/16626
	* gdb.base/auto-load-script: New file.
	* gdb.base/auto-load.c: New file.
	* gdb.base/auto-load.exp: New file.

Message-ID: <20140223212400.GA8831@host2.jankratochvil.net>
2014-02-25 18:32:32 +01:00
Jan Kratochvil e2f0d509b3 Fix dw2-icycle.exp -fsanitize=address GDB crash.
binutils readelf -wi:
 <4><a2>: Abbrev Number: 26 (DW_TAG_inlined_subroutine)
    <a3>   DW_AT_abstract_origin: <0x5a>
    <a7>   DW_AT_low_pc      : 0x400590
    <ab>   DW_AT_high_pc     : 0x4
    <af>   DW_AT_call_file   : 1
    <b0>   DW_AT_call_line   : 20
    <b1>   DW_AT_sibling     : <0xb8>
 <2><b8>: Abbrev Number: 35 (DW_TAG_inlined_subroutine)
    <b9>   DW_AT_abstract_origin: <0x5a>
    <bd>   DW_AT_low_pc      : 0x400590
    <c1>   DW_AT_high_pc     : 0x4
    <c5>   DW_AT_call_file   : 1
    <c6>   DW_AT_call_line   : 29

<b1> DW_AT_sibling points to the next DIE - but that DIE is 2 levels
upwards - definitely not a sibling.  This confuses GDB up to a crash:

==32143== ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6024000198ac at pc 0xb4d104 bp 0x7fff63e96e70 sp
0x7fff63e96e60
READ of size 1 at 0x6024000198ac thread T0
    #0 0xb4d103 in read_unsigned_leb128 (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb4d103)
    #1 0xb15f3c in peek_die_abbrev (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb15f3c)
    #2 0xb46185 in load_partial_dies (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb46185)
    #3 0xb103fb in process_psymtab_comp_unit_reader (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb103fb)
    #4 0xb0d2a9 in init_cutu_and_read_dies (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb0d2a9)
    #5 0xb1115f in process_psymtab_comp_unit (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb1115f)
    #6 0xb1235f in dwarf2_build_psymtabs_hard (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb1235f)
    #7 0xb05536 in dwarf2_build_psymtabs (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb05536)
    #8 0x86d5a5 in read_psyms (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0x86d5a5)
    #9 0x9b1c37 in require_partial_symbols (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0x9b1c37)
    #10 0x9bf2d0 in read_symbols (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0x9bf2d0)
    #11 0x9c014c in syms_from_objfile_1 (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0x9c014c)

gdb/testsuite/
2014-02-25  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Fix dw2-icycle.exp -fsanitize=address GDB crash.
	* gdb.dwarf2/dw2-icycle.S: Remove all DW_AT_sibling.

Message-ID: <20140224201011.GA28926@host2.jankratochvil.net>
2014-02-25 18:28:38 +01:00
Joel Brobecker 475109d870 Adjust ia64_linux_xfer_partial following to_xfer_partial API change.
ia64-linux-nat.c no longer compiles because ia64_linux_xfer_partial
no longer matches the to_xfer_partial prototype.  This patch fixes
the problem by adjusting it accordingly.

gdb/ChangeLog:

        * ia64-linux-nat.c (ia64_linux_xfer_partial): Add function
        documentation.  Adjust prototype to match the target_ops
        to_xfer_partial method.  Adjust implementation accordingly.
2014-02-25 11:21:55 -05:00
Hui Zhu 041ab8b484 Fix a format issue of ChangeLog. 2014-02-25 23:59:47 +08:00
Hui Zhu e186c3bd62 2014-02-25 Hui Zhu <hui@codesourcery.com>
* target.h (target_ops): Fix TARGET_DEFAULT_RETURN of
	to_traceframe_info.
2014-02-25 23:55:42 +08:00
Kevin Buettner 6d45194248 Use 16-bit integer type for rl78 register pairs.
This patch changes rl78-tdep.c so that a 16-bit type is used for
register pairs instead of a pointer type as was previously the case.
This will cause these register pairs to be displayed as integers
instead of as a data address with a 0xf0000 ORed in.

E.g. registers ax, bc, de, and hl might now be displayed like this:

    (gdb) info registers ax bc de hl
    ax             0x6      6
    bc             0x0      0
    de             0x10c3   4291
    hl             0x108d   423

Whereas, before, they were displayed as follows:

    (gdb) info registers ax bc de hl
    ax             0xf0006  0xf0006
    bc             0xf0000  0xf0000
    de             0xf10c3  0xf10c3
    hl             0xf108d  0xf108d

These pairs are 16 bit quantities and should be displayed as such.
This change also affects the way that the banked register pairs are
displayed.  Within GDB, the banked register pairs are named bank0_rp0,
bank0_rp1, .., bank3_rp2, bank3_rp3.

However, these register pairs need to be used as addresses in DWARF
expressions.  I have added 16 pseudo registers corresponding to banked
register pairs.  These new pseudo registers are all hidden from the
user and have a pointer type.  Values from these registers are
intended to be used in DWARF expressions.  Therefore,
rl78_dwarf_reg_to_regnum() has been adjusted to return these new
pseudo register numbers.

I had a much simpler patch which only changed the types, but it showed
a number of regressions due to integer values from the banked register
pairs being used as part of an address expression.  This current patch
shows no regressions and now displays values of register pairs
correctly.

	* rl78-tdep.c ( RL78_BANK0_RP0_PTR_REGNUM, RL78_BANK0_RP1_PTR_REGNUM)
	(RL78_BANK0_RP2_PTR_REGNUM, RL78_BANK0_RP3_PTR_REGNUM)
	(RL78_BANK1_RP0_PTR_REGNUM, RL78_BANK1_RP1_PTR_REGNUM)
	(RL78_BANK1_RP2_PTR_REGNUM, RL78_BANK1_RP3_PTR_REGNUM)
	(RL78_BANK2_RP0_PTR_REGNUM, RL78_BANK2_RP1_PTR_REGNUM)
	(RL78_BANK2_RP2_PTR_REGNUM, RL78_BANK2_RP3_PTR_REGNUM)
	(RL78_BANK3_RP0_PTR_REGNUM, RL78_BANK3_RP1_PTR_REGNUM)
	(RL78_BANK3_RP2_PTR_REGNUM, RL78_BANK3_RP3_PTR_REGNUM):
	New constants.
	(rl78_register_type): Use a data pointer type for SP and
	new pseudo registers mentioned above.  Use a 16 bit integer
	type for all other register pairs.
	(rl78_register_name, rl78_g10_register_name): Update for
	new pseudo registers.
	(rl78_pseudo_register_read): Likewise.
	(rl78_pseudo_register_write): Likewise.
	(rl78_dwarf_reg_to_regnum): Return register numbers representing
	to the newly added pseudo registers.
2014-02-25 00:32:45 -07:00
Doug Evans eddf0baefe * value.c (record_latest_value): Fix comment.
* printcmd.c (print_command_1): Remove code to handle -1 return from
	record_latest_value.
2014-02-24 14:01:45 -08:00
Doug Evans 50cc37c849 lib/gdb.exp (run_on_host): Log error output if program fails. 2014-02-24 13:39:14 -08:00
Pedro Alves e96027e0d9 procfs.c: Don't install a deprecated_xfer_memory method
This removes yet another instance of a deprecated_xfer_memory user,
and fixes a nasty regression as a side-effect:

    (gdb) start
    Temporary breakpoint 1 at 0x19070: file simple_main.adb, line 4.
    Starting program: /[...]/simple_main
    Warning:
    Cannot insert breakpoint 1.
    Cannot access memory at address 0x19070
    Cannot insert breakpoint -3.
    Temporarily disabling shared library breakpoints:
    breakpoint #-3

The regression was introduced by the to_xfer_partial transition
to return a status enum.  procfs_xfer_partial was updated but
not the case where object is TARGET_OBJECT_MEMORY.  As result,
procfs_xfer_partial was returning the length xfered rather than
the status, and the xfered buffer was left uninitialized.

gdb/
2014-02-19  Pedro Alves  <palves@redhat.com>

	* procfs.c (procfs_target): Don't install procfs_xfer_memory as
	deprecated_xfer_memory hook.
	(procfs_xfer_partial): Call procfs_xfer_memory instead
	of the deprecated_xfer_memory target hook.
	(procfs_xfer_memory): Adjust interface as a to_xfer_partial
	helper.
2014-02-24 12:49:33 -05:00
Yuanhui Zhang 0837c97695 Fix a GDB assert failure on windows
A GDB internal error is found on native mingw32 target.

(gdb) run
../../binutils-gdb/gdb/target.c:1483: internal-error:
target_xfer_partial: Assertion `*xfered_len > 0' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n)

This error was introduced by the following snippet in commit
9b409511d0

> @@ -2536,27 +2538,30 @@ windows_xfer_shared_libraries (struct target_ops *ops,
>      }
>
>    obstack_free (&obstack, NULL);
> -  return len;
> +  *xfered_len = (ULONGEST) len;
> +  return TARGET_XFER_OK;
>  }

In the original code, len is returned, which could be 0, but after that
commit, only TARGET_XFER_OK is returned, which is wrong.  If len is 0,
TARGET_XFER_EOF should be returned.  (it is 0 in enum
target_xfer_status declaration).

gdb:

2014-02-24  Yuanhui Zhang  <asmwarrior@gmail.com>

	* windows-nat.c (windows_xfer_shared_libraries): Return
	TARGET_XFER_EOF if LEN is zero to fix an assert failure when
	requested object is TARGET_OBJECT_LIBRARIES.
2014-02-24 15:49:33 +08:00
Yao Qi bc113b4e3e Rename TARGET_XFER_E_UNAVAILABLE to TARGET_XFER_UNAVAILABLE
Nowadays, TARGET_XFER_E_UNAVAILABLE isn't regarded as an error in
to_xfer_partial interface, so _E_ looks odd.  This patch is to
replace TARGET_XFER_E_UNAVAILABLE with TARGET_XFER_UNAVAILABLE,
and change its value from -2 to 2.  Since there is no comparison
on the value of 'enum target_xfer_status', so it should be safe.

gdb:

2014-02-24  Yao Qi  <yao@codesourcery.com>

	* target.h (enum target_xfer_status)
	<TARGET_XFER_E_UNAVAILABLE>: Rename it to ...
	<TARGET_XFER_UNAVAILABLE>: ... it with setting value 2
	explicitly.  New.
	* corefile.c (memory_error_message): User updated.
	* exec.c (section_table_read_available_memory): Likewise.
	* record-btrace.c (record_btrace_xfer_partial): Likewise.
	* target.c (target_xfer_status_to_string): Likewise.
	(raw_memory_xfer_partial): Likewise.
	(memory_xfer_partial_1, target_xfer_partial): Likewise.
	* valops.c (read_value_memory): Likewise.
	* exec.h: Update comments.
2014-02-24 14:31:42 +08:00
Yao Qi 01cb880427 Tweak target_xfer_status_to_string
This patch tweaks target_xfer_status_to_string on comments and argument
name.

gdb:

2014-02-24  Yao Qi  <yao@codesourcery.com>

	* target.c (target_xfer_status_to_string): Rename argument err
	to status.
	* target.h (target_xfer_status_to_string): Update declaration.
	Replace target_xfer_error_to_string with
	target_xfer_status_to_string in comment.
2014-02-24 14:16:36 +08:00
Yao Qi 93063aa69b Unbreak mips native build
When I build mips native gdb today, I get the follow error,

../../../git/gdb/mips-linux-nat.c: In function '_initialize_mips_linux_nat':
../../../git/gdb/mips-linux-nat.c:792:15: error: assignment from incompatible pointer type [-Werror]
cc1: all warnings being treated as errors

It looks an oversight of recent target_ops delegation patches.  This
patch is to fix the build error.

gdb:

2014-02-24  Yao Qi  <yao@codesourcery.com>

	* mips-linux-nat.c (super_close): Update its type.
	(mips_linux_close): Pass 'self' to super_close.
2014-02-24 12:03:05 +08:00
Yao Qi 5c328c057e Remove TARGET_XFER_STATUS_ERROR_P
This patch removes macro TARGET_XFER_STATUS_ERROR_P, as Pedro pointed
out during patches review that TARGET_XFER_STATUS_ERROR_P tends to
be unnecessary.

gdb:

2014-02-24  Yao Qi  <yao@codesourcery.com>

	* target.h (TARGET_XFER_STATUS_ERROR_P): Remove.
	* corefile.c (read_memory): Adjusted.
	* target.c (target_write_with_progress): Adjusted.
2014-02-24 11:27:37 +08:00
Yao Qi f73023dd06 Revert previous tweaks
As we migrate to the new to_xfer_partial interface, some of previous
tweaks become unnecessary, we don't have to check traceframe is
selected in each target implementation, so this patch below is
reverted.

  [PATCH] Send qXfer:traceframe-info:read when traceframe is selected.
  https://sourceware.org/ml/gdb-patches/2013-10/msg00752.html

Third, to_traceframe_info is only called when traceframe is selected,
that means it is only called when target is remote, tfile or ctf, so
this patch can be partially reverted,

  https://sourceware.org/ml/gdb-patches/2013-04/msg00000.html

gdb:

2014-02-23  Yao Qi  <yao@codesourcery.com>

	Revert two patches:

	2013-10-25  Yao Qi  <yao@codesourcery.com>

	* remote.c (remote_traceframe_info): Return early if
	traceframe is not selected.

	2013-07-19  Yao Qi  <yao@codesourcery.com>

	* target.c (update_current_target): Change the default action
	of 'to_traceframe_info' from tcomplain to return_zero.
	* target.h (struct target_ops) <to_traceframe_info>: Add more
	comments.
2014-02-23 11:44:28 +08:00
Yao Qi 5a2eb0ef7f Adjust read_value_memory to use to_xfer_partial
As the new to_xfer_partial implementations are done in ctf and tfile
targets, read_value_memory can be simplified a lot.  Call
target_xfer_partial in a loop, check return value, and set bytes
unavailable when necessary.

gdb:

2014-02-23  Yao Qi  <yao@codesourcery.com>

	* valops.c (read_value_memory): Rewrite it.  Call
	target_xfer_partial in a loop.
	* exec.h (section_table_available_memory): Remove declaration.
	Move comments to ...
	* exec.c (section_table_available_memory): ... here.  Make it static.
2014-02-23 11:44:27 +08:00
Yao Qi 1ee79381dd Use new to_xfer_partial interface in ctf and tfile target
This patch adjust both ctf and tfile target implementation of to_xfer_partial,
to return TARGET_XFER_E_UNAVAILABLE and set *XFERED_LEN if data is
unavailable.  Note that some code on xfer in exec.c can be shared, but
we can do it in a separate pass later.

gdb:

2014-02-23  Yao Qi  <yao@codesourcery.com>

	* exec.c (section_table_read_available_memory): New function.
	* exec.h (section_table_read_available_memory): Declare.
	* ctf.c (ctf_xfer_partial): Call
	section_table_read_available_memory.
	* tracefile-tfile.c (tfile_xfer_partial): Likewise.
2014-02-23 11:44:27 +08:00
Yao Qi 1ca49d376d Share code on to_xfer_partial for tfile and ctf target
In the to_xfer_partial implementations of ctf and tfile, the code on
reading from read-only sections is duplicated.  This patch moves it to
a separate function exec_read_partial_read_only.

gdb:

2014-02-23  Yao Qi  <yao@codesourcery.com>

	* ctf.c (ctf_xfer_partial): Move code to ...
	* exec.c (exec_read_partial_read_only): ... it.  New function.
	* tracefile-tfile.c (tfile_xfer_partial): Likewise.
	* tracefile.c: Include "exec.h".
	* exec.h (exec_read_partial_read_only): Declare.
2014-02-23 11:44:27 +08:00
Yao Qi a283690eb7 Let tracefile has_memory and has_all_memory.
At present, tfile target thinks it has memory but ctf doesn't.
This is an oversight when I added ctf target support.  This patch
moves the implementations of to_has_all_memory and to_has_memory to
upper layer.  After this change, both tfile and ctf target think
they have memory.

gdb:

2014-02-23  Yao Qi  <yao@codesourcery.com>

	* tracefile-tfile.c (tfile_has_all_memory): Remove.
	(tfile_has_memory): Remove.
	(init_tfile_ops): Don't set fields to_has_all_memory and
	to_has_memory of tfile_ops.
	* tracefile.c (tracefile_has_all_memory): New function.
	(tracefile_has_memory): New function.
	(init_tracefile_ops): Initialize fields to_has_all_memory and
	to_has_memory of 'ops'.
2014-02-23 11:44:27 +08:00
Yao Qi 12e03cd06a Share some code between ctf and tfile target.
This patch move the duplicated code between tfile and ctf
targets into file tracefile.c.  The common part of target_ops
fields are set in init_tracefile_ops.

gdb:

2014-02-23  Yao Qi  <yao@codesourcery.com>

	* ctf.c (ctf_has_stack, ctf_has_registers): Remove.
	(ctf_thread_alive, ctf_get_trace_status): Remove.
	(init_ctf_ops): Don't set some fields of ctf_ops.  Call
	init_tracefile_ops.
	* tracefile-tfile.c (tfile_get_trace_status): Remove.
	(tfile_has_stack, tfile_has_registers): Remove.
	(tfile_thread_alive): Remove.
	(init_tfile_ops): Don't set some fields of tfile_ops.  Call
	init_tracefile_ops.
	* tracefile.c (tracefile_has_stack): New function.
	(tracefile_has_registers): New function.
	(tracefile_thread_alive): New function.
	(tracefile_get_trace_status): New function.
	(init_tracefile_ops): New function.
	* tracefile.h (init_tracefile_ops): Declare.
2014-02-23 11:44:26 +08:00
Yao Qi 1139532379 Move tfile target to tracefile-tfile.c
This patch moves tfile target related code from tracepoint.c to
tracefile-tfile.c.

gdb:

2014-02-23  Yao Qi  <yao@codesourcery.com>

	* tracepoint.c (TFILE_PID): Move it to tracefile-tfile.c.
	(O_LARGEFILE): Likewise.
	(tfile_ops): Likewise.
	(TRACE_HEADER_SIZE): Likewise.
	(trace_fd, trace_frames_offset, cur_offset): Likewise.
	(cur_data_size): Likewise.
	(tfile_read, tfile_open, tfile_interp_line): Likewise.
	(tfile_close, tfile_files_info): Likewise.
	(tfile_get_trace_status): Likewise.
	(tfile_get_tracepoint_status): Likewise.
	(tfile_get_traceframe_address): Likewise.
	(tfile_trace_find, match_blocktype): Likewise.
	(traceframe_walk_blocks, traceframe_find_block_type): Likewise.
	(tfile_fetch_registers, tfile_xfer_partial): Likewise.
	(tfile_get_trace_state_variable_value): Likewise.
	(tfile_has_all_memory, tfile_has_memory): Likewise.
	(tfile_has_stack, tfile_has_registers): Likewise.
	(tfile_thread_alive, build_traceframe_info): Likewise.
	(tfile_traceframe_info, init_tfile_ops): Likewise.
	(_initialize_tracepoint): Don't call init_tfile_ops
	and add_target_with_completer.
	* tracefile-tfile.c: Include regcache.h, inferior.h, gdbthread.h,
	exec.h, completer.h and filenames.h.
	(_initialize_tracefile_tfile): New function.
2014-02-23 11:44:26 +08:00
Yao Qi 7951c4eb08 Move trace file writer out of tracepoint.c
This patch is a refactor which moves trace file writer related code
out of tracepoint.c, which has 6k LOC.  It moves general trace file
writer to a new file tracefile.c and moves tfile specific writer to
tracefile-tfile.c.

gdb:

2014-02-23  Yao Qi  <yao@codesourcery.com>

	* Makefile.in (REMOTE_OBS): Append tracefile.o and
	tracefile-tfile.o.
	(HFILES_NO_SRCDIR): Add tracefile.h.
	* ctf.c: Include "tracefile.h".
	* tracefile.h: New file.
	* tracefile.c: New file
	* tracefile-tfile.c: New file.
	* tracepoint.c: Include "tracefile.h".
	(free_uploaded_tps, free_uploaded_tsvs): Remove declarations.
	(stop_reason_names): Add const.
	(trace_file_writer_xfree): Move it to tracefile.c.
	(trace_save, trace_save_command, trace_save_tfile): Likewise.
	(trace_save_ctf): Likewise.
	(struct tfile_trace_file_writer): Move it to tracefile-tfile.c.
	(tfile_target_save, tfile_dtor, tfile_start): Likewise.
	(tfile_write_header, tfile_write_regblock_type): Likewise.
	(tfile_write_status, tfile_write_uploaded_tsv): Likewise.
	(tfile_write_uploaded_tp, tfile_write_definition_end): Likewise.
	(tfile_write_raw_data, tfile_end): Likewise.
	(tfile_trace_file_writer_new): Likewise.
	(free_uploaded_tp): Make it extern.
	(free_uploaded_tsv): Make it extern.
	(_initialize_tracepoint): Move code to register command 'tsave'
	to tracefile.c.
	* tracepoint.h (stop_reason_names): Declare.
	(struct trace_frame_write_ops): Move it to tracefile.h.
	(struct trace_file_write_ops): Likewise.
	(struct trace_file_writer): Likewise.
	(free_uploaded_tsvs, free_uploaded_tps): Declare.
2014-02-23 11:44:26 +08:00
Jan Kratochvil 184cd07257 Fix crash on process name "(sd-pam)" (PR 16594).
info os processes -fsanitize=address error
https://sourceware.org/bugzilla/show_bug.cgi?id=16594

info os processes
=================================================================
==5795== ERROR: AddressSanitizer: heap-use-after-free on address
0x600600214974 at pc 0x757a92 bp 0x7fff95dd9f00 sp 0x7fff95dd9ef0
READ of size 4 at 0x600600214974 thread T0
    #0 0x757a91 in get_cores_used_by_process (.../gdb/gdb+0x757a91)

At least Fedora 20 has process(es):
 6678 ?        Ss     0:00 /usr/lib/systemd/systemd --user
 6680 ?        S      0:00  \_ (sd-pam)

and GDB "info os processes" crashes on it as /proc/6680/stat contains:

6680 ((sd-pam)) S 6678 6678 6678 0 -1 1077961024 33 0 0 0 0 0 0 0 20 0 1 0 18568 73768960 120 18446744073709551615 1 1
0 0 0 0 0 4096 0 18446744073709551615 0 0 17 6 0 0 0 0 0 0 0 0 0 0 0 0 0

and GDB fails to find the proper end of the process name "((sd-pam))".
Therefore it reads core number off-by-one (it reads 17 instead of 6) and
overruns the array.

(1) Make the process name parsing more foolproof.

(2) Do not trust the parsed number from /proc/PID/stat and verify it against
    the array size.

I noticed that 'ps' gets this right, so I've peeked at its
sources, and it just looks for the first ')' starting at
the end.

dc072aced7:proc/readproc.c

Look for stat2proc.

Given ps does that, I believe the kernel won't ever be changed
in a way that would break it.  So it sounds like could do strrchr
from the end of stat just as well without worry, which is simpler.

gdb/
2014-02-21  Jan Kratochvil  <jan.kratochvil@redhat.com>

	PR gdb/16594
	* common/linux-osdata.c (linux_common_core_of_thread): Find the end of
	process name.
	(get_cores_used_by_process): New parameter num_cores, use it.
	(linux_xfer_osdata_processes): Pass num_cores to it.
	* linux-tdep.c (linux_info_proc, linux_fill_prpsinfo): Find the end of
	process name.

Message-ID: <20140217212826.GA15080@host2.jankratochvil.net>
2014-02-21 18:39:40 +01:00
Andreas Krebbel c63528fc47 Fix length arg in call to breakpoint_xfer_memory.
The patch "return target_xfer_status in to_xfer_partial" caused a
regression in various s390(x) test cases, because memory_xfer_partial
filled only the first byte of the read buffer from a breakpoint shadow:

    https://sourceware.org/ml/gdb-patches/2014-01/msg01071.html

This patch fixes the regression.
2014-02-21 15:55:37 +01:00
Pedro Alves ea4758f2dd Rename test.
I realized that the name of this test only made sense when considering
the old (never committed) implementation of the fix that came along
with the test originally, that forced a schedlock while a step-resume
(to get over the signal handler) was inserted.  The final solution
that went into the tree does not force that locking.

So this renames it to something more descriptive.

gdb/testsuite/
2014-02-21  Pedro Alves  <palves@redhat.com>

	* gdb.threads/step-after-sr-lock.c: Rename to ...
	* gdb.threads/signal-while-stepping-over-bp-other-thread.c: ... this.
	* gdb.threads/step-after-sr-lock.exp: Rename to ...
	* gdb.threads/signal-while-stepping-over-bp-other-thread.exp:
	... this.
2014-02-21 13:30:12 +00:00
Sergio Durigan Junior d7b30f6729 Fix for PR tdep/16397: SystemTap SDT probe support for x86 doesn't work with "triplet operands"
This is the continuation of what Joel proposed on:

<https://sourceware.org/ml/gdb-patches/2013-12/msg00977.html>

Now that I have already submitted and pushed the patch to split
i386_stap_parse_special_token into two smaller functions, it is indeed
simpler to understand this patch.

It occurs because, on x86, triplet displacement operands are allowed
(like "-4+8-20(%rbp)"), and the current parser for this expression is
buggy.  It does not correctly extract the register name from the
expression, which leads to incorrect evaluation.  The parser was also
being very "generous" with the expression, so I included a few more
checks to ensure that we're indeed dealing with a triplet displacement
operand.

This patch also includes testcases for the two different kind of
expressions that can be encountered on x86: the triplet displacement
(explained above) and the three-argument displacement (as in
"(%rbx,%ebx,-8)").  The tests are obviously arch-dependent and are
placed under gdb.arch/.

Message-ID: <m3mwj1j12v.fsf@redhat.com>
URL: <https://sourceware.org/ml/gdb-patches/2014-01/msg00310.html>

gdb/
2014-02-20  Sergio Durigan Junior  <sergiodj@redhat.com>

	PR tdep/16397
	* i386-tdep.c (i386_stap_parse_special_token_triplet): Check if a
	number comes after the + or - signs.  Adjust length of register
	name to be extracted.

gdb/testsuite/
2014-02-20  Sergio Durigan Junior  <sergiodj@redhat.com>

	PR tdep/16397
	* gdb.arch/amd64-stap-special-operands.exp: New file.
	* gdb.arch/amd64-stap-three-arg-disp.S: Likewise.
	* gdb.arch/amd64-stap-three-arg-disp.c: Likewise.
	* gdb.arch/amd64-stap-triplet.S: Likewise.
	* gdb.arch/amd64-stap-triplet.c: Likewise.
2014-02-20 18:49:09 -03:00
Doug Evans 3bc32da325 Add single sentence description to top of entry of previous commit. 2014-02-20 13:33:44 -08:00
Tom Tromey 8838afaf75 mark *_varobj_ops as "extern"
The AIX linker pointed out that gdb had multiple definitions of the
various *_varobj_ops objects.  This patch fixes the problem by marking
the declarations as "extern" in varobj.h.  Tested by rebuilding on
x86-64 Fedora 18 and on AIX.

2014-02-20  Tom Tromey  <tromey@redhat.com>

	* varobj.h (c_varobj_ops, cplus_varobj_ops, java_varobj_ops)
	(ada_varobj_ops): Mark "extern".
2014-02-20 14:12:33 -07:00
Doug Evans d86d4aafd4 Remove all_lwps global.
* inferiors.h (ptid_of): Move here from linux-low.h.
	(pid_of, lwpid_of): Ditto.
	* linux-aarch64-low.c (debug_reg_change_callback): Update, "entry"
	parameter is a struct thread_info * now.
	(aarch64_notify_debug_reg_change): Fetch pid from current_inferior
	directly.  Pass &all_threads to find_inferior instead of &all_lwps.
	(aarch64_stopped_data_address): Fetch lwpid from current_inferior
	directly.
	(aarch64_linux_prepare_to_resume): Fetch ptid from thread.
	(aarch64_arch_setup): Fetch lwpid from current_inferior directly.
	* linux-arm-low.c (update_registers_callback): Update, "entry"
	parameter is a struct thread_info * now.
	Fetch lwpid from current_inferior directly.
	(arm_insert_point): Pass &all_threads to find_inferior instead of
	&all_lwps.
	(arm_remove_point): Ditto.
	(arm_stopped_by_watchpoint): Fetch lwp from current_inferior.
	(arm_prepare_to_resume): Fetch pid from thread.
	(arm_read_description): Fetch lwpid from current_inferior directly.
	* linux-low.c (all_lwps): Delete.
	(delete_lwp): Delete call to remove_inferior.
	(handle_extended_wait): Fetch lwpid from thread.
	(add_lwp): Don't set lwp->entry.id.  Remove call to
	add_inferior_to_list.
	(linux_attach_lwp_1): Fetch pid from current_inferior directly.
	(linux_kill_one_lwp): Fetch ptid,lwpid from thread.
	(kill_one_lwp_callback): Ditto.
	(linux_kill): Don't dereference NULL pointer.
	Fetch ptid,lwpid from thread.
	(get_detach_signal): Fetch ptid from thread.
	(linux_detach_one_lwp): Fetch ptid,lwpid from thread.
	Simplify call to regcache_invalidate_thread.
	(delete_lwp_callback): Update, "entry" parameter is a
	struct thread_info * now.  Fetch pid from thread.
	(linux_mourn): Pass &all_threads to find_inferior instead of &all_lwps.
	(status_pending_p_callback): Update, "entry" parameter is a
	struct thread_info * now.  Fetch ptid from thread.
	(find_lwp_pid): Update, "entry" parameter is a
	struct thread_info * now.
	(linux_wait_for_lwp): Fetch pid from thread.
	(linux_fast_tracepoint_collecting): Fetch lwpid from thread.
	(maybe_move_out_of_jump_pad): Fetch lwpid from current_inferior.
	(enqueue_one_deferred_signal): Fetch lwpid from thread.
	(dequeue_one_deferred_signal): Ditto.
	(cancel_breakpoint): Fetch ptid from current_inferior.
	(linux_wait_for_event): Pass &all_threads to find_inferior,
	not &all_lwps.  Fetch ptid, lwpid from thread.
	(count_events_callback): Update, "entry" parameter is a
	struct thread_info * now.
	(select_singlestep_lwp_callback): Ditto.
	(select_event_lwp_callback): Ditto.
	(cancel_breakpoints_callback): Ditto.
	(linux_cancel_breakpoints): Pass &all_threads to find_inferior,
	not &all_lwps.
	(select_event_lwp): Ditto.  Fetch ptid from event_thread.
	(unsuspend_one_lwp): Update, "entry" parameter is a
	struct thread_info * now.
	(unsuspend_all_lwps): Pass &all_threads to find_inferior,
	not &all_lwps.
	(linux_stabilize_threads): Ditto.  And for for_each_inferior.
	Fetch lwpid from thread, not lwp.
	(linux_wait_1): Fetch ptid, lwpid from current_inferior.
	Pass &all_threads to find_inferior, not &all_lwps.
	(send_sigstop): Fetch lwpid from thread, not lwp.
	(send_sigstop_callback): Update, "entry" parameter is a
	struct thread_info * now.
	(suspend_and_send_sigstop_callback): Ditto.
	(wait_for_sigstop): Ditto.  Fetch ptid, lwpid from thread, lwp.
	(stuck_in_jump_pad_callback): Update, "entry" parameter is a
	struct thread_info * now.
	(move_out_of_jump_pad_callback): Ditto.  Fetch ptid, lwpid
	from thread, lwp.
	(lwp_running): Update, "entry" parameter is a
	struct thread_info * now.
	(stop_all_lwps): Fetch ptid from thread.
	Pass &all_threads to find_inferior, for_each_inferior, not &all_lwps.
	(linux_resume_one_lwp): Fetch lwpid from thread.
	(linux_set_resume_request): Update, "entry" parameter is a
	struct thread_info * now.  Fetch pid, lwpid from thread.
	(resume_status_pending_p): Update, "entry" parameter is a
	struct thread_info * now.
	(need_step_over_p): Ditto.  Fetch lwpid from thread.
	(start_step_over): Fetch lwpid from thread.
	(linux_resume_one_thread): Update, "entry" parameter is a
	struct thread_info * now.  Fetch lwpid from thread.
	(linux_resume): Pass &all_threads to find_inferior, not &all_lwps.
	(proceed_one_lwp): Update, "entry" parameter is a
	struct thread_info * now.  Fetch lwpid from thread.
	(unsuspend_and_proceed_one_lwp): Update, "entry" parameter is a
	struct thread_info * now.
	(proceed_all_lwps): Pass &all_threads to find_inferior, not &all_lwps.
	(unstop_all_lwps): Ditto.  Fetch lwpid from thread.
	(regsets_fetch_inferior_registers): Fetch lwpid from current_inferior
	directly.
	(regsets_store_inferior_registers): Ditto.
	(fetch_register, store_register): Ditto.
	(linux_read_memory, linux_write_memory): Ditto.
	(linux_request_interrupt): Ditto.
	(linux_read_auxv): Ditto.
	(linux_xfer_siginfo): Ditto.
	(linux_qxfer_spu): Ditto.
	(linux_qxfer_libraries_svr4): Ditto.
	* linux-low.h (ptid_of, pid_of, lwpid_of): Delete,
	moved to inferiors.h.
	(get_lwp): Delete.
	(get_thread_lwp): Update.
	(struct lwp_info): Delete member "entry".  Simplify comment for
	member "thread".
	(all_lwps): Delete.
	* linux-mips-low.c (mips_read_description): Fetch lwpid from
	current_inferior directly.
	(update_watch_registers_callback): Update, "entry" parameter is a
	struct thread_info * now.  Fetch pid from thread.
	(mips_linux_prepare_to_resume): Fetch ptid from thread.
	(mips_insert_point): Fetch lwpid from current_inferior.
	Pass &all_threads to find_inferior, not &all_lwps.
	(mips_remove_point): Pass &all_threads to find_inferior, not &all_lwps.
	(mips_stopped_by_watchpoint): Fetch lwpid from current_inferior
	directly.
	(mips_stopped_data_address): Ditto.
	* linux-s390-low.c (s390_arch_setup): Fetch pid from current_inferior
	directly.
	* linux-tile-low.c (tile_arch_setup): Ditto.
	* linux-x86-low.c (x86_get_thread_area): Fetch lwpid from thread.
	(update_debug_registers_callback): Update, "entry" parameter is a
	struct thread_info * now.  Fetch pid from thread.
	(i386_dr_low_set_addr): Fetch pid from current_inferior directly.
	Pass &all_threads to find_inferior, not &all_lwps.
	(i386_dr_low_get_addr): Fetch ptid from current_inferior directly.
	(i386_dr_low_set_control): Fetch pid from current_inferior directly.
	Pass &all_threads to find_inferior, not &all_lwps.
	(i386_dr_low_get_control): Fetch ptid from current_inferior directly.
	(i386_dr_low_get_status): Ditto.
	(x86_linux_prepare_to_resume): Fetch ptid from thread.
	(x86_siginfo_fixup): Fetch lwpid from current_inferior directly.
	(x86_linux_read_description): Ditto.
	* proc-service.c (ps_getpid): Fetch pid from current_inferior directly.
2014-02-20 12:25:18 -08:00
Tom Tromey 05227d1410 minor cleanup in dbxread.c
I happened to notice that last_o_file_start is write-only in
read_dbx_symtab.  This patch removes it.  Tested by rebuilding.

2014-02-20  Tom Tromey  <tromey@redhat.com>

	* dbxread.c (read_dbx_symtab): Remove last_o_file_start.
2014-02-20 12:17:03 -07:00
Doug Evans 3b8361aa0f * inferiors.c (get_first_inferior): Fix buglet. 2014-02-20 11:11:34 -08:00
Joel Brobecker 83deb43f87 Simplify .section in dw2-icycle.S
The arm-elf assembler chokes on the extra parameters in the .section
pseudo-op, so this patch removes them.

gdb/testsuite/ChangeLog:

        * gdb.dwarf2/dw2-icycle.S: Remove second and third parameters
        in .section pseudo-op.
2014-02-20 18:38:44 +01:00
Doug Evans 1254eefca2 Move containing_scm arg from gdbscm_fill_eqable_gsmob_ptr_slot
to gdbscm_init_eqable_gsmob.

	* guile/scm-gsmob.c (gdbscm_init_eqable_gsmob): New arg containing_scm.
	All callers updated.
	(gdbscm_fill_eqable_gsmob_ptr_slot): Delete arg containing_scm.
	All callers updated.
	* guile/guile-internal.h (gdbscm_init_eqable_gsmob): Update.
	(gdbscm_fill_eqable_gsmob_ptr_slot): Update.
2014-02-20 09:27:12 -08:00
Doug Evans 8c3cb9fa44 fix whitespace in previous commit 2014-02-20 09:16:32 -08:00
Doug Evans adde2bff07 Fix PR symtab/16581
* dwarf2read.c (struct die_info): New member in_process.
	(reset_die_in_process): New function.
	(process_die): Set it at the start, reset when returning.
	(inherit_abstract_dies): Only call process_die if origin_child_die
	not already being processed.

	testsuite/
	* gdb.dwarf2/dw2-icycle.S: New file.
	* gdb.dwarf2/dw2-icycle.c: New file.
	* gdb.dwarf2/dw2-icycle.exp: New file.
2014-02-20 09:13:53 -08:00
Joel Brobecker 3be75f87b9 windows-nat.c: Bring comment back regarding handling of DLL load events.
This patch brings back a comment that got stripped down a bit too much
during a recent change.

gdb/ChangeLog:

        * windows-nat.c (handle_unload_dll): Add function documentation.
        (do_initial_windows_stuff): Add comment explaining why we wait
        until after inferior initialization has finished before
        processing all DLLs.
2014-02-20 17:21:50 +01:00
Joel Brobecker 47f7ffdb18 Simplify windows-nat.c::get_module_name
Now that get_module_name is no longer called for handling DLL events,
we can simplify it a bit, knowing that the only use is to get the
executable's filename.

While doing so, we adjusted the implementation a bit to avoid
references to DLLs, renamed it to make its more-targeted usage
more explicit, moved it right before the only function that uses it.
We also remove the use of hard-coded length for the buffers being
used.

gdb/ChangeLog:

	* windows-nat.c (get_module_name): Delete.
	(windows_get_exec_module_filename): New function, mostly
	inspired from get_module_name.
	(windows_pid_to_exec_file): Replace call to get_module_name
	by call to windows_get_exec_module_filename.
2014-02-20 09:43:03 +01:00
Joel Brobecker 1cd9feab11 Windows: Rely purely on event info when handling DLL load event
When a DLL gets loaded an the debugger gets a debug event about it,
the currently implementation in handle_load_dll currently tries to
fetch the DLL's name by first iterating over all DLLs known to
the system.  It should be sufficient to rely on the name provided
with the event, however, especially in the situation we are now,
where we now know that we're past the statup phase for our inferior.

This patch therefore simplifies windows-nat.c::handle_load_dll to
only rely on the event's lpImageName.

It also updates the function's comment to document the assumption
regarding not being during the inferior's startup phase. And while
at it, it fixes the function documentation, which was probably
unintentionally inherited from another function (perhaps windows_wait).

gdb/ChangeLog:

	* windows-nat.c (handle_load_dll): Rewrite this function's
	introductory comment.  Remove code using get_module_name
	to get the DLL's name.
2014-02-20 09:41:35 +01:00
Joel Brobecker ea39ad355e Ignore DLL load/unload events during inferior initialization.
This patch aims at simplifying DLL handling during the inferior
initialization (process creation during the "run", or during an
"attach"). Instead of processing each DLL load event, which is
sometimes incomplete, we ignore these events until the inferior
has completed its startup phase, and then just iterate over all
DLLs via EnumProcessModules.

gdb/ChangeLog:

        * windows-nat.c (get_windows_debug_event): Ignore
        LOAD_DLL_DEBUG_EVENT and UNLOAD_DLL_DEBUG_EVENT
        if windows_initialization_done == 0.
        (windows_add_all_dlls): Renames windows_ensure_ntdll_loaded.
        Adjust implementation to always load all DLLs.
        (do_initial_windows_stuff): Replace call to
        windows_ensure_ntdll_loaded by call to windows_add_all_dlls.
2014-02-20 09:40:20 +01:00
Joel Brobecker 9506028490 Deprecate windows-specific dll-symbols command and aliases
The "dll-symbols" command, specific to native Windows platforms,
gives the impression that the symbols were not loaded, first
because it completes silently, and second because the "info shared"
output does not get updated after the command completes:

    (gdb) dll-symbols C:\WINDOWS\syswow64\rpcrt4.dll
    (gdb) info shared
    From        To          Syms Read   Shared Object Library
    [...]
    0x77e51000  0x77ee2554  No          C:\WINDOWS\system32\rpcrt4.dll

(we exected the "Syms Read" column to read "Yes").

As far as I can tell, the symbols actually do get loaded, but completely
independently from the solib framework, which explains the silent
loading and the fact that the "Syms Read" column does not get updated.
See windows-nat.c::safe_symbol_file_add_stub, which calls symbol_file_add
instead of calling solib_add.

But, aside from the fact that the "Syms Read" status does not get
updated, I also noticed that it does not take into account the DLL's
actual load address when loading its symbols. As a result, I believe
that we get it wrong if the DLL does not get loaded at the prefered
address.

Rather than trying to fix this command, there does not seem to be
a reason other than historical for having Windows-specific commands
which essentially re-implements the "sharedlibrary" command. The
command interface is slightly different (the latter takes a regexp
rather than a plain filename), but it should be just as easy to use
the "sharedlibrary" command, or its "share" alias, as usisng the
"dll-symbols" command. For instance:

    (gdb) share rpcrt4.dll
    Reading symbols from C:\WINDOWS\system32\rpcrt4.dll...(no debugging symbols found)...done.
    Loaded symbols for C:\WINDOWS\system32\rpcrt4.dll
    (gdb) info shared
    From        To          Syms Read   Shared Object Library
    [...]
    0x77e51000  0x77ee2554  Yes (*)     C:\WINDOWS\system32\rpcrt4.dll

This patch therefore deprecates the "dll-symbols" command, as well
as its two aliases "add-shared-symbol-files" and "assf", with a view
of deleting them as soon as the 7.8 branch gets cut.

gdb/ChangeLog:

	* windows-nat.c (_initialize_windows_nat): Deprecate the
	"dll-symbols" command.  Turn the "add-shared-symbol-files"
	and "assf" aliases into commands, and deprecate them as well.
	* NEWS: Add entry explaining that "dll-symbols" and its two
	aliases are now deprecated.

gdb/doc/ChangeLog:

        * gdb.texinfo (Files): Document "add-shared-symbol-files"
        and "assf" as being deprecated.
        (Cygwin Native): Likewise for "dll-symbols".
        (Non-debug DLL Symbols): Remove reference to "dll-symbols"
        as a way to force the loading of symbols from a DLL.
2014-02-20 09:31:59 +01:00
Joel Brobecker 8d4fdb120d Fix ARI warning in thread-thread.c::dec_thread_get_ada_task_ptid
This patch fixes the following ARI warning:

    gdb/dec-thread.c:695: regression: multi-line string: Multi-line string
    must have the newline escaped

I think the new-line was unintentional, so I simply removed it,
and then reformatted the string to fit within our 70-80 max characters-
per-line rule.

gdb/ChangeLog:

       * dec-thread.c (dec_thread_get_ada_task_ptid): Avoid unescaped
       new-line in debug string.  Remove trailing spaces.
2014-02-20 08:56:35 +01:00
Stan Shebs 1b28144374 darwin-nat.c (darwin_xfer_partial): Fix return type. 2014-02-19 16:48:26 -08:00
Doug Evans f7667f0de6 Add backlink from lwp_info to thread_info.
* gdbthread.h (add_thread): Change result type to struct thread_info *.
	* inferiors.c (add_thread): Change result type to struct thread_info *.
	All callers updated.
	(add_lwp): Call add_thread here instead of in callers.
	All callers updated.
	* linux-low.h (get_lwp_thread): Rewrite.
	(struct lwp_info): New member "thread".

This speeds up gdbserver attach in non-stop mode because now get_lwp_thread
doesn't do a linear search for the corresponding thread_info object.
2014-02-19 16:38:44 -08:00
Doug Evans b3312d8019 * linux-low.c (add_lwp): Change result to struct lwp_info *.
All callers updated.
2014-02-19 16:22:51 -08:00
Doug Evans ecc6f45c3b * inferiors.c (add_thread): Fix whitespace. 2014-02-19 16:19:10 -08:00
Siva Chandra f7bd0f7854 Call overloaded operators to perform operations on gdb.Value objects.
* NEWS: Add entry for the new feature
	* python/py-value.c (valpy_binop): Call value_x_binop for struct
	and class values.

	testsuite/
	* gdb.python/py-value-cc.cc: Improve test case to enable testing
	operations on gdb.Value objects.
	* gdb.python/py-value-cc.exp: Add new test to test operations on
	gdb.Value objects.

	doc/
	* python.texi (Values From Inferior): Add description about the
	new feature.
2014-02-19 15:47:45 -08:00
Doug Evans 649ebbcaef Replace code accessing list implementation details with API calls.
* dll.c (clear_dlls): Replace accessing list implemention details
	with API function.
	* gdbthread.h (get_first_thread): Declare.
	* inferiors.c (for_each_inferior_with_data): New function.
	(get_first_thread): New function.
	(find_thread_ptid): Simplify.
	(get_first_inferior): New function.
	(clear_list): Delete.
	(one_inferior_p): New function.
	(clear_inferior_list): New function.
	(clear_inferiors): Update.
	* inferiors.h (for_each_inferior_with_data): Declare.
	(clear_inferior_list): Declare.
	(one_inferior_p): Declare.
	(get_first_inferior): Declare.
	* linux-low.c (linux_wait_for_event): Replace accessing list
	implemention details with API function.
	* server.c (target_running): Ditto.
	(accumulate_file_name_length): New function.
	(emit_dll_description): New function.
	(handle_qxfer_libraries): Replace accessing list implemention
	details with API function.
	(handle_qxfer_threads_worker): New function.
	(handle_qxfer_threads_proper): Replace accessing list implemention
	details with API function.
	(handle_query): Ditto.
	(visit_actioned_threads_callback_ftype): New typedef.
	(visit_actioned_threads_data): New struct.
	(visit_actioned_threads): Rewrite to be find_inferior callback.
	(resume): Call find_inferior.
	(handle_status): Replace accessing list implemention
	details with API function.
	(process_serial_event): Replace accessing list implemention details
	with API function.
	* target.c (set_desired_inferior): Replace accessing list implemention
	details with API function.
	* tracepoint.c (same_process_p): New function.
	(gdb_agent_about_to_close): Replace accessing list implemention
	details with API function.
	* win32-low.c (child_delete_thread): Replace accessing list
	implemention details with API function.
	(match_dll_by_basename): New function.
	(dll_is_loaded_by_basename): New function.
	(win32_ensure_ntdll_loaded): Replace accessing list implemention
	details call to dll_is_loaded_by_basename.
2014-02-19 15:30:38 -08:00
Doug Evans 80894984a6 Rename inferior_list_entry uses from "head" to "entry" for consistency.
* dll.h (struct dll_info): Add comment.
	* gdbthread.h (struct thread_info): Add comment.
	(current_ptid): Simplify.
	* inferiors.c (add_process): Update.
	(remove_process): Update.
	* inferiors.h (struct process_info): Rename member "head" to "entry".
	* linux-low.c (delete_lwp): Update.
	(add_lwp): Update.
	(last_thread_of_process_p): Update.
	(kill_one_lwp_callback, linux_kill): Update.
	(status_pending_p_callback): Update.
	(wait_for_sigstop): Update.  Simplify read of ptid.
	(start_step_over): Update.
	* linux-low.h (ptid_of, pid_of, lwpid_of): Update.
	(get_lwp_thread): Update.
	(struct lwp_info): Rename member "head" to "entry".
	* regcache.h (inferior_list_entry): Delete.
	* server.c (kill_inferior_callback): Update.
	(detach_or_kill_inferior_callback): Update.
	(print_started_pid): Update.
	(print_attached_pid): Update.
	(process_serial_event): Simplify read of ptid.
	* thread-db.c (thread_db_create_event): Update.
	(thread_db_get_tls_address): Update.
	* win32-low.c (current_inferior_ptid): Simplify.
2014-02-19 14:51:55 -08:00
Stan Shebs 399ebc3d1e List Yao Qi as nios2 maintainer 2014-02-19 13:38:32 -08:00
Pedro Alves c658158d93 common/ptid.h: Mention that process_stratum targets should prefer ptid.lwp.
It's best that we standardize on process_stratum targets using the
ptid.lwp field to store thread ids.  The idea being leave the ptid.tid
field free for any thread_stratum target that might want to sit on
top.  This patch adds a comment in that direction to struct ptid's
definition.

gdb/
2014-02-19  Pedro Alves  <palves@redhat.com>

	* common/ptid.h (struct ptid): Mention that process_stratum
	targets should prefer ptid.lwp.
2014-02-19 18:27:01 +00:00
Pedro Alves ba3481708d remote.c: Use the ptid.lwp field to store remote thread ids rather than ptid.tid.
From GDB's perspective, independently of how the target really
implements threads, gdb/remote sees all threads as if kernel/system
threads.  A rationale along theses lines led to gdbserver storing
thread ids in ptid.lwp in all ports.

Because remote.c is currently using ptid.tid, we can't make gdbserver
and gdb share bits of remote-specific code that manipulates ptids
(e.g., write_ptid/read_ptid).

This patch thus makes remote.c use ptid.lwp instead of ptid.tid.

I believe that on the GDB side too, it's best that we standardize on
process_stratum targets using the ptid.lwp field to store thread ids
anyway.  The idea being leave the ptid.tid field free for any
thread_stratum target that might want to sit on top.

Tested on x86_64 Fedora 17, w/ local gdbserver.

gdb/
2014-02-19  Pedro Alves  <palves@redhat.com>

	* remote.c (remote_thread_alive, write_ptid, read_ptid)
	(read_ptid, remote_newthread_step, remote_threads_extra_info)
	(remote_get_ada_task_ptid, append_resumption, remote_stop_ns)
	(threadalive_test, remote_pid_to_str): Use the ptid.lwp field to
	store remote thread ids rather than ptid.tid.
	(_initialize_remote): Adjust.
2014-02-19 18:25:40 +00:00
Tom Tromey ac01945bf1 convert to_get_unwinder and to_get_tailcall_unwinder to methods
This converts to_get_unwinder and to_get_tailcall_unwinder to methods
and arranges for them to use the new delegation scheme.

This just lets us avoid having a differing style (neither new-style
nor INHERIT) of delegation in the tree.

2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target.c (target_get_unwinder): Rewrite.
	(target_get_tailcall_unwinder): Rewrite.
	* record-btrace.c (record_btrace_to_get_unwinder): New function.
	(record_btrace_to_get_tailcall_unwinder): New function.
	(init_record_btrace_ops): Update.
	* target.h (struct target_ops) <to_get_unwinder,
	to_get_tailcall_unwinder>: Now function pointers.  Use
	TARGET_DEFAULT_RETURN.
2014-02-19 07:48:49 -07:00
Tom Tromey 8476dc92e4 fix buglet in nto-procfs.c
I happened to notice that nto-procfs.c defines
procfs_remove_hw_breakpoint but never uses it.  This caused it not to
be updated by my target-method-updating script.  This patch fixes the
function and installs it properly.  I have no way to test this,
however.

2014-02-19  Tom Tromey  <tromey@redhat.com>

	* nto-procfs.c (procfs_remove_hw_breakpoint): Add 'self'
	argument.
	(init_procfs_ops): Correctly set to_remove_hw_breakpoint.
2014-02-19 07:48:48 -07:00
Tom Tromey c0eca49f4e convert to_decr_pc_after_break
This converts to_decr_pc_after_break to the new style of delegation,
removing forward_target_decr_pc_after_break.

2014-02-19  Tom Tromey  <tromey@redhat.com>

	* record-btrace.c (record_btrace_decr_pc_after_break): Delegate
	directly.
	* target-delegates.c: Rebuild.
	* target.h (struct target_ops) <to_decr_pc_after_break>: Use
	TARGET_DEFAULT_FUNC.
	* target.c (default_target_decr_pc_after_break): Rename from
	forward_target_decr_pc_after_break.  Simplify.
	(target_decr_pc_after_break): Rely on delegation.
2014-02-19 07:48:47 -07:00
Tom Tromey 596b6b39ab remove some calls to INHERIT and de_fault
This removes a few unnecessary calls to INHERIT and de_fault:

* to_doc is only used when a target is registered
* to_magic is only used when a target is pushed and not useful for
  current_target.
* to_open and to_close are only ever called using a specific
  target_ops object; there is no need to de_fault them.

2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target.c (update_current_target): Do not INHERIT to_doc or
	to_magic.  Do not de_fault to_open or to_close.
2014-02-19 07:48:46 -07:00
Tom Tromey b427c1bc16 remove exec_set_find_memory_regions
exec_set_find_memory_regions is used to modify the exec target.
However, it only has a single caller, and so it is much clearer to
simply set the appropriate field directly.  It's also better for the
coming multi-target world to avoid this kind of global state change
anyway.

2014-02-19  Tom Tromey  <tromey@redhat.com>

	* gcore.h (objfile_find_memory_regions): Declare.
	* gcore.c (objfile_find_memory_regions): No longer static.  Add
	"self" argument.
	(_initialize_gcore): Don't call exec_set_find_memory_regions.
	* exec.c: Include gcore.h.
	(exec_set_find_memory_regions): Remove.
	(exec_find_memory_regions): Remove.
	(exec_do_find_memory_regions): Remove.
	(init_exec_ops): Update.
	* defs.h (exec_set_find_memory_regions): Remove.
2014-02-19 07:48:45 -07:00
Tom Tromey 9b1440374c pass NULL to TARGET_DEFAULT_RETURN when appropriate
This changes instances of TARGET_DEFAULT_RETURN(0) to
TARGET_DEFAULT_RETURN(NULL) when appropriate.  The use of "0" was a
relic from an earlier implementation of make-target-delegates; and I
didn't want to go back through the long patch series, fixing up
conflicts, just to change this small detail.

2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.h (struct target_ops) <to_extra_thread_info,
	to_thread_name, to_pid_to_exec_file, to_get_section_table,
	to_memory_map, to_read_description, to_traceframe_info>: Use NULL,
	not 0, in TARGET_DEFAULT_RETURN.
2014-02-19 07:48:44 -07:00
Tom Tromey 555bbdeb94 remove function casts from target.c
This cleans up target.c to avoid function casts.

2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target.c (complete_target_initialization): Remove casts.  Use
	return_zero_has_execution.
	(return_zero): Add "ignore" argument.
	(return_zero_has_execution): New function.
	(init_dummy_target): Remove casts.  Use
	return_zero_has_execution.
2014-02-19 07:48:43 -07:00
Tom Tromey be4ddd36d6 minor cleanups to update_current_target
During the conversion I kept all the "do not inherit" comments in
update_current_target.  However, now they are not needed.  This patch
updates the comments for INHERIT and de_fault, and removes the
somewhat odd INHERIT of to_stratum.

2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target.c (update_current_target): Update comments.  Do not
	INHERIT to_stratum.
2014-02-19 07:48:42 -07:00
Tom Tromey 2117c711ae change delegation for to_read_description
This switches to_read_description to the "new normal" delegation
scheme.  This one was a bit trickier than the other changes due to the
way that target_read_description handled delegation.  I examined all
the target implementations of to_read_description and changed the ones
returning NULL to instead delegate.

2014-02-19  Tom Tromey  <tromey@redhat.com>

	* arm-linux-nat.c (arm_linux_read_description): Delegate when
	needed.
	* corelow.c (core_read_description): Delegate when needed.
	* remote.c (remote_read_description): Delegate when needed.
	* target-delegates.c: Rebuild.
	* target.c (target_read_description): Rewrite.
	* target.h (struct target_ops) <to_read_description>: Update
	comment.  Use TARGET_DEFAULT_RETURN.
2014-02-19 07:48:41 -07:00
Tom Tromey e88ef65ce5 convert to_can_run
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (update_current_target): Don't inherit or default
	to_can_run.
	(find_default_run_target): Check against delegate_can_run.
	* target.h (struct target_ops) <to_can_run>: Use
	TARGET_DEFAULT_RETURN.
2014-02-19 07:48:40 -07:00
Tom Tromey 86a0854a69 convert to_disconnect
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (target_disconnect): Unconditionally delegate.
	* target.h (struct target_ops) <to_disconnect>: Use
	TARGET_DEFAULT_NORETURN.
2014-02-19 07:48:40 -07:00
Tom Tromey ee97f592f2 convert to_stop_recording
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* record.c (record_stop): Unconditionally delegate.
	* target-delegates.c: Rebuild.
	* target.c (target_stop_recording): Unconditionally delegate.
	* target.h (struct target_ops) <to_stop_recording>: Use
	TARGET_DEFAULT_IGNORE.
2014-02-19 07:48:39 -07:00
Tom Tromey 6dc7fcf4c1 convert to_enable_btrace
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (target_enable_btrace): Unconditionally delegate.
	* target.h (struct target_ops) <to_enable_btrace>: Use
	TARGET_DEFAULT_NORETURN.
2014-02-19 07:48:38 -07:00
Tom Tromey eb5b20d490 convert to_read_btrace
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (target_read_btrace): Unconditionally delegate.
	* target.h (struct target_ops) <to_read_btrace>: Use
	TARGET_DEFAULT_NORETURN.
2014-02-19 07:48:37 -07:00
Tom Tromey 9ace480d62 convert to_teardown_btrace
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (target_teardown_btrace): Unconditionally delegate.
	* target.h (struct target_ops) <to_teardown_btrace>: Use
	TARGET_DEFAULT_NORETURN.
2014-02-19 07:48:36 -07:00
Tom Tromey 8dc292d321 convert to_disable_btrace
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (target_disable_btrace): Unconditionally delegate.
	* target.h (struct target_ops) <to_disable_btrace>: Use
	TARGET_DEFAULT_NORETURN.
2014-02-19 07:48:35 -07:00
Tom Tromey 58a5184e2a convert to_search_memory
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (default_search_memory): New function.
	(simple_search_memory): Update comment.
	(target_search_memory): Unconditionally delegate.
	* target.h (struct target_ops) <to_search_memory>: Use
	TARGET_DEFAULT_FUNC.
2014-02-19 07:48:34 -07:00
Tom Tromey 8de71aab66 convert to_auxv_parse
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* auxv.c (default_auxv_parse): No longer static.
	(target_auxv_parse): Unconditionally delegate.
	* auxv.h (default_auxv_parse): Declare.
	* target-delegates.c: Rebuild.
	* target.c: Include auxv.h.
	* target.h (struct target_ops) <to_auxv_parse>: Use
	TARGET_DEFAULT_FUNC.
2014-02-19 07:48:33 -07:00
Tom Tromey 6b2c5a57e1 convert to_memory_map
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (target_memory_map): Unconditionally delegate.
	* target.h (struct target_ops) <to_memory_map>: Use
	TARGET_DEFAULT_RETURN.
2014-02-19 07:48:32 -07:00
Tom Tromey cbffc06527 convert to_thread_alive
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (target_thread_alive): Unconditionally delegate.
	* target.h (struct target_ops) <to_thread_alive>: Use
	TARGET_DEFAULT_RETURN.
2014-02-19 07:48:31 -07:00
Tom Tromey f09e210795 convert to_save_record
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (target_save_record): Unconditionally delegate.
	* target.h (struct target_ops) <to_save_record>: Use
	TARGET_DEFAULT_NORETURN.
2014-02-19 07:48:30 -07:00
Tom Tromey 0736692509 convert to_delete_record
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (target_delete_record): Unconditionally delegate.
	* target.h (struct target_ops) <to_delete_record>: Use
	TARGET_DEFAULT_NORETURN.
2014-02-19 07:48:29 -07:00
Tom Tromey dd2e9d25a1 convert to_record_is_replaying
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (target_record_is_replaying): Unconditionally
	delegate.
	* target.h (struct target_ops) <to_record_is_replaying>: Use
	TARGET_DEFAULT_RETURN.
2014-02-19 07:48:28 -07:00
Tom Tromey 671e76cc63 convert to_goto_record_begin
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (target_goto_record_begin): Unconditionally delegate.
	* target.h (struct target_ops) <to_goto_record_begin>: Use
	TARGET_DEFAULT_NORETURN.
2014-02-19 07:48:27 -07:00
Tom Tromey e9179bb3de convert to_goto_record_end
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (target_goto_record_end): Unconditionally delegate.
	* target.h (struct target_ops) <to_goto_record_end>: Use
	TARGET_DEFAULT_NORETURN.
2014-02-19 07:48:27 -07:00
Tom Tromey 05969c841a convert to_goto_record
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (target_goto_record): Unconditionally delegate.
	* target.h (struct target_ops) <to_goto_record>: Use
	TARGET_DEFAULT_NORETURN.
2014-02-19 07:48:26 -07:00
Tom Tromey 3679abfabc convert to_insn_history
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (target_insn_history): Unconditionally delegate.
	* target.h (struct target_ops) <to_insn_history>: Use
	TARGET_DEFAULT_NORETURN.
2014-02-19 07:48:25 -07:00
Tom Tromey 8444ab58be convert to_insn_history_from
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (target_insn_history_from): Unconditionally delegate.
	* target.h (struct target_ops) <to_insn_history_from>: Use
	TARGET_DEFAULT_NORETURN.
2014-02-19 07:48:24 -07:00
Tom Tromey c29302cc8a convert to_insn_history_range
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (target_insn_history_range): Unconditionally delegate.
	* target.h (struct target_ops) <to_insn_history_range>: Use
	TARGET_DEFAULT_NORETURN.
2014-02-19 07:48:23 -07:00
Tom Tromey 170049d41c convert to_call_history
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (target_call_history): Unconditionally delegate.
	* target.h (struct target_ops) <to_call_history>: Use
	TARGET_DEFAULT_NORETURN.
2014-02-19 07:48:22 -07:00
Tom Tromey 16fc27d65a convert to_call_history_from
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (target_call_history_from): Unconditionally delegate.
	* target.h (struct target_ops) <to_call_history_from>: Use
	TARGET_DEFAULT_NORETURN.
2014-02-19 07:48:21 -07:00
Tom Tromey 115d9817bb convert to_call_history_range
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (target_call_history_range): Unconditionally delegate.
	* target.h (struct target_ops) <to_call_history_range>: Use
	TARGET_DEFAULT_NORETURN.
2014-02-19 07:48:20 -07:00
Tom Tromey eb276a6b5b convert to_verify_memory
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (target_verify_memory): Unconditionally delegate.
	* target.h (struct target_ops) <to_verify_memory>: Use
	TARGET_DEFAULT_NORETURN.
2014-02-19 07:48:19 -07:00
Tom Tromey 9e538d0d0b convert to_core_of_thread
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (target_core_of_thread): Unconditionally delegate.
	* target.h (struct target_ops) <to_core_of_thread>: Use
	TARGET_DEFAULT_RETURN.
2014-02-19 07:48:18 -07:00
Tom Tromey f6fb29258b convert to_flash_done
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (target_flash_done): Unconditionally delegate.
	* target.h (struct target_ops) <to_flash_done>: Use
	TARGET_DEFAULT_NORETURN.
2014-02-19 07:48:17 -07:00
Tom Tromey e8a6c6ace9 convert to_flash_erase
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (target_flash_erase): Unconditionally delegate.
	* target.h (struct target_ops) <to_flash_erase>: Use
	TARGET_DEFAULT_NORETURN.
2014-02-19 07:48:17 -07:00
Tom Tromey 7e35c012fb convert to_get_section_table
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (target_get_section_table): Unconditionally delegate.
	* target.h (struct target_ops) <to_get_section_table>: Use
	TARGET_DEFAULT_RETURN.
2014-02-19 07:48:16 -07:00
Tom Tromey 770234d33b convert to_pid_to_str
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (target_pid_to_str): Unconditionally delegate.
	(init_dummy_target): Don't initialize to_pid_to_str.
	(default_pid_to_str): Rename from dummy_pid_to_str.
	* target.h (struct target_ops) <to_pid_to_str>: Use
	TARGET_DEFAULT_FUNC.
2014-02-19 07:48:15 -07:00
Tom Tromey 09b0dc2b57 convert to_find_new_threads
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (target_find_new_threads): Unconditionally delegate.
	* target.h (struct target_ops) <to_find_new_threads>: Use
	TARGET_DEFAULT_RETURN.
2014-02-19 07:48:14 -07:00
Tom Tromey 7d4f8efaf6 convert to_program_signals
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (target_program_signals): Unconditionally delegate.
	* target.h (struct target_ops) <to_program_signals>: Use
	TARGET_DEFAULT_IGNORE.
2014-02-19 07:48:14 -07:00
Tom Tromey 035cad7f2e convert to_pass_signals
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (target_pass_signals): Unconditionally delegate.
	* target.h (struct target_ops) <to_pass_signals>: Use
	TARGET_DEFAULT_IGNORE.
2014-02-19 07:48:13 -07:00
Tom Tromey 8d65703517 convert to_mourn_inferior
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (default_mourn_inferior): New function.
	(target_mourn_inferior): Unconditionally delegate.
	* target.h (struct target_ops) <to_mourn_inferior>: Use
	TARGET_DEFAULT_FUNC.
2014-02-19 07:48:12 -07:00
Tom Tromey 098dba18ee convert to_follow_fork
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (default_follow_fork): New function.
	(target_follow_fork): Unconditionally delegate.
	* target.h (struct target_ops) <to_follow_fork>: Use
	TARGET_DEFAULT_FUNC.
2014-02-19 07:48:11 -07:00
Tom Tromey 423a48075e convert to_kill
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (target_kill): Unconditionally delegate.
	* target.h (struct target_ops) <to_kill>: Use
	TARGET_DEFAULT_NORETURN.
2014-02-19 07:48:11 -07:00
Tom Tromey 6c7e5e5cdc convert to_masked_watch_num_registers
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (target_masked_watch_num_registers): Unconditionally
	delegate.
	* target.h (struct target_ops) <to_masked_watch_num_registers>:
	Use TARGET_DEFAULT_RETURN.
2014-02-19 07:48:10 -07:00
Tom Tromey 8b1c364c14 convert to_remove_mask_watchpoint
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (target_remove_mask_watchpoint): Unconditionally
	delegate.
	* target.h (struct target_ops) <to_remove_mask_watchpoint>: Use
	TARGET_DEFAULT_RETURN.
2014-02-19 07:48:09 -07:00
Tom Tromey cd4ae02956 convert to_insert_mask_watchpoint
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (target_insert_mask_watchpoint): Unconditionally
	delegate.
	* target.h (struct target_ops) <to_insert_mask_watchpoint>: Use
	TARGET_DEFAULT_RETURN.
2014-02-19 07:48:09 -07:00
Tom Tromey a134316b1f convert to_ranged_break_num_registers
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (target_ranged_break_num_registers): Unconditionally
	delegate.
	* target.h (struct target_ops) <to_ranged_break_num_registers>:
	Use TARGET_DEFAULT_RETURN.
2014-02-19 07:48:08 -07:00
Tom Tromey ad5989bd21 convert to_fetch_registers
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (target_fetch_registers): Unconditionally delegate.
	* target.h (struct target_ops) <to_fetch_registers>: Use
	TARGET_DEFAULT_NORETURN.
2014-02-19 07:48:07 -07:00
Tom Tromey 46ee7e8d84 convert to_stop
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (update_current_target): Don't inherit or default
	to_stop.
	* target.h (struct target_ops) <to_stop>: Use
	TARGET_DEFAULT_IGNORE.
2014-02-19 07:48:07 -07:00
Tom Tromey 843f59ed26 convert to_can_run_breakpoint_commands
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (update_current_target): Don't inherit or default
	to_can_run_breakpoint_commands.
	* target.h (struct target_ops) <to_can_run_breakpoint_commands>:
	Use TARGET_DEFAULT_RETURN.
2014-02-19 07:48:06 -07:00
Tom Tromey ccfde2a0c0 convert to_supports_evaluation_of_breakpoint_conditions
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (update_current_target): Don't inherit or default
	to_supports_evaluation_of_breakpoint_conditions.
	* target.h (struct target_ops)
	<to_supports_evaluation_of_breakpoint_conditions>: Use
	TARGET_DEFAULT_RETURN.
2014-02-19 07:48:05 -07:00
Tom Tromey 0de91722c6 convert to_augmented_libraries_svr4_read
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (update_current_target): Don't inherit or default
	to_augmented_libraries_svr4_read.
	* target.h (struct target_ops) <to_augmented_libraries_svr4_read>:
	Use TARGET_DEFAULT_RETURN.
2014-02-19 07:48:04 -07:00
Tom Tromey 9a7d8b4812 convert to_can_use_agent
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (update_current_target): Don't inherit or default
	to_can_use_agent.
	* target.h (struct target_ops) <to_can_use_agent>: Use
	TARGET_DEFAULT_RETURN.
2014-02-19 07:48:03 -07:00
Tom Tromey d9db5b2141 convert to_use_agent
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (update_current_target): Don't inherit or default
	to_use_agent.
	* target.h (struct target_ops) <to_use_agent>: Use
	TARGET_DEFAULT_NORETURN.
2014-02-19 07:48:03 -07:00
Tom Tromey 92155eeb14 convert to_traceframe_info
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (update_current_target): Don't inherit or default
	to_traceframe_info.
	(return_null): Remove.
	* target.h (struct target_ops) <to_traceframe_info>: Use
	TARGET_DEFAULT_RETURN.
2014-02-19 07:48:02 -07:00
Tom Tromey d6522a229d convert to_static_tracepoint_markers_by_strid
Note that this patch reformats the
to_static_tracepoint_markers_by_strid field declaration in struct
target_ops.  This was needed because make-target-delegates requires
the opening paren for the parameters to be on the same line as the
method name, and I didn't see an easy way to fix this.

2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (update_current_target): Don't inherit or default
	to_static_tracepoint_markers_by_strid.
	* target.h (struct target_ops)
	<to_static_tracepoint_markers_by_strid>: Use
	TARGET_DEFAULT_NORETURN.
2014-02-19 07:48:01 -07:00
Tom Tromey 4c3e44251d convert to_static_tracepoint_marker_at
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (update_current_target): Don't inherit or default
	to_static_tracepoint_marker_at.
	* target.h (struct target_ops) <to_static_tracepoint_marker_at>:
	Use TARGET_DEFAULT_RETURN.
2014-02-19 07:48:01 -07:00
Tom Tromey dcd6917ff7 convert to_set_permissions
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (update_current_target): Don't inherit or default
	to_set_permissions.
	* target.h (struct target_ops) <to_set_permissions>: Use
	TARGET_DEFAULT_IGNORE.
2014-02-19 07:48:00 -07:00
Tom Tromey 22bcceeec6 convert to_get_tib_address
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (update_current_target): Don't inherit or default
	to_get_tib_address.
	* target.h (struct target_ops) <to_get_tib_address>: Use
	TARGET_DEFAULT_NORETURN.
2014-02-19 07:47:59 -07:00
Tom Tromey 8586ccaaed convert to_set_trace_notes
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (update_current_target): Don't inherit or default
	to_set_trace_notes.
	* target.h (struct target_ops) <to_set_trace_notes>: Use
	TARGET_DEFAULT_RETURN.
2014-02-19 07:47:58 -07:00
Tom Tromey 91df8d1d35 convert to_set_trace_buffer_size
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (update_current_target): Don't initialize
	to_set_trace_buffer_size.
	* target.h (struct target_ops) <to_set_trace_buffer_size>: Use
	TARGET_DEFAULT_IGNORE.
2014-02-19 07:47:57 -07:00