is being run on iOS natively and we are examining a binary that is
in the shared-cache. The shared cache may be set up to not load the
symbol names in memory (and may be missing some local symbols entirely,
to boot) so we need to read the on-disk-but-not-mapped-into-memory cache
of symbol names/symbols before we start processing the in-memory nlist
entries.
This code needs to be reorganized into its own separate method, ideally
we'll find some way to not duplicate the nlist symbol handling. But
we need to handle this new format quickly and we'll clean up later.
Thanks for James McIlree for the patch. Fixes <rdar://problem/11639018>.
llvm-svn: 158891
than being given the pthread_mutex_t from the Mutex and locks that. That allows us to
track ownership of the Mutex better.
Used this to switch the LLDB_CONFIGURATION_DEBUG enabled assert when we can't get the
gdb-remote sequence mutex to assert when the thread that had the mutex releases it. This
is generally more useful information than saying just who failed to get it (since the
code that had it locked often had released it by the time the assert fired.)
llvm-svn: 158240
- On iOS, we select the "apcs-gnu" ABI to match
what libraries expect.
- Literals are now allocated at their preferred
alignment, eliminating many alignment crashes.
llvm-svn: 158236
Execute which was never going to get run and another ExecuteRawCommandString. Took the knowledge of how
to prepare raw & parsed commands out of CommandInterpreter and put it in CommandObject where it belongs.
Also took all the cases where there were the subcommands of Multiword commands declared in the .h file for
the overall command and moved them into the .cpp file.
Made the CommandObject flags work for raw as well as parsed commands.
Made "expr" use the flags so that it requires you to be paused to run "expr".
llvm-svn: 158235
a cache of address ranges for child sections,
accelerating lookups. This cache is built during
object file loading, and is then set in stone once
the object files are done loading. (In Debug builds,
we ensure that the cache is never invalidated after
that.)
llvm-svn: 158188
that forces all matches to be looked up. When --all
is not passed, and the current execution frame can
be used to narrow down the search, "target modules
lookup" will try searching in that specific frame
first. Only if nothing is turned up there will it
go on to search all modules.
This feature is currently enabled only for types.
llvm-svn: 158107
m_interrupt_sent into account. Also don't reset m_interrupt_sent in SendInterrupt but do so in SendPacketAndWaitForResponse
when we know we've handled the interrupt.
Fix a code path through ProcessGDBRemote::DoDestroy where we were tearing down the debug session but
not setting the exit status.
llvm-svn: 158043
wait till that is done. We need a stronger way to do this, but in practice this works and using some locking
strategy is harder because Halt & HandlePrivateEvent generally happen on different threads.
llvm-svn: 158042
The output of 'register read' should be prettier.
Modify RegisterValue::Dump() to take an additional parameter:
uint32_t reg_name_right_align_at
which defaults to 0 (i.e., no alignment at all). Update the 'register read' command impl to pass 8
as the alignment to RegisterValue::Dump() method. If more sophisticated scheme is desired, we will
need to introduce an additional command option to 'register read' later on.
llvm-svn: 158039
Fixed an issue where LLDB would use armv7-apple-unknown even though armv7-unknown-unknown was specified with the target create command:
(lldb) target create -a armv7-unknown-unknown <executable>
llvm-svn: 158023
Fix confusing error message about "expression did not evaluate to an address" when doing 'watchpoint set expression".
Instead of using 0 as the fail_value when invoking ValueObject::GetValueAsUnsigned(), modify the API to take an addition
bool pointer (defaults to NULL) to indicate success/failure of value conversion.
llvm-svn: 158016
Refactorings of watchpoint creation APIs so that SBTarget::WatchAddress(), SBValue::Watch(), and SBValue::WatchPointee()
now take an additional 'SBError &error' parameter (at the end) to contain the reason if there is some failure in the
operation. Update 'watchpoint set variable/expression' commands to take advantage of that.
Update existing test cases to reflect the API change and add test cases to verify that the SBError mechanism works for
SBTarget::WatchAddress() by passing an invalid watch_size.
llvm-svn: 157964
that automatically generated setters/getters only
get added to a class after explicitly declared (or
synthesized) getters/setters had the chance to be
added. This eliminates conflicts creating errors
of the form:
error: instance method '...' has incompatible result
types in different translation units ('X *' vs. 'id')
llvm-svn: 157956
Designate MachThreadList as a transaction coordinator when doing Enable/DisableHardwareWatchpoint on the list of threads.
In case the operation (iterating on the threads and doing enable/disable) fails in the middle, we rollback the already
enabled/disabled threads to their checkpointed states. When all the threads succeed in enable/disable, we ask each thread
to finsih the transaction and commit the change of the debug state.
llvm-svn: 157858
Fixed an issue with the current type being set to DIE_IS_BEING_PARSED in the m_die_to_type map by making sure the type pointer is valid.
llvm-svn: 157836
Fixed a case where multiple threads can be asking to send a packet to the GDB server and one of three things will happen:
1 - everything works
2 - one thread will fail to send the packet due to not being able to get the sequence mutex
3 - one thread will try and interrupt the other packet sending and fail and not send the packet
Now the flow is a bit different. Prior to this fix we did:
if (try_get_sequence_mutex()) {
send_packet()
return success;
} else {
if (async_ok) {
interrupt()
send_packet()
resume()
return success;
}
}
return fail
The issue is that the call to "try_get_sequence_mutex()" could fail if another thread was sending a packet and could cause us to just not send the packet and an error would be returned.
What we really want is to try and get the sequence mutex, and if this succeeds, send the packet. Else check if we are running and if we are, do what we used to do. The big difference is when we aren't running, we wait for the sequence mutex so we don't drop packets. Pseudo code is:
if (try_get_sequence_mutex()) {
// Safe to send the packet right away
send_packet()
return success;
} else {
if (running) {
// We are running, interrupt and send async packet if ok to do so,
// else it is ok to fail
if (async_ok) {
interrupt()
send_packet()
resume()
return success;
}
}
else {
// Not running, wait for the sequence mutex so we don't drop packets
get_sequence_mutex()
send_packet()
return success;
}
}
return fail
llvm-svn: 157751
Fixed an issue with the symbol table parsing of files that have STAB entries in them where there are two N_SO entries where the first has a directory, and the second contains a full path:
[ 0] 00000002 64 (N_SO ) 00 0000 0000000000000000 '/Volumes/data/src/'
[ 1] 0000001e 64 (N_SO ) 00 0000 0000000000000000 '/Volumes/data/src/Source/main.m'
[ 2] 00000047 66 (N_OSO ) 09 0001 000000004fc642d2 '/tmp/main.o'
[ 3] 00000001 2e (N_BNSYM ) 01 0000 0000000000003864
[ 4] 000000bd 24 (N_FUN ) 01 0000 0000000000003864 '_main'
[ 5] 00000001 24 (N_FUN ) 00 0000 00000000000000ae
[ 6] 00000001 4e (N_ENSYM ) 01 0000 00000000000000ae
[ 7] 00000001 64 (N_SO ) 01 0000 0000000000000000
We now correctly combine entries 0 and 1 into a single entry.
llvm-svn: 157712
setting breakpoints. That's dangerous, since while we are setting a breakpoint,
the target might hit the dyld load notification, and start removing modules from
the list. This change adds a GetMutex accessor to the ModuleList class, and
uses it whenever we are accessing the target's ModuleList (as returned by GetImages().)
<rdar://problem/11552372>
llvm-svn: 157668
Also replace hard-coded paths with a variable.
Fixed a comment.
Included missing dependencies on Mac OS X (lldbPluginDynamicLoaderPOSIX.a
is a common dependency).
We can't use EXPORTED_SYMBOL_FILE on Darwin right now, don't pass it to
the linker just yet.
llvm-svn: 157618
A local std::string was being filled in and then the function would return "s.c_str()".
A local StreamString (which contains a std::string) was being filled in, and essentially also returning the c string from the std::string, though it was in a the StreamString class.
The fix was to not do this by passing a stream object into StringList::Join() and fix the "arch_helper()" function to do what it should: cache the result in a global.
llvm-svn: 157519
Make 'help arch' return the list of supported architectures.
Add a convenience method StringList::Join(const char *separator) which is called from the help function for 'arch'.
Also add a simple test case.
llvm-svn: 157507
these functions will end in the sequence
mov %rbp, %rsp
ret
call __stack_chk_fail
instead of the usual mov, ret. The x86 assembly profiler only looked
for functions ending in 'ret' and added the Unwind row describing how to
set the CFA based on that -- the addition of the call insn (which is jumped
to earlier in the function body) threw off that inspection.
Resolves the need to "step" twice to get out of these functions when doing
source-level stepping.
<rdar://problem/11469705>
llvm-svn: 157454
Sending async packets can deadlock a program on darwin. We currently allow breakpoint packets and memory read/write packets (for software breakpoints) to be sent while a program is running. In the GDB remote plug-in, we will interrupt the run, send the async packet and resume (currently with the continue packet that caused the program to resume). If the GDB server supports the "vCont" packet, we might have initially continued with each thread stating it should continue. If new threads show up while we are stopped, which happend when running GCD, we can end up with new threads that we aren't mentioning in the continue list. So we start with a thread list of 1,2,3 and continue:
continue thread 1, continue thread 2, continue thread 3
Now we interrupt and set a breakpoint and we actually have threads 1,2,3,4 now when we are about to resume, yet we send:
continue thread 1, continue thread 2, continue thread 3
Any thread that isn't mentioned is currently going to stay suspended. This causes the deadlock.
llvm-svn: 157439
Supports the use-case scenario of immediately continuing the process once attached.
Add a simple completion test case from "process attach --con" to "process attach --continue ".
llvm-svn: 157361
Add default Process::GetWatchpointSupportInfo() impl which returns an error of "not supported".
Add "qWatchpointSupportInfo" packet to the gdb communication layer to support this, and modify TestWatchpointCommands.py to test it.
llvm-svn: 157345
the value_regs field, which is useful for future expansion purposes. As of now, we have:
calculated_offset_of_eax = offset_of_rax + (offset_of_eax_from_the_descriptor which is 0)
llvm-svn: 157275
Add convenience registers eax, ebx, ecx, edx, edi, esi, ebp, esp to the 'register read' command for x86_64.
Add a GDBRemoteRegisterContext::Addx86_64ConvenienceRegisters() method called from ProcessGDBRemote::BuildDynamicRegisterInfo().
Servicing of eax, for example, is accomplished by delegating to rax with an adjusted offset into the register context.
llvm-svn: 157230
"break set" commands to set this per breakpoint. Also, some CreateBreakpoint API's in the lldb_private
namespace had "internal" first and "skip_prologue" second. "internal should always be last. Fixed that.
rdar://problem/11484729
llvm-svn: 157225
(actually, mainly just hooked up support that was already
there). Added a test case, although it's expected to fail
right now unless you're using top-of-tree LLVM.
llvm-svn: 157220
we delete the watchpoint. The test succeeds when no more watchpoint hit event fires after the deletion of the watchpoint.
related to rdar://problem/11320188
llvm-svn: 157084