Commit Graph

1918 Commits

Author SHA1 Message Date
Ashok Thirumurthi 35729bb1f8 Adds an option to resolve a symbol from an address that can be used
to build out the symbol table as addresses are used, and implements
the mechanism for ELF to add stripped symbols from eh_frame.

Uses this mechanism to allow disassembly for addresses corresponding
to stripped symbols for ELF, and provide hooks to implement this for
PE COFF.

Also removes eSymbolContextTailCall in favor of an option for
ResolveSymbolContextForAddress for consistency with the documentation
for eSymbolContextEverything.  Essentially, this is just an option for
interpreting the so_addr.
                  

llvm-svn: 191307
2013-09-24 15:34:13 +00:00
Jason Molenda 378a462c1a Fix a bug where the x86 assembly instruction profiler would not correctly adjust
the CFA instructions when it was profiling an -fomit-frame-pointer function
and a "volatile" register was saved on the stack (e.g. an argument register).
<rdar://problem/15036546>

llvm-svn: 191267
2013-09-24 03:28:54 +00:00
Jason Molenda 2cd21b87cd Update RegisterContextLLDB::GetFullUnwindPlanForFrame() to use the architectural-
default-at-first-instruction UnwindPlan if we're at the beginning of a function and
the ABI can provide us with an UnwindPlan to get out of there before falling back
to the generic architectural default UnwindPlan (which usually assumes that the stack
has already been set up.)

Update the FuncUnwinders methods to gracefully handle the case where an assembly
profiler may not be available.

Fix a bug where FuncUnwinders::GetUnwindPlanArchitectureDefaultAtFunctionEntry was
returning the wrong UnwindPlan to its caller.

llvm-svn: 191262
2013-09-24 02:42:54 +00:00
Matt Kopec 2f98353099 Change posix thread so that it creates a breakpoint stop reason if the breakpoint isn't valid for the current thread but specify should stop to false. Also remove selecting a thread on a breakpoint hit.
llvm-svn: 191110
2013-09-20 21:28:39 +00:00
Ashok Thirumurthi 2568f45939 Fix lldb regressions due to r190812 in the case where debug info is present.
Specifically, allows the unwinder to handle the case where sc.function
gets resolved with a pc that is one past the address range of the function
(consistent with a tail call).  However, there is no matching symbol.

Adds eSymbolContextTailCall to provide callers with control over the scope
of symbol resolution and to allow ResolveSymbolContextForAddress to handle
tail calls since this routine is common to unwind and disassembly.

llvm-svn: 191102
2013-09-20 19:05:10 +00:00
Sylvestre Ledru 88483a3130 Fix build failures under GNU/Linux running on mips
llvm-svn: 191027
2013-09-19 19:06:57 +00:00
Sean Callanan c370a8a2f0 Made SymbolFileDWARF not crash if a function doesn't
have a type.  It does warn, though.

llvm-svn: 190968
2013-09-18 22:59:55 +00:00
Ed Maste 756e1ff676 Apply ProcessMonitor changes from r190820 to FreeBSD
llvm-svn: 190954
2013-09-18 19:34:08 +00:00
Daniel Malea 82066ed0fb SymbolVendor/ELF is actually referenced by default by lib/Makefile on all
platforms and called in lldb.cpp while it is built only on some, excluding OSX.
There is no reason to not build it then by default on all platforms.

This fixes build on OSX using llvm configure & make scripts.

Patch (2 of 2) by Adam Strzelecki!

llvm-svn: 190945
2013-09-18 16:33:12 +00:00
Michael Sartain c258b3010f Warning cleanup.
llvm-svn: 190942
2013-09-18 15:32:06 +00:00
Virgile Bello d0c5c776bc Visual Studio 2013 compilation support: added some #ifdef _MSC_VER for unsupported code in MSVC.
llvm-svn: 190924
2013-09-18 08:09:31 +00:00
Andrew Kaylor d4d5499d6c Fixing a problem with thread creation signal order dependency
llvm-svn: 190831
2013-09-17 00:30:24 +00:00
Greg Clayton 323d095e9e Fixed a crasher where the remote platform was NULL and was being used.
llvm-svn: 190823
2013-09-16 23:54:50 +00:00
Daniel Malea 1efb418c9d Improve stability of Linux ProcessMonitor by not using fds for synchronization:
- ProcessMonitor::[Do|Serve]Operation no longer depend on file descriptors!
- removed unused member functions CloseFD and EnableIPC
- add semaphores to signal when an Operation is ready to be processed/complete.

This commit fixes a bug that was identified under stress-testing (i.e. build
LLVM while running tests) that led to LLDB becoming unresponsive because the
read/write operations on file descriptors in ProcessMonitor were not checked.

Other test runner improvement/convenience:
- pickup environment variables LLDB_LINUX_LOG and LLDB_LINUX_LOG_OPTIONS to
  enable (Linux) logging when running the test suite. Example usage:

        $ LLDB_LINUX_LOG="mylog.txt" LLDB_LINUX_LOG_OPTIONS="process thread" python dotest.py

llvm-svn: 190820
2013-09-16 23:12:18 +00:00
Ashok Thirumurthi 3880714172 Fixes symbol resolution for a function with a tail call because the PC
for the frame is one past the address range of the calling function.
- Lowers the fix from RegisterContextLLDB for use with disassembly
- Fixes one of three issues in the disassembly test in TestInferiorAssert.py

Also adds documentation that explains the resolution depths and interface.

Note: This change affects the resolution scope for eSymbolContextFunction
without impacting the performance of eSymbolContextSymbol.

Thanks to Matt Kopec for his review.

llvm-svn: 190812
2013-09-16 22:00:17 +00:00
Greg Clayton 52694e3bb8 <rdar://problem/15001220>
Fixed an issue with the lldb/test/lang/cpp/virtual test case had a virtual class that had a DW_TAG_inheritance child that was virtual and had a DW_AT_data_member_location of:

DW_AT_data_member_location( DW_OP_dup, DW_OP_deref, DW_OP_constu(0x00000018), DW_OP_minus, DW_OP_deref, DW_OP_plus )

We failed to evaluate this and then we were passing the incorrect offset back to clang and clang would crash. The AST external source has a function named LayoutRecordType which allows us to supply the virtual base class offsets, but that really doesn't make sense to do as clang will lay them out correctly. So we must ignore virtual base classes when doing layout.

llvm-svn: 190811
2013-09-16 21:57:07 +00:00
Michael Sartain 2225ac73cc Clean up RegisterContextPOSIX. Renamed to POSIXBreakpointProtocol.
Will clean up header files and m_register_infos shortly.

llvm-svn: 190757
2013-09-14 18:44:01 +00:00
Jason Molenda 9e73fe65db One bit of that last commit wasn't meant to be included.
llvm-svn: 190742
2013-09-14 05:22:33 +00:00
Jason Molenda 7e50d9135f Change ProcessMachCore to search for both a user-process dyld binary
and a mach kernel in all the pages of the core file.  If it finds
a user-process dyld binary, assume this is a user process that had
a copy of the mach kernel in memory when it crashed (e.g. lldb doing
kernel debugging) even though we found the kernel binary first.

Also, change the error messages about sections extending past the end
of the file to be warnings and make the messages sound less severe.
Most user process core files have one section that isn't included in
the file and there's no reason to worry people about that.

<rdar://problem/14473235> 

llvm-svn: 190741
2013-09-14 05:20:02 +00:00
Andrew Kaylor 5e26899331 Stop closing terminal fd from ProcessMonitor. It is owned by ConnectionFileDescriptor.
llvm-svn: 190733
2013-09-14 00:17:31 +00:00
Matt Kopec d678d30bac This fixes two issues with the POSIX dynamic loader:
1. existing breakpoints weren't being re-resolved after the sections of a library were loaded (ie. through dlopen).
2. loaded sections weren't being removed after a shared library had been unloaded.

llvm-svn: 190727
2013-09-13 22:14:50 +00:00
Michael Sartain 0a37085fef Cleanup POSIX RegisterContext class hierarchies.
llvm-svn: 190647
2013-09-13 00:18:17 +00:00
Jason Molenda 6b3e6d5487 Disassembler::DisassembleRange() currently calls Target::ReadMemory
with prefer_file_cache == false.  This is what we want to do when
the user is doing a disassemble command -- show the actual memory
contents in case the memory has been corrupted or something -- but
when we're profiling functions for stepping or unwinding
(ThreadPlanStepRange::GetInstructionsForAddress,
UnwindAssemblyInstEmulation::GetNonCallSiteUnwindP) we can read
__TEXT instructions directly out of the file, if it exists.
<rdar://problem/14397491> 

llvm-svn: 190638
2013-09-12 23:23:35 +00:00
Greg Clayton 5764873955 <rdar://problem/14944683>
LLDB now handles explicit alignment for inherited classes.

llvm-svn: 190616
2013-09-12 17:22:32 +00:00
Jim Ingham d39907935c Turns out the number of times you need to resume the process for /bin/sh depends on the
setting of the environment variable COMMAND_MODE.  Changed the Platform::GetResumeCountForShell
to Platform::GetResumeCountForLaunchInfo, and check both the shell and in the case of
/bin/sh the environment as well.

llvm-svn: 190538
2013-09-11 18:23:22 +00:00
Enrico Granata 1ea6f1e7f9 <rdar://problem/14071463>
The wrong method was being called in some instances here, causing class lookups to fail

llvm-svn: 190436
2013-09-10 21:04:54 +00:00
Jim Ingham df0ae22f92 Changing the default shell to /bin/sh brought up a long-standing bug on OS X,
that /bin/sh re-exec's itself to /bin/bash, so it needs one more resume when you
are using it as the shell than /bin/bash did or you will stop at the start of your
program, rather than running it.

So I added a Platform API to get the number of resumes needed when launching with
a particular shell, and set the right values for Mac OS X.

<rdar://problem/14935282>

llvm-svn: 190381
2013-09-10 02:09:47 +00:00
Richard Mitton b6d18beec8 Fixed parsing of the .debug_aranges section so that LLDB will still work correctly even if arange data is not available for every object file in the program.
llvm-svn: 190365
2013-09-09 23:17:40 +00:00
Ed Maste fc7baa005f Apply Linux C++ global/anonymous function call workound to FreeBSD as well
The workaround was introduced in SVN r181613, for http://llvm.org/pr15854

llvm-svn: 190319
2013-09-09 18:00:45 +00:00
Jim Ingham a8a15ed22a Remove commented out routines.
llvm-svn: 190085
2013-09-05 19:01:20 +00:00
Sean Callanan b1de1141f1 Fixed detection of 'p' packet support in debugserver,
by appending the thread ID to the test packet when
debugserver requires it.

This allows register writing (and, by extension,
expressions) to work on Mac OS X.

llvm-svn: 190007
2013-09-04 23:24:15 +00:00
Andrew Kaylor 7d2abdf017 Fixing a problem with inferior exit caused by signal
llvm-svn: 189953
2013-09-04 16:06:04 +00:00
Ed Maste e544143f03 Clean up handling of FreeBSD thread list on Launch / Attach
Instead of directly manipulating the thread list in Launch and Attach,
just rely on RefreshStateAfterStop to populate the initial list.

Review: http://llvm-reviews.chandlerc.com/D1565
llvm-svn: 189889
2013-09-03 23:55:30 +00:00
Greg Clayton c74c497649 Set the byte order for data in the GDB remote register context.
llvm-svn: 189827
2013-09-03 16:36:52 +00:00
Ed Maste 62dd8a4d30 Clean up warnings in ProcessFreeBSD::UpdateThreadList
llvm-svn: 189695
2013-08-30 20:41:42 +00:00
Ed Maste 8b4c82f0fe Don't hide errors in PlatformFreeBSD::ResolveExecutable
If error is already set then there's no reason to replace it with a
generic "<file> does not exist" message.

llvm-svn: 189686
2013-08-30 18:00:50 +00:00
Eric Christopher 2490f5c9f6 Fix a bunch of compile time warnings and a build failure on ubuntu.
llvm-svn: 189683
2013-08-30 17:50:57 +00:00
Ashok Thirumurthi e22defe905 Moving "using namespace" statements out of header files.
llvm-svn: 189675
2013-08-30 14:58:00 +00:00
Ed Maste 7dcb77de06 Move detach to FreeBSD- and Linux-specific classes.
On Linux there is no separate notion of a process (vs. a thread) for
ptrace(); each thread needs to be individually detached.  On FreeBSD
we have a separate process context, and we detach just it.

Review: http://llvm-reviews.chandlerc.com/D1418
llvm-svn: 189666
2013-08-30 13:11:30 +00:00
Ed Maste 825d2084da Fix FreeBSD build after r189295
llvm-svn: 189608
2013-08-29 20:41:39 +00:00
Ed Maste 685fea93ca Perform thread lookup after RefreshStateAfterStop()
This fixes a crash on FreeBSD

llvm-svn: 189607
2013-08-29 20:40:11 +00:00
Daniel Malea 70e7e19e57 fix FreeBSD build error
- s/LogSP/Log */ in ProcessMonitorFreeBSD.cpp

llvm-svn: 189589
2013-08-29 15:54:34 +00:00
Hafiz Abid Qadeer 9a78cdf825 Discover support of 'p' packet.
Some stubs only support g/G packets for registers.
This change makes sure that we check if remote stub supports 'p' packet before using it.

llvm-svn: 189576
2013-08-29 09:09:45 +00:00
Daniel Malea b89d049d13 Add missing "sys/stat.h" include
- should help with FreeBSD buildbot

llvm-svn: 189487
2013-08-28 16:06:16 +00:00
Hafiz Abid Qadeer e5fd5e1092 Clear 'packet_str' before putting new packet.
llvm-svn: 189484
2013-08-28 15:10:37 +00:00
Virgile Bello bdae3787ef Cleanup/rearrange includes:
- factorize unistd.h and stdbool.h in lldb-types.h.
- Add <functional> and <string> where required.

llvm-svn: 189477
2013-08-28 12:14:27 +00:00
Hafiz Abid Qadeer da96ef20b4 Handle run-length-encoding.
The change was taken from a patch by Virgile Bello.

llvm-svn: 189470
2013-08-28 10:31:52 +00:00
Daniel Malea bb247fb58a Fix 'platform shell' command for Linux host and remote lldb-platform connections
- add default timeout of 10s (unil qPlatform_RunCommand supports timeout packets and CommandObjectPlatform is updated to read a timeout flag/setting)
- add a few tests for platform shell

llvm-svn: 189405
2013-08-27 21:01:01 +00:00
Greg Clayton df96dd754e Moved the static s_regex into a function body to allow it to be lazily initialized when/if it is ever used. We try to avoid global constructors when building shared libraries on Darwin.
llvm-svn: 189397
2013-08-27 19:53:47 +00:00
Michael Sartain 338803fa23 warning cleanup (use LLDB_INVALID_HOST_THREAD instead of NULL)
llvm-svn: 189393
2013-08-27 18:59:54 +00:00