Commit Graph

10198 Commits

Author SHA1 Message Date
Vince Harron e6c5dcf512 UriParser - fixed potential buffer overrun
Switched from ::strtoul to StringConvert::ToUInt32
Changed port output parameter to be -1 if port is unspecified

llvm-svn: 226204
2015-01-15 20:57:01 +00:00
Vince Harron 5275aaa0cc Moved Args::StringToXIntYZ to StringConvert::ToXIntYZ
The refactor was motivated by some comments that Greg made
http://reviews.llvm.org/D6918

and also to break a dependency cascade that caused functions linking
in string->int conversion functions to pull in most of lldb

llvm-svn: 226199
2015-01-15 20:08:35 +00:00
Nico Weber 92b25b9649 Fix a -Wnull-conversion warning.
llvm-svn: 226181
2015-01-15 17:55:24 +00:00
Nico Weber f37054fbde Fix build after clang r226128.
llvm-svn: 226180
2015-01-15 17:51:05 +00:00
Sylvestre Ledru a9a57804ea In commit clang r226096, DefinitionRequired has been removed. Do the same in lldb implementation
llvm-svn: 226162
2015-01-15 11:50:50 +00:00
Jim Ingham d919163a69 Fix a little thinko in r226017 - the code to actually add the demangled name to the Mangled object got
moved into the #else branch of the #if/#elif/#endif, so it wasn't getting done in the #if case anymore.

Keep the code to add the demangled name outside of the #if, and then just free the demangled_name
and set it back to NULL in the Windows case.

<rdar://problem/19479499>

llvm-svn: 226088
2015-01-15 03:34:31 +00:00
Greg Clayton f7bb1fba36 Don't crash when we can't find a block for some reason, just try and do the right thing and fail gracefully.
<rdar://problem/19196221>

llvm-svn: 226087
2015-01-15 03:13:44 +00:00
Greg Clayton 103f309504 Don't crash when we run into lexical block address range problems, just ignore the bad ranges and log an error message asking the user to file a bug.
<rdar://problem/19021931>

llvm-svn: 226085
2015-01-15 03:04:37 +00:00
Greg Clayton 2501e5e2ea Modified LLDB to be able to lookup global variables by address.
This is done by adding a "Variable *" to SymbolContext and allowing SymbolFile::ResolveSymbolContext() so if an address is resolved into a symbol context, we can include the global or static variable for that address.

This means you can now find global variables that are merged globals when doing a "image lookup --verbose --address 0x1230000". Previously we would resolve a symbol and show "_MergedGlobals123 + 1234". But now we can show the global variable name.

The eSymbolContextEverything purposely does not include the new eSymbolContextVariable in its lookup since stack frame code does many lookups and we don't want it triggering the global variable lookups.

<rdar://problem/18945678> 

llvm-svn: 226084
2015-01-15 02:59:20 +00:00
Ed Maste 19c55b5d12 Fix build after r226068: cannot initialize 'int' with 'nullptr_t'
llvm-svn: 226076
2015-01-15 02:07:28 +00:00
Jim Ingham d762df8c24 Make sure that when a breakpoint is hit but its condition is not met,
the hit count is not updated.
Also, keep the hit count for the breakpoint in the breakpoint.  We were
using just the sum of the location's hit counts, but that was wrong since if a shared library is
unloaded, and the location goes away, the breakpoint hit count should not suddenly drop
by the number of hits there were on that location.

llvm-svn: 226074
2015-01-15 01:41:04 +00:00
Kate Stone a487aa4cdb Three related changes to help:
The default help display now shows the alias collection by default, and hides commands whose named begin with an underscore.  Help is primarily useful to those unfamiliar with LLDB and should aim to answer typical questions while still being able to provide more esoteric answers when required.  To that latter end an argument to include the hidden commands in help has been added, and instead of having a help flag to show aliases there is now one to hide them.  This final change might be controversial as it repurposes the -a shorthand as the opposite of its original meaning.

The previous implementation of OutputFormattedHelpText was easily confused by embedded newlines.  The new algorithm correctly breaks on the FIRST newline or LAST space/tab before the target column count rather than treating all whitespace interchangeably.

Command interpreters now have the ability to specify help prologue text and a command prefix string.  Neither are used in the current LLDB sources but are required to support REPL-like extensions where LLDB commands must be prefixed and additional help text is required to explain how to access traditional debugging commands.

<rdar://problem/17751929>
<rdar://problem/16953815>
<rdar://problem/16953841>
<rdar://problem/16930173>
<rdar://problem/16879028>

llvm-svn: 226068
2015-01-15 00:52:41 +00:00
Enrico Granata 02d87608c1 Reenable the logic to take an integer value and attempt to "po" it as an ObjC object
While there is quite a bit of potential for mishaps due to tagged pointers, and after quite some internal discussion, this seems a saner behavior given how "po" stands for "print OBJECT". The argument being that we should make at least some sensible attempt to print the thing the user passed as-if it was an object

Fixes rdar://19423124

llvm-svn: 226062
2015-01-14 23:58:18 +00:00
Zachary Turner d46476b52a Only set the StopInfo on Windows if the stop is valid for this thread.
llvm-svn: 226054
2015-01-14 22:58:19 +00:00
Zachary Turner 4f1a39584e Don't try to link libpthread on Windows.
llvm-svn: 226053
2015-01-14 22:58:09 +00:00
Zachary Turner 12947b7e25 Fix a number of tests on Windows.
These fix various issues with path handling and disable a few tests
which use features of LLVM which are not yet supported on Windows.

llvm-svn: 226042
2015-01-14 21:42:53 +00:00
Greg Clayton 6e7ab02cff Specify ObjC++ when running heap commands in case we are stopped in a frame with another language.
This ensures the expression gets runs with the correct language.

<rdar://problem/18816647>

llvm-svn: 226041
2015-01-14 21:37:19 +00:00
Vince Harron 4d2857321d Fixes compilation/run error with BUILD_SHARED_LIBS=TRUE
BUILD_SHARED_LIBS=TRUE currently isn't working for Linux x86_64
This patch fixes the link errors and also some runtime errors

Test Plan:
CC=clang CXX=clang++ cmake -GNinja -DBUILD_SHARED_LIBS=TRUE -DCMAKE_LINKER=ld.gold -DCMAKE_BUILD_TYPE=Debug ../../llvm
ninja
ninja check-lldb

llvm-svn: 226039
2015-01-14 21:01:15 +00:00
Ed Maste 55f74e829b test: Add workaround for FreeBSD libedit vs readline issue
If stdout is not a terminal Python executes
    rl_variable_bind ("enable-meta-key", "off");

This produces a warning with FreeBSD's libedit because the
enable-meta-key variable is unknown.  Not an issue on Apple because
cpython commit f0ab6f9f0603 added a #ifndef __APPLE__ around the call.
See http://bugs.python.org/issue19884 for more information.

For now we just discard the warning output to get the tests working
again on FreeBSD.

llvm-svn: 226037
2015-01-14 20:32:33 +00:00
Greg Clayton 456f2712b3 Typing "gui" will crash programs that don't give LLDB a real terminal.
We now verify that the debugger's input file is a valid terminal file descriptor before allowing the "gui" command to try to run. 

Xcode would crash if you typed "gui" at the command line prior to this fix.

<rdar://problem/18775851>

llvm-svn: 226027
2015-01-14 19:45:21 +00:00
Zachary Turner a45fa2ccaa Implement demangling on Windows.
llvm-svn: 226017
2015-01-14 18:34:43 +00:00
Zachary Turner e2dcbd001c Add null pointer checks to some SBStream functions.
llvm-svn: 226016
2015-01-14 18:34:35 +00:00
Oleksiy Vyalov 4771829225 Extend PipePosix with support for named pipes/timeout-based IO and integrate it with GDBRemoteCommunication / lldb-gdbserver - include reviews fixes.
http://reviews.llvm.org/D6954

llvm-svn: 225923
2015-01-14 01:31:27 +00:00
Jason Molenda bed7f07080 Save & restore the array of which registers have already been
saved/restored across a mid-function epilogue.  We ignore 
repeated push/pops of a register so once we saw one 'pop %rbp',
we'd ignore it the second time we saw it.
<rdar://problem/19417410>

llvm-svn: 225853
2015-01-13 23:48:53 +00:00
Oleksiy Vyalov d5f8b6a6ca Extend PipePosix with support for named pipes/timeout-based IO and integrate it with GDBRemoteCommunication / lldb-gdbserver.
http://reviews.llvm.org/D6954

llvm-svn: 225849
2015-01-13 23:19:40 +00:00
Greg Clayton 332e8b1cd4 Fixed an issue where if the operating system python plug-in is changed at runtime, it wouldn't cause the process to reload the new operating system plug-in, now it does.
This is currently controlled by a setting:

(lldb) settings set target.process.python-os-plugin-path <path>

Or clearing it with:

(lldb) settings clear target.process.python-os-plugin-path 

The process will now reload the OperatingSystem plug-in.

This was implemented by:
- adding the ability to set a notify callback for when an option value is changed
- added the ability for the process plug-in to load the operating system plug-in on the fly
- fixed bugs in the Process::GetStatus() so all threads are displayed if their thread IDs are larger than 32 bits
- adding a callback in ProcessProperties to tell when the "python-os-plugin-path" is changed by the user
- fixing a crasher in ProcessMachCore that happens when updating the thread list when the OS plugin is reloaded

llvm-svn: 225831
2015-01-13 21:13:08 +00:00
Jason Molenda 26cc634dbf Enhance the eh_frame unwind instruction augmenter so that
it will do the right thing on x86 routines with a mid-function
epilogue sequence (where the unwind rules need to be reinstalled
after the epilogue has completed).
<rdar://problem/19417410> 

llvm-svn: 225773
2015-01-13 07:39:03 +00:00
Jason Molenda 91805e6f56 Add an additional check to UnwindAssembly_x86::AugmentUnwindPlanFromCallSite
which will verify if the eh_frame instructions include details about
the prologue or not.  Both clang and gcc include prologue instructions
but there's no requirement for them to do so -- and I'm sure we'll
have to interoperate with a compiler that doesn't generate prologue
info at some point.

I don't have any compilers that omit the prologue instructions so the
testing was of the "makre sure augmented unwind info is still created".
With an eh_frame without prologue, this code should reject the 
augmentation scheme altogether and we should fall back to using assembly
instruction profiling.

llvm-svn: 225771
2015-01-13 06:07:07 +00:00
Jason Molenda 34549b8f75 Change the x86 assembly instruction unwind parser to
step through the complete function looking for any epilogue
instructions.  If we find an epilogue sequence, re-instate
the correct unwind instructions if there is more code past
that epilogue -- this will correctly handle an x86 function
with multiple epilogues in it.

NB there is still a bug with the "eh_frame augmented" 
UnwindPlans and mid-function epilogues.  Looking at that next.

<rdar://problem/18863406> 

llvm-svn: 225770
2015-01-13 06:04:04 +00:00
Jason Molenda 5155e5070c Don't run functionalities/tty under sudo / as root.
The terminal window will be opened under the ownership
of the real userid and it won't be able to open the
socket talking back to lldb -- the testsuite will hang
here.

The same thing probably should be done for lldb when run
on a remote system over ssh.  I added a line for that 
but commented it out for now because I haven't
tested it.

llvm-svn: 225748
2015-01-13 00:54:59 +00:00
Oleksiy Vyalov 1777c12206 Fix XCode build on OSX - add OptionValueChar.cpp
http://reviews.llvm.org/D6941

llvm-svn: 225733
2015-01-12 23:50:51 +00:00
Zachary Turner 3e7442b676 Add support for character option types.
This will allow, in a subsequent patch, the addition of a global
setting that allows the user to specify a single character that
LLDB will recognize as an escape character when processing arg
strings to accomodate differences in Windows/non-Windows path
handling.

Differential Revision: http://reviews.llvm.org/D6887
Reviewed by: Jim Ingham

llvm-svn: 225694
2015-01-12 20:44:02 +00:00
Eric Christopher acbb6e64e8 More [-Werror,-Winconsistent-missing-override] fixes.
llvm-svn: 225651
2015-01-12 19:09:48 +00:00
Vince Harron 88f67808ae Fix for lldb-platform linking error on OSX/CMake
Tested on Linux and OSX

Submitted for Bob Campbell

llvm-svn: 225611
2015-01-11 18:38:25 +00:00
Vince Harron e38b24a72b Got C++ unit tests running on Linux again
llvm-svn: 225604
2015-01-11 09:42:12 +00:00
Jason Molenda 9e6d12b98c Add RegisterNumber.cpp.
llvm-svn: 225585
2015-01-10 10:39:27 +00:00
Jason Molenda 24b96b3a05 Forgot to include RegisterNumber.h in prev commit.
llvm-svn: 225579
2015-01-10 04:20:14 +00:00
Jason Molenda a05677126d Hoist the RegisterNumber class out of RegisterContextLLDB and make
it more generally available. 

Add checks to UnwindAssembly_x86::AugmentUnwindPlanFromCallSite() so
that it won't try to augment an UnwindPlan that already describes
the function epilogue.

Add a test case for backtracing out of _sigtramp on Darwin systems.
This could probably be adapted to test the same thing on linux/bsd but 
the function names of sigtramp and kill are probably platform
specific and I'm not sure what they should be.

llvm-svn: 225578
2015-01-10 04:01:03 +00:00
Greg Clayton ad6b82dd53 Add C++ breakpoint tests where names are partially specified to ensure we don't regress on this again.
Top of tree never regressed, but we have internal branches that we constantly merge and we need to make sure we don't regress.

<rdar://problem/19429907>

llvm-svn: 225572
2015-01-10 01:35:02 +00:00
Greg Clayton f44404407f Respect the fact that the result object claims it doesn't want to be interactive by not forwarding STDIN to the python invocation when it isn't desired.
This fixes an issue of running "script" commands via SBDebugger::HandleCommand(...) and SBCommandInterpreter::HandleCommand(...) deadlocking Xcode.

<rdar://problem/18075038>

llvm-svn: 225567
2015-01-10 00:42:12 +00:00
Siva Chandra 0f1b4997ce [TestInferiorAssert] Differentiate DWARF and DSYM tests with suffixes.
Reviewers: vharron, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

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

llvm-svn: 225564
2015-01-10 00:25:23 +00:00
Stephane Sezer 24a14c93e6 Modify dotest.py to be able to run without an lldb build.
Summary: This will ease llgs development a bit by not requiring an lldb/lldb.py build to launch the tests. Also, we can now use LLDB_DEBUGSERVER_PATH to point to a debug server to use to run the tests. I used that to point to a ds2 build and run llgs tests against ds2.

Reviewers: clayborg, tfiala, vharron

Subscribers: lldb-commits

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

llvm-svn: 225549
2015-01-09 21:54:27 +00:00
Zachary Turner f16ae603e8 Fix issues with LLDB's interpreter and MS ABI guard variables.
MS ABI guard variables end with @4IA, so this patch teaches the
interpreter about that.  Additionally, there was an issue with
TurnGuardLoadIntoZero which was causing some guard uses of a
variable to be missed.  This fixes that by calling
Instruction::replaceAllUsesWith() instead of trying to replicate
that function.

llvm-svn: 225547
2015-01-09 21:12:22 +00:00
Zachary Turner 898e10e4d3 Change int32_t to uint32_t to fix warnings.
Variable was being declared as signed, but treated as unsigned at
every point of use.

Patch by Dan Sinclair
Differential Revision: http://reviews.llvm.org/D6897

llvm-svn: 225540
2015-01-09 20:15:21 +00:00
Zachary Turner 225cc30afe Change auto to size_t to fix warning.
Patch by Dan Sinclair
Differential Revision: http://reviews.llvm.org/D6899

llvm-svn: 225539
2015-01-09 20:15:03 +00:00
Enrico Granata 3f7f2077c3 Make the list of synthetic children thread safe
I have been seeing a few crashes where LLDB tries to acquire a cached synthetic child by index, and crashes in the ClusterManager obtaining a shared_ptr for that ValueObject
That kind of crash most often means that I am holding on to a raw pointer to a ValueObject that was let go from the cluster

The main way that could happen is that the synthetic provider is being updated at the same time that some child is being accessed from the previous provider state

This fixes the problem by making the children be stored in a thread-safe map

Fixes rdar://18627964

llvm-svn: 225538
2015-01-09 19:47:45 +00:00
Greg Clayton b547278cae Fixed an issue where you couldn't delete a user defined regex, python, or multi-word command by adding a new "command delete" command.
This new command will delete user defined regular commands, but not aliases. We still have "command unalias" to remove aliases as they are currently in different buckets. Appropriate error messages are displayed to inform the user when "command unalias" is used on removable user defined commands that points users to the "command delete" command.

Added a test to verify we can remove user defined commands and also verify that "command unalias" fails when used on a user defined command.
<rdar://problem/18248300>

llvm-svn: 225535
2015-01-09 19:08:20 +00:00
Siva Chandra 311c7db8e3 [InlineTest] getRerunArgs returns an empty string if the test was skipped.
Summary:
The main issue that this patch is trying to address is that the current
implementation of getRerunArgs of InlineTest relies on the attribute
'using_dsym' which could be absent if the test was skipped altogether.
[That is, if both dsym and dwarf tests were skipped.]

While at it, the use of deprecated Python module 'new' is eliminated.

Test Plan: [Linux] dotest.py -p TestExprPathSynthetic

Reviewers: vharron, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

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

llvm-svn: 225496
2015-01-09 01:54:44 +00:00
Enrico Granata 9aa7e8e9ff Dynamic values have been around (and stable and reliable) for long enough that we can turn them on by default
Change the default of prefer-dynamic-value to eDynamicDontRunTarget (i.e. enable dynamic values, but do not run code to do so)

Of course, disable this for the test suite, since testing no-dynamic-values is actually valuable

Fixes rdar://17363061

llvm-svn: 225486
2015-01-09 00:47:24 +00:00
Enrico Granata 20c321caf8 This patch fixes my think-o in ValueObject::UpdateValueIfNeeded() about the right thing to assert()
It also comes with a (rudimentary) test case that gets itself in a failed update scenario, and checks that we don't crash
This is the easiest case I could think of that forces the failed update case Zachary was seeing

llvm-svn: 225463
2015-01-08 19:11:43 +00:00