Commit Graph

163 Commits

Author SHA1 Message Date
Greg Clayton 2bf10c3766 Bumping Xcode project versions for lldb-126 and debugserver-176.
llvm-svn: 152384
2012-03-09 04:31:41 +00:00
Jason Molenda e83bc02b16 Bump to lldb-125.
llvm-svn: 152353
2012-03-08 23:25:56 +00:00
Greg Clayton ef5a7b1c36 Bumping Xcode project version for lldb-124 and debugserver-175.
llvm-svn: 152294
2012-03-08 04:15:20 +00:00
Jason Molenda 82df6635fe Use a new define, NO_XPC_SERVICES, to indicate that macosx/Host.mm
shouldn't compile any of the XPC support code.  

Update macosx/Host.mm to use that define.

Add a LLDB_DISABLE_PYTHON ifdef block around a new function in 
Core/FormatManager.cpp.

<rdar://problem/10942125>

llvm-svn: 152293
2012-03-08 04:03:25 +00:00
Han Ming Ong e86f8f4df9 <rdar://10996650>
Passed in the right number of parameters for CFDictionaryCreate

llvm-svn: 152182
2012-03-07 00:32:38 +00:00
Greg Clayton 6a820b624b Bumping Xcode project versions for lldb-123 and debugserver-174.
llvm-svn: 152103
2012-03-06 04:02:03 +00:00
Greg Clayton 6a1edd70cf Bumped project Xcode project version for lldb-122 and debugserver-173.
llvm-svn: 152088
2012-03-06 01:36:31 +00:00
Greg Clayton ba3c8df4d9 Bumped Xcode project versions for lldb-121 and debugserver-172
llvm-svn: 151948
2012-03-02 22:36:23 +00:00
Greg Clayton 4a49a1ff7a Bumping Xcode project versions for lldb-120 and debugserver-171.
llvm-svn: 151924
2012-03-02 17:44:37 +00:00
Greg Clayton 29c5e5bb7d Bumped Xcode project version for lldb-119 and debugserver-170.
llvm-svn: 151836
2012-03-01 21:07:11 +00:00
Greg Clayton 9029f2d8e0 Fixed the install path for the XPC binaries. Added 3 aggregate targets:
"desktop" - build all binaries with XPC
"desktop_no_xcp" - build all binaries with none of the XPC binaries
"ios" - build all binaries with special iOS install settings.

Bumped the Xcode project build version for lldb-118 and debugserver-169.

llvm-svn: 151740
2012-02-29 19:16:02 +00:00
Han Ming Ong 1c0c51a51a <rdar://10950196>
Returns true when there is any info retrieved.

llvm-svn: 151678
2012-02-29 00:09:16 +00:00
Han Ming Ong 8bd6a81b10 <rdar://problem/10942472>
Allows the debugger to put a more sensible prompt when debugging as root.

llvm-svn: 151605
2012-02-28 01:18:30 +00:00
Greg Clayton d10a038cf3 Added the POSIX-DYLD as a plug-in in the darwin build in the Xcode project
so that we don't break it with code changes. 

After doing this I was able to fix the POSIX-DYLD plug-in so that it builds
after recent ModuleSpec changes.

llvm-svn: 151536
2012-02-27 19:00:34 +00:00
Greg Clayton b9a01b3990 Made a ModuleSpec class in Module.h which can specify a module using one or
more of the local path, platform path, associated symbol file, UUID, arch,
object name and object offset. This allows many of the calls that were
GetSharedModule to reduce the number of arguments that were used in a call
to these functions. It also allows a module to be created with a ModuleSpec
which allows many things to be specified prior to any accessors being called
on the Module class itself. 

I was running into problems when adding support for "target symbol add"
where you can specify a stand alone debug info file after debugging has started
where I needed to specify the associated symbol file path and if I waited until
after construction, the wrong  symbol file had already been located. By using
the ModuleSpec it allows us to construct a module with as little or as much
information as needed and not have to change the parameter list.

llvm-svn: 151476
2012-02-26 05:51:37 +00:00
Greg Clayton 722cec2957 <rdar://problem/9886712>
Added a dedicated platform for the iOS simulator. This helps us to find the
correct files for a simulator binary before running and helps us select the 
right arch (i386 only) for files when we load them.

llvm-svn: 151436
2012-02-25 06:56:35 +00:00
Greg Clayton c77c97ce85 Bumped Xcode project version to lldb-117 and debugserver-168.
llvm-svn: 151422
2012-02-25 01:50:48 +00:00
Han Ming Ong 846470482c <rdar://problem/3535148>
Added ability to debug root processes on OS X. This uses XPC service that is available on Lion and above only.

llvm-svn: 151419
2012-02-25 01:07:38 +00:00
Benjamin Kramer ff461fcf07 Remove a ton of implicit narrowing conversions for C++11 compatibility.
llvm-svn: 151071
2012-02-21 18:37:14 +00:00
Greg Clayton c859e2d524 Full core file support has been added for mach-o core files.
Tracking modules down when you have a UUID and a path has been improved.

DynamicLoaderDarwinKernel no longer parses mach-o load commands and it
now uses the memory based modules now that we can load modules from memory.

Added a target setting named "target.exec-search-paths" which can be used
to supply a list of directories to use when trying to look for executables.
This allows one or more directories to be used when searching for modules
that may not exist in the SDK/PDK. The target automatically adds the directory
for the main executable to this list so this should help us in tracking down
shared libraries and other binaries. 

llvm-svn: 150426
2012-02-13 23:10:39 +00:00
Johnny Chen fdc80a5cf7 lldb should warn when dSYM does not match the binary.
o Symbols.cpp:

  Emit a warning message when dSYM does not match the binary.

o warnings/uuid:

  Added regression test case.

o lldbtest.py:

  Modified to allow test case writer to demand that the build command does not begin
  with a clean first; required to make TestUUIDMismatchWanring.py work.

rdar://problem/10515708

llvm-svn: 149465
2012-02-01 01:49:50 +00:00
Johnny Chen f8f0fd765e Fix typo.
llvm-svn: 149140
2012-01-27 18:53:22 +00:00
Greg Clayton ecc6116950 Enable extra error checking for debug builds in our mutexes by
watching for errors from pthread_mutex_destroy () (usually "Resource
busy" errors for when you have a mutex locked and try to destroy
it), and pthread_mutex_lock, and pthread_mutex_unlock (usually for
trying to lock an invalid mutex that might have possible already
been freed).

llvm-svn: 149135
2012-01-27 18:29:47 +00:00
Greg Clayton 44435ed07a Big change in the way ObjectFile file contents are managed. We now
mmap() the entire object file contents into memory with MAP_PRIVATE.
We do this because object file contents can change on us and currently
this helps alleviate this situation. It also make the code for accessing
object file data much easier to manage and we don't end up opening the
file, reading some data and closing the file over and over.

llvm-svn: 148017
2012-01-12 05:25:17 +00:00
Greg Clayton 4017fa399b <rdar://problem/10652336>
Fixed a crasher when trying to load an expression prefix file:

% touch /tmp/carp.txt
% xcrun lldb
(lldb) settings set target.expr-prefix /tmp/carp.txt
Segmentation fault

llvm-svn: 147646
2012-01-06 02:01:06 +00:00
Johnny Chen 30213ffc28 This patch combines common code from Linux and FreeBSD into
a new POSIX platform.  It also contains fixes for 64bit FreeBSD.

The patch is based on changes by Mark Peek <mp@FreeBSD.org> and
"K. Macy" <kmacy@freebsd.org> in their github repo located at
https://github.com/fbsd/lldb.

llvm-svn: 147609
2012-01-05 19:17:38 +00:00
Greg Clayton e38a5edd9e Added code in the Host layer that can report system log messages
so that we don't have "fprintf (stderr, ...)" calls sprinkled everywhere.
Changed all needed locations over to using this.

For non-darwin, we log to stderr only. On darwin, we log to stderr _and_
to ASL (Apple System Log facility). This will allow GUI apps to have a place
for these error and warning messages to go, and also allows the command line
apps to log directly to the terminal.

llvm-svn: 147596
2012-01-05 03:57:59 +00:00
Greg Clayton 96c09687bc <rdar://problem/10507811>
Be better at detecting when DWARF changes and handle this more
gracefully than asserting and exiting.

Also fixed up a bunch of system calls that weren't properly checking
for EINTR.

llvm-svn: 147559
2012-01-04 22:56:43 +00:00
Greg Clayton e91b7957b2 Expose new read memory fucntion through python in SBProcess:
size_t
    SBProcess::ReadCStringFromMemory (addr_t addr, void *buf, size_t size, lldb::SBError &error);

    uint64_t
    SBProcess::ReadUnsignedFromMemory (addr_t addr, uint32_t byte_size, lldb::SBError &error);

    lldb::addr_t
    SBProcess::ReadPointerFromMemory (addr_t addr, lldb::SBError &error);

These ReadCStringFromMemory() has some SWIG type magic that makes it return the
python string directly and the "buf" is not needed:

error = SBError()
max_cstr_len = 256
cstr = lldb.process.ReadCStringFromMemory (0x1000, max_cstr_len, error)
if error.Success():
    ....

The other two functions behave as expteced. This will make it easier to get integer values
from the inferior process that are correctly byte swapped. Also for pointers, the correct
pointer byte size will be used.

Also cleaned up a few printf style warnings for the 32 bit lldb build on darwin.

llvm-svn: 146636
2011-12-15 03:14:23 +00:00
Greg Clayton 61e7a58c0c Process IDs (lldb::pid_t) and thread IDs (lldb::tid_t) are now 64 bit. This
will allow us to represent a process/thread ID using a pointer for the OS
plug-ins where they might want to represent the process or thread ID using
the address of the process or thread structure.

llvm-svn: 145644
2011-12-01 23:28:38 +00:00
Greg Clayton 1c4cd07aff Now that I fixed the uninitialized callback problem, I can enable GCD pid
monitoring on darwin in the host layer.

llvm-svn: 144918
2011-11-17 19:41:57 +00:00
Greg Clayton 2637f82542 Fixed an issue with the pthread_setspecific() where we weren't NULL-ing out
the thread specific data and were destroying the thread specfic data more
than once.

Also added the ability to ask a lldb::StateType if it is stopped with an
additional paramter of "must_exist" which means that the state must be a
stopped state for a process that still exists. This means that eStateExited
and eStateUnloaded will no longer return true if "must_exist" is set to true.

llvm-svn: 144875
2011-11-17 01:23:07 +00:00
Greg Clayton e4e45924d7 Made the darwin host layer properly reap any child processes that it spawns.
After recent changes we weren't reaping child processes resulting in many
zombie processes. 

This was fixed by adding more settings to the ProcessLaunchOptions class
that allow clients to specify a callback function and baton to be notified
when their process dies. If one is not supplied a default callback will be
used that "does the right thing". 

Cleaned up a race condition in the ProcessGDBRemote class that would attempt
to monitor when debugserver died. 

Added an extra boolean to the process monitor callbacks that indicate if a
process exited or not. If your process exited with a zero exit status and no
signal, both items could be zero.

Modified the process monitor functions to not require a callback function
in order to reap the child process.

llvm-svn: 144780
2011-11-16 05:37:56 +00:00
Greg Clayton 144f3a9c90 Added a new class to Process.h: ProcessAttachInfo. This class contains enough
info for us to attach by pid, or by name and will also allow us to eventually
do a lot more powerful attaches. If you look at the options for the "platform
process list" command, there are many options which we should be able to
specify. This will allow us to do things like "attach to a process named 'tcsh'
that has a parent process ID of 123", or "attach to a process named 'x' which
has an effective user ID of 345". 

I finished up the --shell implementation so that it can be used without the
--tty option in "process launch". The "--shell" option now can take an 
optional argument which is the path to the shell to use (or a partial name
like "sh" which we will find using the current PATH environment variable).

Modified the Process::Attach to use the new ProcessAttachInfo as the sole
argument and centralized a lot of code that was in the "process attach"
Execute function so that everyone can take advantage of the powerful new
attach functionality.

llvm-svn: 144615
2011-11-15 03:53:30 +00:00
Greg Clayton c9ed478a39 Added the ability to run a process in a shell on MacOSX currently when using
the --tty option. So you can now get shell expansion and file redirection:

(lldb) process launch --tty --shell -- *.jpg < in.txt > out.txt

Again, the "--tty" is mandatory for now until we hook this up to other 
functions. The shell is also currently hard coded to "/bin/bash" and not the
"SHELL" variable. "/bin/tcsh" was causing problems which I need to dig into.

llvm-svn: 144443
2011-11-12 02:10:56 +00:00
Greg Clayton f49e65ae7c Made the Host::SetCrashDescription(const char *) function copy the incoming
string to avoid possible later crashes.

Modified the locations that do set the crash description to NULL out the 
string when they are done doing their tasks.

llvm-svn: 144297
2011-11-10 18:31:53 +00:00
Greg Clayton 1d8859668f Moved many of the "settings" that used to be in "target.process.*" to just
be in the target. All of the environment, args, stdin/out/err files, etc have
all been moved. Also re-enabled the ability to launch a process in a separate
terminal on MacOSX.

llvm-svn: 144061
2011-11-08 02:43:13 +00:00
Peter Collingbourne 1f6198d404 Update a missed getHostTriple call, fixes non-__APPLE__ build
llvm-svn: 143774
2011-11-05 01:35:31 +00:00
Benjamin Kramer 44030f12f1 Fix linux build after r143679.
llvm-svn: 143703
2011-11-04 16:06:40 +00:00
Greg Clayton 0ddf6be103 Fixed a build issue on an older Xcode.
llvm-svn: 143679
2011-11-04 03:42:38 +00:00
Greg Clayton dce502ede0 Fixed the Xcode project building of LLVM to be a bit more user friendly:
- If you download and build the sources in the Xcode project, x86_64 builds
  by default using the "llvm.zip" checkpointed LLVM.
- If you delete the "lldb/llvm.zip" and the "lldb/llvm" folder, and build the
  Xcode project will download the right LLVM sources and build them from 
  scratch
- If you have a "lldb/llvm" folder already that contains a "lldb/llvm/lib"
  directory, we will use the sources you have placed in the LLDB directory.
  
Python can now be disabled for platforms that don't support it. 

Changed the way the libllvmclang.a files get used. They now all get built into
arch specific directories and never get merged into universal binaries as this
was causing issues where you would have to go and delete the file if you wanted
to build an extra architecture slice.

llvm-svn: 143678
2011-11-04 03:34:56 +00:00
Benjamin Kramer f82d8064d4 The alpha and system z backends were removed.
llvm-svn: 143613
2011-11-03 12:13:52 +00:00
Daniel Dunbar 5ae8732394 build: Fix an improperly formed include path (works under Xcode's promiscuous include additions, but not Makefiles).
llvm-svn: 143382
2011-10-31 22:50:53 +00:00
Greg Clayton 708c1ab6f5 Python does some bad things to the signal masks in the current process and
then we spawn child processes (debugserver, etc) and those bad settings get 
inherited. We stop this from happening by correctly mucking with the posix
spawn attributes.

llvm-svn: 143176
2011-10-28 01:24:12 +00:00
Sean Callanan c0a6e0619d Added a function to the Host that gets a dummy target
for it, so that people who want to use LLDB as a
calculator can run simple expressions without needing
a target or process.

llvm-svn: 143147
2011-10-27 21:22:25 +00:00
Greg Clayton 86edbf41d1 Cleaned up many error codes. For any who is filling in error strings into
lldb_private::Error objects the rules are:
- short strings that don't start with a capitol letter unless the name is a
  class or anything else that is always capitolized
- no trailing newline character
- should be one line if possible

Implemented a first pass at adding "--gdb-format" support to anything that
accepts format with optional size/count.

llvm-svn: 142999
2011-10-26 00:56:27 +00:00
Johnny Chen f5df537d26 Fix build under gcc.
Patch from Dawn.

llvm-svn: 142402
2011-10-18 19:28:30 +00:00
Enrico Granata a9dbf4325e this patch introduces a new command script import command which takes as input a filename for a Python script and imports the module contained in that file. the containing directory is added to the Python path such that dependencies are honored. also, the module may contain an __lldb_init_module(debugger,dict) function, which gets called after importing, and which can somehow initialize the module's interaction with lldb
llvm-svn: 142283
2011-10-17 21:45:27 +00:00
Jim Ingham 87df91b866 Added the ability to restrict breakpoints by function name, function regexp, selector
etc to specific source files.
Added SB API's to specify these source files & also more than one module.
Added an "exact" option to CompileUnit's FindLineEntry API.

llvm-svn: 140362
2011-09-23 00:54:11 +00:00
Jason Molenda 542adbfccf Change the macosx Host::FindProcesses() to include all processes
(running under any uid) if lldb is being run as root.  It might be
better to handle this up at the ProcessInstanceInfoMatch class with
its m_match_all_users ivar instead of down here...

llvm-svn: 139566
2011-09-13 00:52:59 +00:00