Commit Graph

2148 Commits

Author SHA1 Message Date
Todd Fiala a3b89e272c Fix iohandler prompt race condition.
This issue caused the lldb prompt to not show up in certain cases, very
noticeable on Linux systems.

See details on this review:
http://reviews.llvm.org/D4863

And on this lldb-commits thread:
http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140811/012306.html

Change by Shawn Best.

(Much useful help and testing by the rest of the community, thanks all!)

llvm-svn: 215446
2014-08-12 14:33:19 +00:00
Enrico Granata 4ec130dcab Patch to enable LLDB to extract value bytes from DWARF block forms and udata/sdata forms. By Greg Clayton
llvm-svn: 215379
2014-08-11 19:16:35 +00:00
Sylvestre Ledru f6102892ef Fix some typos:
* transfered => transferred
* unkown => unknown
* sucessfully => successfully

llvm-svn: 215367
2014-08-11 18:06:28 +00:00
Zachary Turner e88be264de Implement some common file operations on Windows.
llvm-svn: 215273
2014-08-09 01:29:07 +00:00
Zachary Turner e96838e304 Fix some python shutdown / ordering issues.
Differential Revision: http://reviews.llvm.org/D4826

Reviewed by: Enrico Granata

llvm-svn: 215256
2014-08-08 23:20:25 +00:00
Jim Ingham 7ab079b6d0 Add an option to suppress the persistent result variable when running EvaluateExpression
from Python.  If you don't need to refer to the result in another expression, there's no
need to bloat the persistent variable table with them since you already have the result
SBValue to work with.

<rdar://problem/17963645>

llvm-svn: 215244
2014-08-08 21:45:36 +00:00
Jason Molenda e66876fced Add newline at end of IOObject.h to silence clang warning.
llvm-svn: 215182
2014-08-08 02:25:17 +00:00
Jim Ingham 7fa8b17e4f Fix the description of FileSpec::Resolve to match the new signature.
llvm-svn: 215158
2014-08-07 22:34:50 +00:00
Enrico Granata a02d625513 Add a StringLexer utility class that can be used when you have string data that needs to be parsed - I don't think such a general purpose facility is part of LLVM, and I am going to need this, so just add it to lldb_utility
llvm-svn: 215133
2014-08-07 19:22:14 +00:00
Zachary Turner 3f55974024 Optimizations for FileSpec.
llvm-svn: 215124
2014-08-07 17:33:36 +00:00
Zachary Turner df62f20c75 Fix FileSpec to be able to understand Windows paths.
This patch adds the notion of a "path syntax" to FileSpec.  There
are two syntaxes (Posix and Windows) and one "meta syntax",
Host Native, which uses the current platform to figure out the
appropriate syntax for host paths.

This allows paths from one platform to be represented and
manipulated on another platform even if they have different path
syntaxes.

llvm-svn: 215123
2014-08-07 17:33:07 +00:00
Zachary Turner 98688922b7 Creates a socket host object.
This patch moves the logic of many common socket operations into
its own class lldb_private::Socket.  It then modifies the
ConnectionFileDescriptor class, and a few users of that class,
to use this new Socket class instead of hardcoding socket logic
directly.

Finally, this patch creates a common interface called IOObject for
any objects that support reading and writing, so that endpoints
such as sockets and files can be treated the same.

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

Reviewed by: Todd Fiala, Greg Clayton

llvm-svn: 214984
2014-08-06 18:16:26 +00:00
Jim Ingham 862d1bbdf6 When stepping, handle the case where the step leaves us with
the same parent frame, but different current frame - e.g. when
you step past a tail call exit from a function.  Apply the same
"avoid-no-debug" rules to this case as for a "step-in".

<rdar://problem/16189225>

llvm-svn: 214946
2014-08-06 01:49:59 +00:00
Jim Ingham 3b652621a9 Add a variant of the CommandOverrideCallback that takes a
CommandReturnObject.  Otherwise, all the overridden command
can do is say it overrode the command, not say what it did...

Also removed the duplicate definition of CommandOverrideCallback
from the private interfaces.

Now to figure out how to get this through the SB API's...

<rdar://problem/17911629>

llvm-svn: 214938
2014-08-06 00:10:12 +00:00
Jim Ingham bb006ce291 After you attach, give the process plugin a chance to report back (through
DidAttach) the architecture of the binary you attached to.

<rdar://problem/17891396>

llvm-svn: 214603
2014-08-02 00:33:35 +00:00
Greg Clayton ac58361047 Rewrote the initial DW_OP_piece support to be able to support opcodes like:
DW_OP_fbreg(N) DW_OP_piece(4) DW_OP_fbreg(M) DW_OP_piece(8)
DW_OP_fbreg(N) DW_OP_piece(4) DW_OP_piece(8)

The first grabs 4 bytes from FP+N followed by 8 bytes from FP+M, the second grabs 4 bytes from FP+N followed by zero filling 8 bytes which are unavailable. Of course regiters are stuff supported:

DW_OP_reg3 DW_OP_piece(4) DW_OP_reg8 DW_OP_piece(8)

The fix does the following:
1 - don't push the full piece value onto the stack, keep it on the side
2 - fill zeros for DW_OP_piece(N) opcodes that have nothing on the stack (instead of previously consuming the full piece that was pushed onto the stack)
3 - simplify the logic

<rdar://problem/16930524>

llvm-svn: 214415
2014-07-31 18:19:28 +00:00
Enrico Granata 2aa09d4319 When resetting the number of children on a ValueObject, also clear the existing children. This avoids issues where dynamic types change, but children stay the same
llvm-svn: 214341
2014-07-30 21:23:55 +00:00
Enrico Granata ba8eb12046 Improve the way the ObjC data formatters fetch a valid frame to use for running expressions against
This is not bullet-proof, as you might end up running in a thread where you shouldn't, but the previous policy had the same drawback
Also, in cases where code-running formatters were being recursively applied, the previous policy caused deeper levels to fail, whereas this will at least get such scenarios to function
We might eventually want to consider disqualifying certain threads/frames for "viability", but I'd rather keep it simple until complexity is proven to be necessary

llvm-svn: 214337
2014-07-30 21:07:50 +00:00
Greg Clayton 06357c930c (no commit message)
llvm-svn: 214319
2014-07-30 17:38:47 +00:00
Zachary Turner 9e757b7ebe Use llvm Support functions to get the user's home directory.
Assuming that the user's home directory is at ~ is incorrect on
Windows.  This patch delegates the request to LLVM's support
library, which already provides a cross-platform implementation
of this function.

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

llvm-svn: 214093
2014-07-28 16:45:05 +00:00
Zachary Turner ad587ae4ca Fix supported architectures on PlatformWindows.
i386, i486, i486sx, and i686 are all indistinguishable as far as
PE/COFF files are concerned.  This patch adds support for all of
these architectures to PlatformWindows.

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

llvm-svn: 214092
2014-07-28 16:44:49 +00:00
Todd Fiala b1d57febf7 Minor fixups to documentation for Process::Launch()/DoLaunch().
The code had moved forward with changes for using ProcessLaunchInfo,
but the documentation still referred to arguments that no longer
get passed to these methods.

llvm-svn: 213965
2014-07-25 19:24:52 +00:00
Ed Maste 3feafa78bd Fix endian test for big-endian hosts
The uint16_t cast truncated the magic value to 0x00000304, making the
first byte 0 (eByteOrderInvalid) on big endian hosts.

Reported by Justin Hibbits.

llvm-svn: 213861
2014-07-24 13:28:16 +00:00
Deepak Panickal 2526ee5a2d ABI for the Hexagon DSP
llvm-svn: 213566
2014-07-21 17:21:01 +00:00
Jim Ingham 4ac0443fd9 Add the ability to suppress the creation of a persistent
result variable and use in in "Process::LoadImage" so that,
for instance, "process load" doesn't increment the return
variable number.

llvm-svn: 213440
2014-07-19 01:09:16 +00:00
Greg Clayton 759e7441af LLDB now correctly handles virtual inheritance.
Test case added as well.

<rdar://problem/16785904>

llvm-svn: 213433
2014-07-19 00:12:57 +00:00
Todd Fiala 17096d7669 Add Host::MAX_THREAD_NAME_LENGTH constant.
This value gets set to a max uint32_t value when there is no known limit; otherwise,
it is set to a value appropriate for the platform.  For the moment, only
Linux, FreeBSD and NetBSD set it to 16.  All other platforms set it to
the max uint32_t value.

Modifies the Process private state thread names to fit within a 16-character limit
when the max thread name length is <= 16.  These guarantee that the thread names
can be distinguished within the first 16 characters.  Prior to this change, those
threads had names in the final dotted name segment that were not distinguishable
within the first 16 characters.

llvm-svn: 213183
2014-07-16 19:03:16 +00:00
Greg Clayton 45a44f3c4d Any commands that are executed through the public interface using SBCommandInterpreter::HandleCommand() are assumed to be in non-interactive mode.
Any commands that want interactivity (stdin) will need to be executed through the normal command interpreter using the debugger's in/out/err file handles, or by using "command source".

Individual commands through the API will have their STDIN disabled. The STDOUT and STDERR will be redirected into the SBCommandReturnObject argument to SBCommandInterpreter::HandleCommand() as usual.

This helps with a deadlock situation in an IDE (Xcode) where the IDE was managing the breakpoint actions by setting a breakpoint callback and doing things manually.

<rdar://problem/17386271>

llvm-svn: 213023
2014-07-15 00:25:59 +00:00
Greg Clayton 2740787dc9 lldb needs to support DW_op_piece masks for values in subregister and also to be able to piece together a value that is spread across multiple registers.
Patch from Adrian Prantl.

<rdar://problem/16040521> 

llvm-svn: 212867
2014-07-12 00:24:33 +00:00
Greg Clayton a39390699c Don't crash when a SBType is handed out through the API and later used after the module that owns the type is deleted.
The fix adds a std::weak_ptr<Module> into the TypeImpl and fills in the weak pointer when possible. It also checks to make sure the module is still alive prior to using it which should make our API safer to use.

<rdar://problem/15455145> 

llvm-svn: 212853
2014-07-11 22:43:15 +00:00
Greg Clayton 205ca1e89f Enable the ability to enable debug info generation when evaluating expressions.
llvm-svn: 212792
2014-07-11 01:03:57 +00:00
Zachary Turner 0ab4b48992 Get the python scripting interface working on Windows.
This patch fixes a number of issues with embedded Python on
Windows.  In particular:

1) The script that builds the python modules was normalizing the
   case of python filenames during copies.  The module name is
   the filename, and is case-sensitive, so this was breaking code.

2) Changes the build to not attempt to link against python27.lib
   (e.g. the release library) when linking against msvcrt debug
   library.  Doing a debug build of LLDB with embedded python
   support now requires you to provide your own self-compiled
   debug version of python.

3) Don't import termios when initializing the interpreter.  This
   is part of a larger effort to remove the dependency on termios
   since it is not available on Windows.  This particular instance
   was unnecessary and unused.

Reviewed by: Todd Fiala

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

llvm-svn: 212785
2014-07-10 23:47:42 +00:00
Todd Fiala 202ecd26da Fixes for broken Debian build - g++ 4.7 support.
These fix the broken debian lldb build, which is using g++ 4.7.2.

TypeFormat changes:
1. stopped using the C++11 "dtor = default;" construct.
The generated default destructor in the two derived classes wanted
them to have a different throws() semantic that was causing 4.7 to
fail to generate it.  I switched these to empty destructors defined
in the .cpp file.

2. Switched the m_types map from an ordered map to an unordered_map.
g++ 4.7's c++ library supports the C++11 emplace() used by TypeFormat
but the same c++ library's map impl does not.  Since TypeFormat didn't
look like it depended on ordering in the map, I just switched it to
a std::unordered_map.

NativeProcessLinux - g++ 4.7 chokes on lexing the "<::" in
static_cast<::pid_t>(wpid).  g++ 4.8+ and clang are fine with it.
I just put a space in between the "<" and the "::" and that cleared
it up.

llvm-svn: 212681
2014-07-10 04:39:13 +00:00
Zachary Turner d37221dc5d Revert "Fix broken tests due to new error output."
This reverts commit ec7c94f8e6860968d384b578e5564a9c55c80b4a and
re-enables OptionValidators.

llvm-svn: 212627
2014-07-09 16:31:49 +00:00
Jim Ingham 7a88ec9ac0 Add the ability to provide a "count" option to the various "thread step-*" operations. Only
step-inst and step-inst are currently supported, the rest just warn that they are not supported
if you try to provide a count.

llvm-svn: 212559
2014-07-08 19:28:57 +00:00
Bruce Mitchener aaa0ba31a9 Fix typos.
llvm-svn: 212553
2014-07-08 18:05:41 +00:00
Todd Fiala 9734280f33 Fix broken tests due to new error output.
This reverses out the options validators changes.  We'll get these
back in once the changes to the output can be resolved.

Restores broken tests on FreeBSD, Linux, MacOSX.

Changes reverted: r212500, r212317, r212290.

llvm-svn: 212543
2014-07-08 15:55:32 +00:00
Zachary Turner 310035a4f9 Implment "platform process list" for Windows.
This patch implements basic functionality of the "platform process
list" command for Windows.  Currently this has the following
limitations.

* Certain types of filtering are not enabled (e.g. filtering by
  architecture with -a), although most filters work.
* The username of the process is not yet obtained.
* Using -v to list verbose information generates an error.
* The architecture column displays the entire triple, leading to
  misaligned formatting of the printed table.

Reviewed by: Greg Clayton
Differential Revision: http://reviews.llvm.org/D4413

llvm-svn: 212510
2014-07-08 04:52:15 +00:00
Zachary Turner 24f3dee6ca Fix a compilation failure caused by a non-const reference.
llvm-svn: 212509
2014-07-08 04:28:07 +00:00
Jim Ingham 30fadafefe If a hand-called function is interrupted by hitting a breakpoint, then
when you continue to finish off the function call, the expression result
will be included as part of the thread stop info.

llvm-svn: 212506
2014-07-08 01:07:32 +00:00
Zachary Turner 28638911cd Invalidate process UID/GID-related command options on Windows.
Windows uses a different process security model and does not have
a concept of process UID or GID.  This patch makes these options
invalid on Windows.  Attempting to specify these options when the
current platform is Windows will generate an error.

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

llvm-svn: 212500
2014-07-07 23:54:51 +00:00
Sylvestre Ledru 8d352c6dcd llvm::IntrusiveRefCntPtr => std::shared_ptr to match the changes in clang r212388
llvm-svn: 212413
2014-07-06 18:39:39 +00:00
Alp Toker 5f83864b7c Track changes from clang r212388
llvm-svn: 212391
2014-07-06 05:36:57 +00:00
Todd Fiala 1b67c66c9c Windows build fixes and removal of endlessly recursive termination function.
This change removes the ScriptInterpreter::TerminateInterpreter() call which
ended up endlessly calling itself as things currently stand.  It also cleans
up some other Windows-related cmake changes.

See http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140630/011544.html
for more details.

Change by Zachary Turner

llvm-svn: 212320
2014-07-04 06:58:01 +00:00
Zachary Turner de963e9a09 Adds the notion of an OptionValidator.
The purpose of the OptionValidator is to determine, based on some
arbitrary set of conditions, whether or not a command option is
valid for a given debugger state.  An example of this might be
to selectively disable or enable certain command options that
don't apply to a particular platform.

This patch contains no functional change, and does not actually
make use of an OptionValidator for any purpose yet.  A follow-up
patch will begin to add the logic and users of OptionValidator.

Reviewed by: Greg Clayton, Jim Ingham

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

llvm-svn: 212290
2014-07-03 20:34:18 +00:00
Bruce Mitchener 1d0089fa5c Add enumerations for additional languages from DWARF spec updates.
llvm-svn: 212246
2014-07-03 00:49:08 +00:00
Greg Clayton 100eb93f89 Add host layer support for pipes.
Windows does support pipes, but they do so in a slightly different way. Added a Host layer which abstracts the use of pipes into a new Pipe class that everyone can use.

Windows benefits include:
- Being able to interrupt running processes when IO is directly hooked up 
- being able to interrupt long running python scripts
- being able to interrupt anything based on ConnectionFileDescriptor

llvm-svn: 212220
2014-07-02 21:10:39 +00:00
Zachary Turner a746e8e58a Start converting usages of off_t to other types.
off_t is a type which is used for file offsets.  Even more
specifically, it is only used by a limited number of C APIs that
deal with files.  Any usage of off_t where the variable is not
intended to be used with one of these APIs is a bug, by definition.

This patch corrects some easy mis-uses of off_t, generally by
converting them to lldb::offset_t, but sometimes by using other
types such as size_t, when appropriate.

The use of off_t to represent these offsets has worked fine in
practice on linux-y platforms, since we used _FILE_OFFSET_64 to
guarantee that off_t was a uint64.  On Windows, however,
_FILE_OFFSET_64 is unrecognized, and off_t will always be 32-bit.
So the usage of off_t on Windows actually leads to legitimate bugs.

Reviewed by: Greg Clayton

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

llvm-svn: 212192
2014-07-02 17:24:07 +00:00
Jean-Daniel Dupas e7c7c3de93 Replace uint32_t by lldb::RegisterKing in register context API.
llvm-svn: 212172
2014-07-02 09:51:28 +00:00
Todd Fiala 14bbef5ac7 Add Kalimba support to ArchSpec.
See http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140630/011508.html
for more details.

Change by Matthew Gardiner.

llvm-svn: 212145
2014-07-01 23:33:32 +00:00