class is a templatized class that allows you to have a cleanup function called
on a data value of type T when the value is set or when the object goes
out of scope. It has support for very rudimentary invalid value detection that
can be enabled by using the appropriate constructor.
Anyone with template experience that can see ways of improving this class
please let me know. The example code shows a few typical scenarios in which
I would like to use it. It is currently coded with simple type T values
in mind (integer file descriptors, pointers, etc), but I am sure some
specialization might help out the class for more complex types.
There is a lot of documentation including examples in the CleanUp.h header
file.
llvm-svn: 109239
ThreadCancel in Host::WillTerminate g_monitor_thread may be blocked on a call
to pthread_cond_wait (for example, line 640). Now, by default, when a
cancellation request is serviced g_monitor_thread will again own the mutex
guarding the condition variable it was waiting on. This causes the call to
SetValue in Host::WillTerminate to hit a deadlock.
The call to SetValue does not appear to be needed, so removing it solves
the issue.
Patch from Stephen Wilson.
llvm-svn: 109228
a segfault when calling pthread_cancel. Also, sets m_read_thread_enabled if
the thread is actually spawned.
Patch from Stephen Wilson.
llvm-svn: 109227
to be executed by the inferior. This required explicit support
from RecordingMemoryManager for finding the address range
belonging to a particular function.
Also fixed a bug in DisassemblerLLVM where the disassembler
assumed there was an AddressRange available even when it was
NULL.
llvm-svn: 109209
and moved it to its own header file for cleanliness.
Added more logging to ClangFunction so that we can
diagnose crashes in the executing expression.
Added code to extract the result of the expression
from the struct that is passed to the JIT-compiled
code.
llvm-svn: 109199
invalidated. There was a race condition where the private thread would
invalidate its own pthread_t object before the parent could perform a
pthread_cancel/pthread_join sequence.
Patch from Stephen Wilson.
llvm-svn: 109131
I also added new functions to create an Objective C class, ivar and set an objective C superclass. They aren't hooked up in the DWARF parser yet. That is the next step, though I am unsure if I will do this in the DWARF parser or try and do it generically in the existing Record manipulation functions.
llvm-svn: 109130
SectionType for Section objects for DWARF.
Modified the DWARF plug-in to get the DWARF sections by SectionType so we
can safely abstract the LLDB core from section names for the various object
file formats.
Modified the SectionType definitions for .debug_pubnames and .debug_pubtypes
to use the correct case.
llvm-svn: 109054
defines that are in "llvm/Support/MachO.h". This should allow ObjectFileMachO
and ObjectContainerUniversalMachO to be able to be cross compiled in Linux.
Also did some cleanup on the ASTType by renaming it to ClangASTType and
renaming the header file. Moved a lot of "AST * + opaque clang type *"
functionality from lldb_private::Type over into ClangASTType.
llvm-svn: 109046
used by the JIT compiled expression, including the
result of the expression.
Also added a new class, ASTType, which encapsulates an
opaque Clang type and its associated AST context.
Refactored ClangExpressionDeclMap to use ASTTypes,
significantly reducing the possibility of mixups of
types from different AST contexts.
llvm-svn: 108965
to correctly unfold constant-folded global variables.
Also added code to JIT the expression. Simple
expressions are now JIT compiled successfully.
llvm-svn: 108380
Fixed the llvm build for Mac OS X builds to look in llvm/lib/Release+Asserts
output directory for all configurations (Debug, Release, BuildAndIntegration).
llvm-svn: 108289
Makefile patch to explicitly use PROJ_SRC_DIR when required. It fixes
build when obj dir is not source dir.
I also fixed a build warning in ClangResultSynthesizer.cpp.
llvm-svn: 108210
This relies on ThreadPlanStepOut working correctly, which it doesn't currently for Inlined functions, so this feature is only partially useful until we take care of Stepping Out of inlined functions.
Added an option to "thread step-in" to set the avoid regular expression. This is mostly for testing, once the Setting code is redone, we'll move this to a general setting.
llvm-svn: 108036
enabled LLVM make style building and made this compile LLDB on Mac OS X. We
can now iterate on this to make the build work on both linux and macosx.
llvm-svn: 108009
Also fixed our build to define NDEBUG; code that
uses LLVM headers without NDEBUG is
binary-incompatible with libraries built with
NDEBUG.
llvm-svn: 107853
Move the "source", "alias", and "unalias" commands to "commands *".
Move "source-file" to "source list".
Added a "source info" command but it isn't implemented yet.
llvm-svn: 107751
instead of the last history item to provide a command for the "empty" command.
Use this in the source-file command to make <RETURN> continue the listing rather
than relist the first listing...
llvm-svn: 107736
line table entries that were termination entries (ones that define the bounds
of the previous entry) could be found when looking up line table entries.
We now properly skip these termination entries and check the next entry to
try for a match.
llvm-svn: 107729
interface so everybody does it the same way. Add an "exact" lookup for internal uses.
Fix up a few little cases where we weren't reporting command lookup errors correctly.
Added "b" as an alias for "breakpoint" so it doesn't collide with "bt".
llvm-svn: 107718
module lldbtest.py and refactored the existing test cases to derive from the
abstract base class lldbtest.TestBase.
MOdified the test driver (dotest.py and dotest.pl) to set up additional
PYTHONPATH component for locating the lldbtest module, which sits in the same
directory.
llvm-svn: 107563
prepare IR for execution in the target. Wired the
expression command to use this IR transformer when
conversion to DWARF fails, and wired conversion to
DWARF to always fail (well, we don't generate any
DWARF...)
llvm-svn: 107559
- fixed 3 posix spawn attributes leaks
- fixed us always leaking CXXBaseSpecifier objects when we create class
base classes. Clang apparently copies the base classes we pass in.
Fixed some code formatting in ClangASTContext.cpp.
llvm-svn: 107459
removing it didn't cause any performance loss, and leaks were showing up
when run under instruments when we tried to re-use the buffer. We are now leak
free and still just as performant.
llvm-svn: 107453
is defined. Use ${LLDB_LOG} to specify the log file.
Create a singleton SBDebugger in the lldb namespace, that gets used when running
the entire test suite.
llvm-svn: 107445
an expression, adding code to put the value of the
last expression (if there is one) into a variable
and write the address of that variable to a global
pointer.
llvm-svn: 107419
that are in the disassembly comments since most of them are in the same
module (shared library).
Fixed a crasher that could happen when disassembling special section data.
Added an address dump style that shows the symbol context without the module
(used in the disassembly code).
llvm-svn: 107366
Added the ability to read memory from the target's object files when we aren't
running, so disassembling works before you run!
Cleaned up the API to lldb_private::Target::ReadMemory().
Cleaned up the API to the Disassembler to use actual "lldb_private::Address"
objects instead of just an "addr_t". This is nice because the Address objects
when resolved carry along their section and module which can get us the
object file. This allows Target::ReadMemory to be used when we are not
running.
Added a new lldb_private::Address dump style: DumpStyleDetailedSymbolContext
This will show a full breakdown of what an address points to. To see some
sample output, execute a "image lookup --address <addr>".
Fixed SymbolContext::DumpStopContext(...) to not require a live process in
order to be able to print function and symbol offsets.
llvm-svn: 107350
do 'variable list this' command when stopped.
Applied some cleanup on TestArrayTypes.py. In particular, specify the absolute
path to the object file in order not to confuse the debugger.
llvm-svn: 107330
Add functions to look up debugger by id
Add global variable to lldb python module, to hold debugger id
Modify embedded Python interpreter to update the global variable with the
id of its current debugger.
Modify the char ** typemap definition in lldb.swig to accept 'None' (for NULL)
as a valid value.
The point of all this is so that, when you drop into the embedded interpreter
from the command interpreter (or when doing Python-based breakpoint commands),
there is a way for the Python side to find/get the correct debugger
instance ( by checking debugger_unique_id, then calling
SBDebugger::FindDebuggerWithID on it).
llvm-svn: 107287
Add a way for the completers to say whether the completed argument should have a space inserted after is
or not.
Added the file name completer to the "file" command.
llvm-svn: 107247
Also modified dotest.py so that it sets the LLDB_TEST environment variable
so that individual test cases can locate their supporting files correctly.
llvm-svn: 107220
Added the ability to dump any file in the global module cache using any of
the "image dump" commands. This allows us to dump the .o files that are used
with DWARF + .o since they don't belong the the target list for the current
target.
llvm-svn: 107100
intelligently. The four name types we currently have are:
eFunctionNameTypeFull = (1 << 1), // The function name.
// For C this is the same as just the name of the function
// For C++ this is the demangled version of the mangled name.
// For ObjC this is the full function signature with the + or
// - and the square brackets and the class and selector
eFunctionNameTypeBase = (1 << 2), // The function name only, no namespaces or arguments and no class
// methods or selectors will be searched.
eFunctionNameTypeMethod = (1 << 3), // Find function by method name (C++) with no namespace or arguments
eFunctionNameTypeSelector = (1 << 4) // Find function by selector name (ObjC) names
this allows much more flexibility when setting breakoints:
(lldb) breakpoint set --name main --basename
(lldb) breakpoint set --name main --fullname
(lldb) breakpoint set --name main --method
(lldb) breakpoint set --name main --selector
The default:
(lldb) breakpoint set --name main
will inspect the name "main" and look for any parens, or if the name starts
with "-[" or "+[" and if any are found then a full name search will happen.
Else a basename search will be the default.
Fixed some command option structures so not all options are required when they
shouldn't be.
Cleaned up the breakpoint output summary.
Made the "image lookup --address <addr>" output much more verbose so it shows
all the important symbol context results. Added a GetDescription method to
many of the SymbolContext objects for the more verbose output.
llvm-svn: 107075
Tests for lldb are written as python scripts which take advantage of the script
bridging provided by LLDB.framework to interact with lldb core.
A specific naming pattern is followed by the .py script to be recognized as
a module which implements a test scenario, namely, Test*.py.
To specify the directories where "Test*.py" python test scripts are located,
you need to pass in a list of directory names. By default, the current
working directory is searched if nothing is specified on the command line.
An example:
[14:10:20] johnny:/Volumes/data/lldb/svn/trunk/test $ ./dotest.py -v example
test_choice (TestSequenceFunctions.TestSequenceFunctions) ... ok
test_sample (TestSequenceFunctions.TestSequenceFunctions) ... ok
test_shuffle (TestSequenceFunctions.TestSequenceFunctions) ... ok
----------------------------------------------------------------------
Ran 3 tests in 0.000s
OK
llvm-svn: 106890
- Rationalized EvaluateExpression to remove a lot
of nesting; also added comments to make it easy
to find what's happening where
- Made ExecuteRawCommandString subcontract out to
EvaluateExpression
- Minor logging improvements
llvm-svn: 106703
to the debugger from GUI windows. Previously there was one global debugger
instance that could be accessed that had its own command interpreter and
current state (current target/process/thread/frame). When a GUI debugger
was attached, if it opened more than one window that each had a console
window, there were issues where the last one to setup the global debugger
object won and got control of the debugger.
To avoid this we now create instances of the lldb_private::Debugger that each
has its own state:
- target list for targets the debugger instance owns
- current process/thread/frame
- its own command interpreter
- its own input, output and error file handles to avoid conflicts
- its own input reader stack
So now clients should call:
SBDebugger::Initialize(); // (static function)
SBDebugger debugger (SBDebugger::Create());
// Use which ever file handles you wish
debugger.SetErrorFileHandle (stderr, false);
debugger.SetOutputFileHandle (stdout, false);
debugger.SetInputFileHandle (stdin, true);
// main loop
SBDebugger::Terminate(); // (static function)
SBDebugger::Initialize() and SBDebugger::Terminate() are ref counted to
ensure nothing gets destroyed too early when multiple clients might be
attached.
Cleaned up the command interpreter and the CommandObject and all subclasses
to take more appropriate arguments.
llvm-svn: 106615
I'm not sure when multiple threads enter this method but a race-condition
causing a crash in malloc can be reproduced with this little script:
echo file $(which lldb) > cmd
echo "run\nbreak set -n main\nrun\nexit" >> cmd
lldb -s cmd
It may need a few runs before it crashes though.
llvm-svn: 106544
This also fixes a bug where we were trying to copy m_string into itself
via a format string. The pointer was invalidated by m_string.resize and
lldb (sometimes) crashed inside vsnprintf.
llvm-svn: 106416
without having to use RTTI.
Removed the ThreadPlanContinue and replaced with a ShouldAutoContinue query that serves the same purpose. Having to push
another plan to assert that if there's no other indication the target should continue when this plan is popped was flakey
and error prone. This method is more stable, and fixed problems we were having with thread specific breakpoints.
llvm-svn: 106378
than picking bits out of the breakpoint options. Added BreakpointOptions::GetDescription to do this job. Some more mucking
around to keep the breakpoint listing from getting too verbose.
llvm-svn: 106262
other script files around, so they can be run from outside Xcode. Also,
check the current OS, and only try to use the framework structure stuff on
Darwin systems.
llvm-svn: 106132
Push this through all the breakpoint management code. Allow this to be set when the breakpoint is created.
Fix the Process classes so that a breakpoint hit that is not for a particular thread is not reported as a
breakpoint hit event for that thread.
Added a "breakpoint configure" command to allow you to reset any of the thread
specific options (or the ignore count.)
llvm-svn: 106078
generated by a script. I don't know if we're still regenerating
it or not; will have to check with Greg about how he's handling this
now. Should update it for the final DWARF3 and soon-to-be-released
DWARF4 constants while I'm at it..
llvm-svn: 106045
Fixed the Disassemble arguments so you can't specify start address or name in multiple ways.
Fixed the command line input so you can specify the filename without "-f" even if you use other options.
llvm-svn: 106020
BreakpointLocation::GetLoadAddress() does not match the 'StoppointLocation::GetLoadAddress() const' virtual function prototype, and so, does not override the superclass function.
llvm-svn: 105927
We need to put this in LLDB since we need to vend this in our API
because our public API uses shared pointers to our private objects.
Removed a deprecated file: include/lldb/Host/Types.h
Added the new SharingPtr.cpp/.h files into source/Utility.
Added a shell script build phase that fixes up all headers in the
LLDB.framework.
llvm-svn: 105895
Change the Release -rpath LDFLAG to look for LLDB.framework in the
same directory as the lldb binary itself. For the BuildAndIntegration
target, continue to use the ../../ etc path to match how we install
the binaries inside Apple.
Patch from Dimiter "malkia" Stanev. I still need to look at the
suggested changing of ONLY_ACTIVE_ARCH settings.
llvm-svn: 105864
ickiness, and is cleaner to boot.
I'm fairly confident that I converted the comparator over properly,
and what testing I could figure out how to run seemed to pass, but it
would be great if someone in the know could check behind me.
llvm-svn: 105834
type and sub-type, or an ELF e_machine value. Also added a generic CPU type
to the arch spec class so we can have a single arch definition that the LLDB
core code can use. Previously a lot of places in the code were using the
mach-o definitions from a macosx header file.
Switches over to using "llvm/Support/MachO.h" for the llvm::MachO::XXX for the
CPU types and sub types for mach-o ArchSpecs. Added "llvm/Support/ELF.h" so
we can use the "llvm::ELF::XXX" defines for the ELF ArchSpecs.
Got rid of all CPU_TYPE_ and CPU_SUBTYPE_ defines that were previously being
used in LLDB.
llvm-svn: 105806
The top of the header file seems to indicate that this was
intended to be over at include/lldb/Core but we should be in line
with the .cpp file's location so it's include/lldb/Utility for now.
llvm-svn: 105753
Google C++ coding guidelines where includes are done as:
1 - the header file for the current source file
2 - C includes
3 - C++ includes
4 - external project includes
5 - current project includes
llvm-svn: 105748