Commit Graph

7193 Commits

Author SHA1 Message Date
Ed Maste 4a8d32b733 Remove empty ProcessPOSIX::StopAllThreads
The removal of ProcessLinux in r240543 left only an empty
StopAllThreads (it's not needed on FreeBSD), so just remove it too.

llvm-svn: 240549
2015-06-24 16:24:56 +00:00
Ed Maste ff666dcbef Remove unused variable
llvm-svn: 240547
2015-06-24 15:27:35 +00:00
Ewan Crawford aa7eda7a9e Proper handling of QNonStop packet response.
Turn non-stop mode off if reply to QNonStop packet isn't an OK.

llvm-svn: 240546
2015-06-24 15:14:26 +00:00
Pavel Labath b36f917854 Remove old local-only linux debugging code
Summary:
Currently, the local-only path fails about 50% of the tests, which means that: a) nobody is using
it; and b) the remote debugging path is much more stable. This commit removes the local-only
linux debugging code (ProcessLinux) and makes remote-loopback the only way to debug local
applications (the same architecture as OSX). The ProcessPOSIX code is moved to the FreeBSD
directory, which is now the only user of this class. Hopefully, FreeBSD will soon move to the new
architecture as well and then this code can be removed completely.

Test Plan: Test suite passes via remote stub.

Reviewers: emaste, vharron, ovyalov, clayborg

Subscribers: tberghammer, emaste, lldb-commits

Differential Revision: http://reviews.llvm.org/D10661

llvm-svn: 240543
2015-06-24 14:43:20 +00:00
Tamas Berghammer 2480fe06f2 Fix location of symbol size calculation in ObjectFileELF
Bug introduced by r240533

llvm-svn: 240537
2015-06-24 12:31:25 +00:00
Tamas Berghammer 44ff9ccede Improve instruction emulation based stack unwinding on ARM
* Add and fix the emulation of several instruction.
* Disable frame pointer usage on Android.
* Specify return address register for the unwind plan instead of explict
  tracking the value of RA.
* Replace prologue detection heuristics (unreliable in several cases)
  with a logic to follow the branch instructions and restore the CFI
  value based on them. The target address for a branch should have the
  same CFI as the source address (if they are in the same function).
* Handle symbols in ELF files where the symbol size is not specified
  with calcualting their size based on the next symbol (already done
  in MachO files).
* Fix architecture in FuncUnwinders with filling up the inforamtion
  missing from the object file with the architecture of the target.
* Add code to read register wehn the value is set to "IsSame" as it
  meanse the value of a register in the parent frame is the same as the
  value in the current frame.

Differential revision: http://reviews.llvm.org/D10447

llvm-svn: 240533
2015-06-24 11:27:32 +00:00
Greg Clayton 0b90be1c4f Implement the "qSymbol" packet in order to be able to read queue information in debugserver and return the info in the stop reply packets.
A "qSymbol::" is sent when shared libraries have been loaded by hooking into the Process::ModulesDidLoad() function from within ProcessGDBRemote. This function was made virtual so that the ProcessGDBRemote version is called, which then first calls the Process::ModulesDidLoad(), and then it queries for any symbol lookups that the remote GDB server might want to do.

This allows debugserver to request the "dispatch_queue_offsets" symbol so that it can read the queue name, queue kind and queue serial number and include this data as part of the stop reply packet. Previously each thread would have to do 3 memory reads in order to read the queue name.

This is part of reducing the number of packets that are sent between LLDB and the remote GDB server.

<rdar://problem/21494354>

llvm-svn: 240466
2015-06-23 21:27:50 +00:00
Jim Ingham 60c915e96a Fix the handling of the run lock in cases where you needed to run
a hand-called function from the private state thread.  The problem 
was that on the way out of the private state thread, we try to drop
the run lock.  That is appropriate for the main private state thread,
but not the secondary private state thread.  Only the thread that 
spawned them can know whether this is an appropriate thing to do or
not.

<rdar://problem/21375352>

llvm-svn: 240461
2015-06-23 21:02:45 +00:00
Dawn Perchik dc975670c1 Add support for displaying the language in the frame-format string.
Enable ${language} to be specified in the frame-format string to see
the current frame's compile unit language in "frame info".

Test Plan:
debug a C++ program, run to main, and run the lldb commands:
    settings set frame-format "frame lang=${language}\n"
    frame info
you should see:
    frame lang=c++
test case added in:
    ./dotest.py --executable lldb -f SettingsCommandTestCase.test_set_frame_format
Reviewers: clayborg
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D10561

llvm-svn: 240440
2015-06-23 18:35:31 +00:00
Oleksiy Vyalov a5d9c1d32f Mark SBFrame::GetFunctionName and SBFrame::IsInlined as const.
llvm-svn: 240435
2015-06-23 18:21:55 +00:00
Pavel Labath a6d0dd74f1 Fix build breakage after llvm r240426
Test Plan: It builds, tests pass.

Reviewers: tstellarAMD, rafael

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D10660

llvm-svn: 240429
2015-06-23 17:15:14 +00:00
Ewan Crawford 76df2881ba Add handling of async notify packets
This patch adds a listener to the AynscThread in ProcessGDBRemote, specifically for dealing with any async notification packets.

From the broadcast our listener receives we can process the notify packet from the event data. A handler function then sets the thread stop info from this packet, and updates lldb by setting the process private state to stopped. Allowing the async thread to go back to sleep and getting the main thread to handle the implications of a state change.

When sending a vCont in nonstop mode we also get a different reply from all-stop mode, an OK response as opposed to a stop reply. So a condition is added to handle this and set the process state without the stop-reply data.

Reviewers: clayborg

Subscribers: lldb-commits, labath, ted, aidan.dodds, deepak2427

Differential Revision: http://reviews.llvm.org/D10544

llvm-svn: 240397
2015-06-23 12:32:06 +00:00
Jaydeep Patil c60c94528c [LLDB][MIPS] MIPS32 branch emulation and single-stepping
SUMMARY:
    This patch implements
      1. Emulation of MIPS32 branch instructions
      2. Enable single-stepping for MIPS32 instructions
      3. Correction in emulation of MIPS64 branch instructions with delay slot
      4. Adjust breakpoint address when breakpoint is hit in a forbidden slot of compact branch instruction
    
    Reviewers: clayborg
    Subscribers: mohit.bhakkad, sagar, bhushan, lldb-commits, emaste, nitesh.jain
    Differential Revision: http://reviews.llvm.org/D10596

llvm-svn: 240373
2015-06-23 03:37:08 +00:00
Chaoren Lin 7a30608026 Revert "Reduced packet counts to the remote GDB server where possible."
This reverts commit 0cc0745ea9c68d7fdcadc9904cee3f13c96dae60.

Due to breakage on Linux build bot:

http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-cmake/builds/3436

llvm-svn: 240371
2015-06-23 03:17:01 +00:00
Greg Clayton ffb2d44ab9 Reduced packet counts to the remote GDB server where possible.
We have been working on reducing the packet count that is sent between LLDB and the debugserver on MacOSX and iOS. Our approach to this was to reduce the packets required when debugging multiple threads. We currently make one qThreadStopInfoXXXX call (where XXXX is the thread ID in hex) per thread except the thread that stopped with a stop reply packet. In order to implement multiple thread infos in a single reply, we need to use structured data, which means JSON. The new jThreadsInfo packet will attempt to retrieve all thread infos in a single packet. The data is very similar to the stop reply packets, but packaged in JSON and uses JSON arrays where applicable. The JSON output looks like:


[
  { "tid":1580681,
    "metype":6,
    "medata":[2,0],
    "reason":"exception",
    "qaddr":140735118423168,
    "registers": {
      "0":"8000000000000000",
      "1":"0000000000000000",
      "2":"20fabf5fff7f0000",
      "3":"e8f8bf5fff7f0000",
      "4":"0100000000000000",
      "5":"d8f8bf5fff7f0000",
      "6":"b0f8bf5fff7f0000",
      "7":"20f4bf5fff7f0000",
      "8":"8000000000000000",
      "9":"61a8db78a61500db",
      "10":"3200000000000000",
      "11":"4602000000000000",
      "12":"0000000000000000",
      "13":"0000000000000000",
      "14":"0000000000000000",
      "15":"0000000000000000",
      "16":"960b000001000000",
      "17":"0202000000000000",
      "18":"2b00000000000000",
      "19":"0000000000000000",
      "20":"0000000000000000"},
    "memory":[
      {"address":140734799804592,"bytes":"c8f8bf5fff7f0000c9a59e8cff7f0000"},
      {"address":140734799804616,"bytes":"00000000000000000100000000000000"}
    ]
  }
]

It contains an array of dicitionaries with all of the key value pairs that are normally in the stop reply packet. Including the expedited registers. Notice that is also contains expedited memory in the "memory" key. Any values in this memory will get included in a new L1 cache in lldb_private::Process where if a memory read request is made and that memory request fits into one of the L1 memory cache blocks, it will use that memory data. If a memory request fails in the L1 cache, it will fall back to the L2 cache which is the same block sized caching we were using before these changes. This allows a process to expedite memory that you are likely to use and it reduces packet count. On MacOSX with debugserver, we expedite the frame pointer backchain for a thread (up to 256 entries) by reading 2 pointers worth of bytes at the frame pointer (for the previous FP and PC), and follow the backchain. Most backtraces on MacOSX and iOS now don't require us to read any memory!

We will try these packets out and if successful, we should port these to lldb-server in the near future. 

<rdar://problem/21494354>

llvm-svn: 240354
2015-06-22 23:12:45 +00:00
Greg Clayton 4b9952629b Fix a crasher on the MacOSX test suite for Objective C.
llvm-svn: 240351
2015-06-22 22:35:07 +00:00
Greg Clayton 7d1483f51c Cleanup the code a bit to make it more readable.
Add some if/then to avoid calling a function to get dynamic/synthetic types if we know we aren't going to need to call it.

Avoid calling a function that returns a shared pointer twice: once for testing it and once for assigning it (even though that shared pointer is cached inside the value object), it just makes the code a bit clearer.

llvm-svn: 240299
2015-06-22 17:38:30 +00:00
Jaydeep Patil 30952b200b Test Commit
llvm-svn: 240280
2015-06-22 13:58:30 +00:00
Tamas Berghammer 512c682984 Add comment for workarond in DYLDRendezvous with android version
llvm-svn: 240166
2015-06-19 19:42:43 +00:00
Tamas Berghammer 706773b412 Fix build brakage caused by r240154
llvm-svn: 240162
2015-06-19 19:28:13 +00:00
Adrian McCarthy a59a7211f0 Load executable module when attaching to process; implement detach from process.
llvm-svn: 240157
2015-06-19 18:26:53 +00:00
Rafael Espindola 86f422e1aa Fix the lldb build for the EM_486 change.
llvm-svn: 240138
2015-06-19 17:02:25 +00:00
Bhushan D. Attarde 13f5425a7e [LLDB][MIPS] ABI Plugin for MIPS64
SUMMARY:
This patch implements ABI plugin for MIPS64.

Reviewers: clayborg
Subscribers: mohit.bhakkad, sagar, jaydeep, emaste, nitesh.jain, lldb-commits
Differential Revision: http://reviews.llvm.org/D10534

llvm-svn: 240123
2015-06-19 04:25:07 +00:00
Jason Molenda d99bb0a7ad Update comment about the UNWIND_X86_64_MODE_STACK_IND encoding
bug in old clang's.

llvm-svn: 240070
2015-06-18 22:16:10 +00:00
Jason Molenda 91ffe0a570 Add a new wart, I mean feature, on to gdb-remote protocol: compression.
For some communication channels, sending large packets can be very 
slow.  In those cases, it may be faster to compress the contents of
the packet on the target device and decompress it on the debug host
system.  For instance, communicating with a device using something
like Bluetooth may be an environment where this tradeoff is a good one.

This patch adds a new field to the response to the "qSupported" packet
(which returns a "qXfer:features:" response) -- SupportedCompressions
and DefaultCompressionMinSize.  These tell you what the remote
stub can support.

lldb, if it wants to enable compression and can handle one of those 
algorithms, it can send a QEnableCompression packet specifying the
algorithm and optionally the minimum packet size to use compression
on.  lldb may have better knowledge about the best tradeoff for
a given communication channel.

I added support to debugserver an lldb to use the zlib APIs
(if -DHAVE_LIBZ=1 is in CFLAGS and -lz is in LDFLAGS) and the
libcompression APIs on Mac OS X 10.11 and later 
(if -DHAVE_LIBCOMPRESSION=1).  libz "zlib-deflate" compression.
libcompression can support deflate, lz4, lzma, and a proprietary
lzfse algorithm.  libcompression has been hand-tuned for Apple
hardware so it should be preferred if available.

debugserver currently only adds the SupportedCompressions when
it is being run on an Apple watch (TARGET_OS_WATCH).  Comment
that #if out from RNBRemote.cpp if you want to enable it to
see how it works.  I haven't tested this on a native system
configuration but surely it will be slower to compress & decompress
the packets in a same-system debug session.

I haven't had a chance to add support for this to 
GDBRemoteCommunciationServer.cpp yet.

<rdar://problem/21090180> 

llvm-svn: 240066
2015-06-18 21:46:06 +00:00
Jason Molenda 114fb91217 Correct the end-of-vector check in GetCompactUnwindInfoForFunction().
Problem noticed by Todd Fiala.

llvm-svn: 240060
2015-06-18 21:15:58 +00:00
Tamas Berghammer 783bfc8caa Fetch object file load address if it isn't specified by the linker
Differential revision: http://reviews.llvm.org/D10490

llvm-svn: 240052
2015-06-18 20:43:56 +00:00
Tamas Berghammer fbd72d1606 Fix test regression TestDisassemble_VST1_64 (caused by r239996)
llvm-svn: 240029
2015-06-18 17:03:25 +00:00
Mohit K. Bhakkad de8b81b45a [LLDB][MIPS] Addressing some errors and warnings due to rL239991
llvm-svn: 240016
2015-06-18 13:35:29 +00:00
Aidan Dodds 9869724dcf Fix duplicate shared module list entries
Differential Revision: http://reviews.llvm.org/D10499

llvm-svn: 240007
2015-06-18 10:25:54 +00:00
Sagar Thakur 67e8989443 [MIPS64] Correct generic register number of argument registers in reginfo
llvm-svn: 240005
2015-06-18 09:36:31 +00:00
Mohit K. Bhakkad 58975e82d4 A correction in rL239996
llvm-svn: 239998
2015-06-18 07:12:25 +00:00
Bhushan D. Attarde a8219f2e2a [LLDB][MIPS] ABI Plugin for MIPS32
SUMMARY:
This patch implements ABI plugin for MIPS32.

Reviewers: clayborg
Subscribers: mohit.bhakkad, sagar, jaydeep, lldb-commits
Differential Revision: http://reviews.llvm.org/D10240

llvm-svn: 239997
2015-06-18 07:02:10 +00:00
Mohit K. Bhakkad 276a930eda [LLDB][MIPS] Emulation of MIPS64 floating-point branch instructions
Patch by Jaydeep Patil

SUMMARY:
1. Added emulation of MIPS64 floating-point branch instructions
2. Updated GetRegisterInfo to recognize floating-point registers
3. Provided CPU information while creating createMCSubtargetInfo in disassembler
4. Bug fix in emulation of JIC and JIALC
5. Correct identification of breakpoint when set in a delay slot of a branch instruction

Reviewers: clayborg
Subscribers: bhushan, mohit.bhakkad, sagar, nitesh.jain, lldb-commits.
Differential Revision: http://reviews.llvm.org/D10355

llvm-svn: 239996
2015-06-18 06:03:27 +00:00
Bruce Mitchener 58ef391f3e Fix a variety of typos.
No functional change.

llvm-svn: 239995
2015-06-18 05:27:05 +00:00
Mohit K. Bhakkad 3579996399 [LLDB][MIPS] Hardware Watchpoints for MIPS
Reviewers: clayborg, jingham.
Subscribers: jaydeep, bhushan, dsanders, sagar, lldb-commits.
Differential Revision: http://reviews.llvm.org/D9142

llvm-svn: 239991
2015-06-18 04:53:18 +00:00
Dawn Perchik d0e87eb07e Fix enum LanguageType values and language string table lookups.
Summary:
* Fix enum LanguageType values so that they can be used as indexes
into array language_names and g_languages as assumed by
LanguageRuntime::GetNameForLanguageType,
Language::SetLanguageFromCString and Language::AsCString.
* Add DWARFCompileUnit::LanguageTypeFromDWARF to convert from DWARF
DW_LANG_* values to enum LanguageType values.

Reviewed By: clayborg, abidh
Differential Revision: http://reviews.llvm.org/D10484

llvm-svn: 239963
2015-06-17 22:30:24 +00:00
Pavel Labath df7c69952b [NativeProcessLinux] Use fast memory reads, if the system supports it
Summary:
Memory reads using the ptrace API need to be executed on a designated thread
and in 4-byte increments. The process_vm_read syscall has no such requirements
and it is about 50 times faster. This patch makes lldb-server use the faster
API if the target kernel supports it. Kernel support for this feature is
determined at runtime. Using process_vm_writev in the same manner is more
complicated since this syscall (unlike ptrace) respects page protection settings
and so it cannot be used to set a breakpoint, since code pages are typically
read-only. However, memory writes are not currently a performance bottleneck as
they happen much more rarely.

Test Plan: all tests continue to pass

Reviewers: ovyalov, vharron

Subscribers: tberghammer, lldb-commits

Differential Revision: http://reviews.llvm.org/D10488

llvm-svn: 239924
2015-06-17 18:38:49 +00:00
Ed Maste 0e978481e1 Correct type in for loop to remove signedness warning
llvm-svn: 239918
2015-06-17 17:29:56 +00:00
Enrico Granata 443844c474 Revert r239873 - I actually want to think some more about this
llvm-svn: 239874
2015-06-17 02:11:48 +00:00
Enrico Granata ca201238ae Fix an issue where the oneliner printing of variables would ignore custom formatting
Because vector types use their formats in special ways (i.e. children get generated based on them), this change by itself would cause a regression in printing vector types with some custom formats
Work around that issue by special casing vector types out of this format-passdown mode. I believe there is a more general feature to be designed in this space, but until I see more cases of interest, I am going to leave this as a special case

Fixes rdar://20810062

llvm-svn: 239873
2015-06-17 02:06:24 +00:00
Jim Ingham 637338543f Fix a typo in the help.
llvm-svn: 239854
2015-06-16 21:39:56 +00:00
Enrico Granata 7569f23330 Fixing a potential issue where the NSIndexPath formatter could try to access stale data
No test because I did not see this happen - it has been found by code inspection as a response to seeing crash logs about this

llvm-svn: 239851
2015-06-16 20:48:49 +00:00
Enrico Granata 3b00e35b10 Enable 'command script import' to accept multiple modules to import in one invocation
Fixes rdar://21388472

llvm-svn: 239839
2015-06-16 18:31:04 +00:00
Ewan Crawford fab40d3911 Add Read Thread to GDBRemoteCommunication
In order to support asynchronous notifications for non-stop mode this patch adds a packet read thread. This is done by implementing AppendBytesToCache() from the communications class, which continually reads packets into a packet queue. To initialize this thread StartReadThread() must be called by the client, so since llgs and platform tools use the GBDRemoteCommunicatos code they must also call this function as well as ProcessGDBRemote.

When the read thread detects an async notify packet it broadcasts this event, where the matching listener will be added in the next non-stop patch.

Packets are now accessed by calling ReadPacket() which pops a packet from the queue, instead of using WaitForPacketWithTimeoutMicroSecondsNoLock()

Reviewers: vharron, clayborg

Subscribers: lldb-commits, labath, ted, domipheus, deepak2427 

Differential Revision: http://reviews.llvm.org/D10085

llvm-svn: 239824
2015-06-16 15:50:18 +00:00
Enrico Granata 3ab6669eeb If a candidate keyword contains quotes, it's clearly not a keyword, so bail out early
There are other characters we could optimize for (any non-letter pretty much), but keyword.iskeyword() will handle them, whereas quotes do have the potential to confuse us, so they actually need custom handling

Fixes rdar://problem/21022787

llvm-svn: 239779
2015-06-15 23:12:29 +00:00
Enrico Granata bc2c2b0115 Add a formatter for wchar_t[N] arrays
rdar://21299888

llvm-svn: 239777
2015-06-15 23:01:47 +00:00
Enrico Granata a44c0e3122 Fix a bug where passing a value of the type "A B" to settings set target.env-vars would cause LLDB to crash
Fixes rdar://problem/21241817

llvm-svn: 239766
2015-06-15 21:37:05 +00:00
Greg Clayton 49e9010ca3 Found an issue that was causing types to be completed much more often than they needed to be.
The problem is for lldb_private::Type instances that have encoding types (pointer/reference/const/volatile/restrict/typedef to type with user ID 0x123). If they started out with m_flags.clang_type_resolve_state being set to eResolveStateUnresolved (0), then when we would call Type::ResolveClangType(eResolveStateForward) we would complete the full type due to logic errors in the code. 

We now only complete the type if clang_type_resolve_state is eResolveStateLayout or eResolveStateFull and we correctly upgrade the type's current completion state to eResolveStateForward after we make a forward delcaration to the pointer/reference/const/volatile/restrict/typedef type instead of leaving it set to eResolveStateUnresolved.

llvm-svn: 239752
2015-06-15 20:17:18 +00:00
Mohit K. Bhakkad 056c45a4a1 [LLDB][MIPS] Getting correct signals for MIPS Host
Patch by Nitesh Jain

Reviewers: clayborg, ovyalov.
Subscribers: jaydeep, bhushan, dsanders, mohit.bhakkad, sagar, labath, lldb-commits.
Differential Revision: http://reviews.llvm.org/D10180

llvm-svn: 239463
2015-06-10 10:02:21 +00:00
Chaoren Lin 372e9067a7 Rename `FileSpec::IsRelativeToCurrentWorkingDirectory` to `IsRelative`.
Summary:
`IsRelativeToCurrentWorkingDirectory` was misleading, because relative paths
are sometimes appended to other directories, not just the cwd. Plus, the new
name is shorter. Also added `IsAbsolute` for completeness.

Reviewers: clayborg, ovyalov

Reviewed By: ovyalov

Subscribers: tberghammer, lldb-commits

Differential Revision: http://reviews.llvm.org/D10262

llvm-svn: 239419
2015-06-09 17:54:27 +00:00
Sagar Thakur 0e179ae7b7 [lldb-server][MIPS64] Assigning generic register numbers in register info for mips64
Use generic register numbers for argument registers, fp, ra and flag register in register info.

llvm-svn: 239394
2015-06-09 10:29:29 +00:00
Pavel Labath c7c30eb528 Revert "Introduce a TypeSystem interface to support adding non-clang languages."
This seems to break expression evaluation on the linux build.

llvm-svn: 239366
2015-06-08 23:38:06 +00:00
Pavel Labath c33ae024a6 Introduce a TypeSystem interface to support adding non-clang languages.
Reviewers: clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D8712
Original Author: Ryan Brown <ribrdb@google.com>

llvm-svn: 239360
2015-06-08 22:27:10 +00:00
Chaoren Lin 7d2f62dacc Fix TestSymbolContext for remote Windows to Android.
Summary: Denormalize path returned by SBFileSpec::GetDirectory().

Reviewers: zturner, clayborg

Reviewed By: clayborg

Subscribers: tberghammer, lldb-commits

Differential Revision: http://reviews.llvm.org/D10298

llvm-svn: 239358
2015-06-08 22:12:58 +00:00
Greg Clayton 0734737b65 If we have a MachO file loaded from memory, make sure we can always get the symbol table even if we don't have the __LINKEDIT load address set in the target.
<rdar://problem/21208168>

llvm-svn: 239354
2015-06-08 21:53:11 +00:00
Oleksiy Vyalov 37ff6c4207 Switch from setPrintImmHex to setPrintHexStyle to follow changes from r239263.
llvm-svn: 239310
2015-06-08 17:10:27 +00:00
Chaoren Lin 0718c1a4d7 Silence warning on Windows.
llvm-svn: 239284
2015-06-08 04:39:24 +00:00
Chaoren Lin 55c1c3495d Fix TestNamespace and TestThreadJump for remote Windows to Android.
Summary:
Update DYLDRendezvous and SOEntry to use FileSpecs instead of storing paths as
strings, which caused incorrect comparison results due to denormalization.

Reviewers: clayborg, vharron, ovyalov

Reviewed By: ovyalov

Subscribers: jwolfe, emaste, tberghammer, lldb-commits

Differential Revision: http://reviews.llvm.org/D10267

llvm-svn: 239195
2015-06-05 22:03:19 +00:00
Ed Maste db6fd1ac25 Removed unused private fields in RegisterContextLinux_mips
llvm-svn: 239181
2015-06-05 18:50:33 +00:00
Ed Maste f6a1312f1b Improve OSType initialization in elf object file's arch_spec
Setting the OSType in the ArchSpec triple is needed to correctly setup
up the register context plugin. ArchSpec::SetArchitecture, for Mach-O
only, sets the OSType. For ELF it was left to the ObjectFileELF to fill
in the missing OSType.

This change moves the ObjectFileELF logic into ArchSpec.

A new optional 'os' parameter has been added to SetArchitecture.
For ELF, this value is the from the ELF header.e_ident[EI_OSABI].
The default value is 0 or ELFOSABI_NONE.

The real work of determining the OSType was done by the ObjectFileELF
helper function GetOsFromOSABI. This logic has been moved
SetArchitecture.

GetOsFromOSABI has been commented as being deprectated.  It is left in
to support asserts.

For ELF the vendor value returned from SetArchitecture should be
UnknownVendor.  An unneeded resetting in ObjectFileELF has been removed
and replaced with an assert.

This fixes a problem reading a core file on FreeBSD/ARM because the spec
triple was arm-unknown-unknown.

Patch by Tom Rix.

Differential Revision:     http://reviews.llvm.org/D9292

llvm-svn: 239148
2015-06-05 13:03:08 +00:00
Sagar Thakur 0abe018c91 [lldb-server][MIPS] Read/Write FP registers in FR0 mode
Adding support for read/write FP registers in FR0 mode of mips.

Reviewers: clayborg, tberghammer, jaydeep
Subscribers: emaste, nitesh.jain, bhushan, mohit.bhakkad, lldb-commits
Differential Revision: http://reviews.llvm.org/D10242

llvm-svn: 239132
2015-06-05 05:47:54 +00:00
Oleksiy Vyalov 6002a31bb8 Fix error handling in AdbClient - PushFile and PullFile.
http://reviews.llvm.org/D10176

llvm-svn: 239130
2015-06-05 01:32:45 +00:00
Chaoren Lin 0c5a9c1476 Delegate path operations to FileSpec.
Summary:
- Added PrependPathComponent utility functions to FileSpec.
- Delegate path operations in ParseCompileUnit to FileSpec.
- Delegate path operations in ParseSupportFiles to FileSpec.

Reviewers: clayborg, vharron, ovyalov

Reviewed By: ovyalov

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D10253

llvm-svn: 239127
2015-06-05 00:28:06 +00:00
Enrico Granata 600aee6b69 I make no claims that Mach ports work, but at least we should check the right thing
llvm-svn: 238984
2015-06-03 22:35:55 +00:00
Enrico Granata d595733617 Fix a bug where trying to Dump() a ValueObject would use the static/non-synthetic version of the value even if the ValueObject one actually called Dump() on turned out to be dynamic and/or synthetic
This was of course overridable by using DumpValueObjectOptions, but the default should be saner and the previous behavior made for a few fun investigations....

rdar://problem/21065149

llvm-svn: 238961
2015-06-03 20:43:54 +00:00
Sagar Thakur ce815e4588 [MIPS][lldb-server] Add 32-bit register context and read/write FP registers on mips64
- Added support for read/write FP registers in FR1 mode.
    - Added 32 bit register context for mips32.

Reviewers: clayborg, tberghammer, jaydeep
Subscribers: emaste, nitesh.jain, bhushan, mohit.bhakkad, lldb-commits
Differential Revision: http://reviews.llvm.org/D10029

llvm-svn: 238914
2015-06-03 10:14:24 +00:00
Greg Clayton b2e0c11982 Fixed "format-string" based settings so they can have quotes on them without leaving the quotes in the format string:
(lldb) settings set thread-format "abc"
(lldb) settings set thread-format 'abc'
(lldb) settings set thread-format abc

We strip the quotes before processing the format string and return an "error: mismatched quotes" if mismatched quotes are given.

<rdar://problem/21210789>

llvm-svn: 238896
2015-06-03 02:02:48 +00:00
Greg Clayton 23d54f4eac Fixed a deadlock that was slowing down processes when they shut down. A 3 second delay could occur sometimes when a process exits, now that delay is gone.
llvm-svn: 238893
2015-06-03 00:34:01 +00:00
Greg Clayton 5a27195b1a Fix LLDB so that it can correctly track down dependent shared libraries that use @rpath.
<rdar://problem/8371885>

llvm-svn: 238886
2015-06-02 22:43:29 +00:00
Jim Ingham acbea8fb37 Fix up some comments to be more explicit. Remove some long-commented out code.
llvm-svn: 238862
2015-06-02 20:26:13 +00:00
Oleksiy Vyalov 17701b5929 Fix PlatformAndroid::PutFile to support relative destination paths.
llvm-svn: 238860
2015-06-02 19:29:48 +00:00
Mohit K. Bhakkad d37be6374b [LLDB][MIPS] MIPS64 Branch instruction emulation for SW single stepping
Patch by Jaydeep Patil

Reviewers: clayborg, jasonmolenda
Subscribers: bhushan, mohit.bhakkad, sagar, lldb-commits.
Differential Revision: http://reviews.llvm.org/D10155

llvm-svn: 238820
2015-06-02 11:22:29 +00:00
Aidan Dodds 7f7b61dc53 Change use of keyword 'or' to '||' as keyword not supported by visual studio 2013.
llvm-svn: 238819
2015-06-02 11:20:44 +00:00
Greg Clayton 81e2b6bbe7 Fix a race condition where 2 threads might try to call Process::SetExitStatus() at the same time.
The problem was the mutex was only protecting the setting of m_exit_string and m_exit_string, but this function relies on the m_private_state being set to eStateExited in order to prevent more than 1 client setting the exit status. We want to only allow the first caller to succeed.

On MacOSX we have a thread that reaps the process we are debugging, and we also have a thread that monitors the debugserver process. When a process exists, the ProcessGDBRemote::AsyncThread() would set the exit status to the correct value and then another thread would reap the debugserver process and they would often both end up in Process::SetExitStatus() at the same time. With the mutex at the top we allow all variables to be set and the m_private_state to be set to eStateExited _before_ the other thread (debugserver reaped) can try to set th exist status to -1 and "lost connection to debugserver" being set as the exit status.

This was probably an issue for lldb-server as well and could very well cleanup some tests that might have been expecting a specific exit status from the process being debugged.

llvm-svn: 238794
2015-06-01 23:14:09 +00:00
Adrian McCarthy 3ae7492b2d Fix TestJoinAfterBreak test on Windows
llvm-svn: 238787
2015-06-01 21:51:50 +00:00
Oleksiy Vyalov dd5313a5cc Don't close handle returned by _get_osfhandle.
http://reviews.llvm.org/D9931

llvm-svn: 238770
2015-06-01 18:52:16 +00:00
Colin Riley 4640cde19b Additional RenderScript debug features.
Base framework for inspecting RenderScript runtime details and helpers for various runtime actions on x86 and arm targets.

Differential Revision: http://reviews.llvm.org/D10151

llvm-svn: 238768
2015-06-01 18:23:41 +00:00
Chaoren Lin b79863c2cc Fix TestPaths.
Reviewers: vharron, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D10164

llvm-svn: 238767
2015-06-01 18:04:10 +00:00
Hafiz Abid Qadeer bfca0d7f7b Initialize 3 variables which were being used un-initialized.
No regression on testsuite. Comitted as obvious.

llvm-svn: 238761
2015-06-01 17:08:30 +00:00
Ed Maste 41fba2b5d0 Refactor many file functions to use FileSpec over strings.
This is the FreeBSD change for r238604.

llvm-svn: 238752
2015-06-01 15:24:37 +00:00
Tamas Berghammer 0f8452ba2e Fix address adjusment in stack frame inline block lookup
When the current address is pointing 1 (unit) over the end of a
section the we have to do a section lookup after making the adjusment
of the current address.

Differential revision: http://reviews.llvm.org/D10124

llvm-svn: 238737
2015-06-01 10:38:23 +00:00
Chaoren Lin 0dba2b399e Remove "%zu" format specifier for MSVC.
Reviewers: zturner

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D10153

llvm-svn: 238722
2015-06-01 04:28:12 +00:00
Adrian McCarthy e1adc7bc3a Fix inferior's i/o connections to its console window on Windows 7.
llvm-svn: 238629
2015-05-29 23:01:25 +00:00
Oleksiy Vyalov 32a9da5668 Use FileSpec::IsRelativeToCurrentWorkingDirectory instead of llvm::sys::path::is_relative in PlatformAndroid::GetFile.
http://reviews.llvm.org/D10141

llvm-svn: 238624
2015-05-29 22:54:45 +00:00
Oleksiy Vyalov 817f40a7fa Leave OS type and vendor as unspecified unknowns.
http://reviews.llvm.org/D10080

llvm-svn: 238623
2015-05-29 22:45:47 +00:00
Oleksiy Vyalov 671a194d88 Fix build - GetRemoteWorkingDirectory returns FileSpec instead of ConstString.
llvm-svn: 238610
2015-05-29 20:32:26 +00:00
Oleksiy Vyalov 291f59c582 Fix PlatformAndroid::GetFile - check for relative source path and concatenate it with current working directory if needed.
llvm-svn: 238606
2015-05-29 20:02:07 +00:00
Chaoren Lin 44145d79cc Working directory FileSpec should use remote path syntax to display correctly.
Summary: Depends on D9728.

Reviewers: ovyalov, zturner, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D9806

llvm-svn: 238605
2015-05-29 19:52:37 +00:00
Chaoren Lin d3173f34e8 Refactor many file functions to use FileSpec over strings.
Summary:
This should solve the issue of sending denormalized paths over gdb-remote
if we stick to GetPath(false) in GDBRemoteCommunicationClient, and let the
server handle any denormalization.

Reviewers: ovyalov, zturner, vharron, clayborg

Reviewed By: clayborg

Subscribers: tberghammer, emaste, lldb-commits

Differential Revision: http://reviews.llvm.org/D9728

llvm-svn: 238604
2015-05-29 19:52:29 +00:00
Chaoren Lin 0ef0027a0b Implement snprintf for MSVC with correct return value.
Reviewers: zturner

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D10048

llvm-svn: 238599
2015-05-29 19:34:57 +00:00
Greg Clayton c8a8b5c243 Unbreak mac build.
llvm-svn: 238590
2015-05-29 18:28:01 +00:00
Zachary Turner 365dc291b1 Re-add #include "lldb-python.h" back in two places.
Fixing these two instances will require some work, so for now
I'm adding these 2 includes back to get the build working.

llvm-svn: 238587
2015-05-29 18:18:26 +00:00
Zachary Turner 1124045ac7 Don't #include "lldb-python.h" from anywhere.
Since interaction with the python interpreter is moving towards
being more isolated, we won't be able to include this header from
normal files anymore, all includes of it should be localized to
the python library which will live under source/bindings/API/Python
after a future patch.

None of the files that were including this header actually depended
on it anyway, so it was just a dead include in every single instance.

llvm-svn: 238581
2015-05-29 17:41:47 +00:00
Pavel Labath 5b981ab9e5 [NativeProcessLinux] clean up #includes
llvm-svn: 238551
2015-05-29 12:53:54 +00:00
Pavel Labath c4e25c9648 Report inferior SIGSEGV as a signal instead of an exception on linux
Summary:
Previously, we reported inferior receiving SIGSEGV (or SIGILL, SIGFPE, SIGBUS) as an "exception"
to LLDB, presumably to match OSX behaviour. Beside the fact that we were basically lying to the
user, this was also causing problems with inferiors which handle SIGSEGV by themselves, since
LLDB was unable to reinject this signal back into the inferior.

This commit changes LLGS to report SIGSEGV as a signal. This has necessitated some changes in the
test-suite, which had previously used eStopReasonException to locate threads that crashed. Now it
uses platform-specific logic, which in the case of linux searches for eStopReasonSignaled with
signal=SIGSEGV.

I have also added the ability to set the description of StopInfoUnixSignal using the description
field of the gdb-remote packet. The linux stub uses this to display additional information about
the segfault (invalid address, address access protected, etc.).

Test Plan: All tests pass on linux and osx.

Reviewers: ovyalov, clayborg, emaste

Subscribers: emaste, lldb-commits

Differential Revision: http://reviews.llvm.org/D10057

llvm-svn: 238549
2015-05-29 10:13:03 +00:00
Greg Clayton aeb3b8b1c0 Change ProcessEventData over to use a std::weak_ptr to a process intead of a std::shared_ptr. Anyone consuming events for a process should have the process around long enough to grab the event and anyone that holds onto an event for too long won't keep the process around.
llvm-svn: 238541
2015-05-29 03:20:37 +00:00
Ying Chen 5340683e7a Add '+' sign at the end of echo package
Summary:
-Fix lldb test failures introduced by r238530
-This fix TestGdbRemoteAuxvSupport.py and TestLldbGdbServer.py

Test Plan:
./dotest -p TestGdbRemoteAuxvSupport.py
./dotest -p TestLldbGdbServer.py

Reviewers: clayborg, chaoren, vharron

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D10116

llvm-svn: 238535
2015-05-29 01:02:07 +00:00
Greg Clayton 420562aa82 Add support for the qEcho command to lldb-server in the common packets.
llvm-svn: 238533
2015-05-29 00:15:15 +00:00
Greg Clayton b30c50c8fa Add a new "qEcho" packet with the following format:
qEcho:%s

where '%s' is any valid string. The response to this packet is the exact packet itself with no changes, just reply with what you received!

This will help us to recover from packets timing out much more gracefully. Currently if a packet times out, LLDB quickly will hose up the debug session. For example, if we send a "abc" packet and we expect "ABC" back in response, but the "abc" command takes longer than the current timeout value this will happen:


--> "abc"
<-- <<<error: timeout>>>

Now we want to send "def" and get "DEF" back:

--> "def"
<-- "ABC"

We got the wrong response for the "def" packet because we didn't sync up with the server to clear any current responses from previously issues commands.

The fix is to modify GDBRemoteCommunication::WaitForPacketWithTimeoutMicroSecondsNoLock() so that when it gets a timeout, it syncs itself up with the client by sending a "qEcho:%u" where %u is an increasing integer, one for each time we timeout. We then wait for 3 timeout periods to sync back up. So the above "abc" session would look like:

--> "abc"
<-- <<<error: timeout>>> 1 second
--> "qEcho:1"
<-- <<<error: timeout>>> 1 second
<-- <<<error: timeout>>> 1 second
<-- "abc"
<-- "qEcho:1"

The first timeout is from trying to get the response, then we know we timed out and we send the "qEcho:1" packet and wait for 3 timeout periods to get back in sync knowing that we might actually get the response for the "abc" packet in the mean time...

In this case we would actually succeed in getting the response for "abc". But lets say the remote GDB server is deadlocked and will never response, it would look like:

--> "abc"
<-- <<<error: timeout>>> 1 second
--> "qEcho:1"
<-- <<<error: timeout>>> 1 second
<-- <<<error: timeout>>> 1 second
<-- <<<error: timeout>>> 1 second

We then disconnect and say we lost connection.

We might also have a bad GDB server that just dropped the "abc" packet on the floor. We can still recover in this case and it would look like:

--> "abc"
<-- <<<error: timeout>>> 1 second
--> "qEcho:1"
<-- "qEcho:1"

Then we know our remote GDB server is still alive and well, and it just dropped the "abc" response on the floor and we can continue to debug.

<rdar://problem/21082939>

llvm-svn: 238530
2015-05-29 00:01:55 +00:00