stdarg formats to use __attribute__ format so the compiler can flag
incorrect uses. Fix all incorrect uses. Most of these are innocuous,
a few were resulting in crashes.
llvm-svn: 140185
Modify CommandObjectFrame.cpp to populate this field when creating a watchpoint location.
Update the test case to verify that the declaration info matches the file and line number.
llvm-svn: 139946
to execute expressions even in the absence of a process.
This allows expressions to run in situations where the
target cannot run -- e.g., to perform calculations based
on type information, or to inspect a binary's static
data.
This modification touches the following files:
lldb-private-enumerations.h
Introduce a new enum specifying the policy for
processing an expression. Some expressions should
always be JITted, for example if they are functions
that will be used over and over again. Some
expressions should always be interpreted, for
example if the target is unsafe to run. For most,
it is acceptable to JIT them, but interpretation
is preferable when possible.
Target.[h,cpp]
Have EvaluateExpression now accept the new enum.
ClangExpressionDeclMap.[cpp,h]
Add support for the IR interpreter and also make
the ClangExpressionDeclMap more robust in the
absence of a process.
ClangFunction.[cpp,h]
Add support for the new enum.
IRInterpreter.[cpp,h]
New implementation.
ClangUserExpression.[cpp,h]
Add support for the new enum, and for running
expressions in the absence of a process.
ClangExpression.h
Remove references to the old DWARF-based method
of evaluating expressions, because it has been
superseded for now.
ClangUtilityFunction.[cpp,h]
Add support for the new enum.
ClangExpressionParser.[cpp,h]
Add support for the new enum, remove references
to DWARF, and add support for checking whether
the expression could be evaluated statically.
IRForTarget.[h,cpp]
Add support for the new enum, and add utility
functions to support the interpreter.
IRToDWARF.cpp
Removed
CommandObjectExpression.cpp
Remove references to the obsolete -i option.
Process.cpp
Modify calls to ClangUserExpression::Evaluate
to pass the correct enum (for dlopen/dlclose)
SBValue.cpp
Add support for the new enum.
SBFrame.cpp
Add support for he new enum.
BreakpointOptions.cpp
Add support for the new enum.
llvm-svn: 139772
o WatchpointLocationList:
Add a GetListMutex() method.
o WatchpointLocation:
Fix Dump() method where there was an extra % in the format string.
o Target.cpp:
Add implementation to CreateWatchpointLocation() to create and enable a watchpoint.
o DNBArchImplX86_64.cpp:
Fix bugs in SetWatchpoint()/ClearWatchpoint() where '==' was used, instead of '=',
to assign/reset the data break address to a debug register.
Also fix bugs where a by reference debug_state should have been used, not by value.
llvm-svn: 139666
o Rename from OptionGroupWatchpoint::WatchMode to OptionGroupWatchpoint::WatchType,
and CommandArgumentType::eArgTypeWatchMode to CommandArgumentType::eArgTypeWatchType.
Update the sources to reflect the change.
o Add a CreateWatchpointLocation() method to Target class, which is currently not implmeneted
(returns an empty WatchpointLocationSP object). Add logic to CommandObjectFrame::Execute()
to exercise the added API for creating a watchpoint location.
llvm-svn: 139560
Also change the SourceInitFile to look for .lldb-<APPNAME> and source that
preferentially if it exists.
Also made the breakpoint site report its address as well as its breakpoint number
when it gets hit and can't find any the associated locations (usually because the
breakpoint got disabled or deleted programmatically between the time it was hit
and reported.)
Changed ThreadPlanCallFunction to initialize the ivar m_func in the initializers of the
constructor, rather than waiting to initialize till later on in the function.
Fixed a bug where if you make an SBError and the ask it Success, it returns false.
Fixed ValueObject::ResolveValue so that it resolves a temporary value, rather than
overwriting the one in the value object.
llvm-svn: 137536
event is removed. Also use the return value of asynchronous breakpoint callbacks, they get checked before, and override the
breakpoint conditions.
Added ProcessModInfo class, to unify "stop_id generation" and "memory modification generation", and use where needed.
llvm-svn: 137102
by name by adding an extra parameter to the lldb_private::Target breakpoint
setting functions.
Added a function in the DWARF symbol file plug-in that can dump errors
and prints out which DWARF file the error is happening in so we can track
down what used to be assertions easily.
Fixed the MacOSX kernel plug-in to properly read the kext images and set
the kext breakpoint to watch for kexts as they are loaded.
llvm-svn: 134990
level is not eDescriptionLevelBrief. It broke test/TestAliases.py. Besides, to have a brief breakpoint list,
you can do "breakpoint list -b".
llvm-svn: 133455
like the doc's say it should. Make sure we have a condition before we set up a test whether
we have one, so we only present a "could not parse condition" error if we actually have a condition.
llvm-svn: 133088
of duplicated code from appearing all over LLDB:
lldb::addr_t
Process::ReadPointerFromMemory (lldb::addr_t vm_addr, Error &error);
bool
Process::WritePointerToMemory (lldb::addr_t vm_addr, lldb::addr_t ptr_value, Error &error);
size_t
Process::ReadScalarIntegerFromMemory (lldb::addr_t addr, uint32_t byte_size, bool is_signed, Scalar &scalar, Error &error);
size_t
Process::WriteScalarToMemory (lldb::addr_t vm_addr, const Scalar &scalar, uint32_t size, Error &error);
in lldb_private::Process the following functions were renamed:
From:
uint64_t
Process::ReadUnsignedInteger (lldb::addr_t load_addr,
size_t byte_size,
Error &error);
To:
uint64_t
Process::ReadUnsignedIntegerFromMemory (lldb::addr_t load_addr,
size_t byte_size,
uint64_t fail_value,
Error &error);
Cleaned up a lot of code that was manually doing what the above functions do
to use the functions listed above.
Added the ability to get a scalar value as a buffer that can be written down
to a process (byte swapping the Scalar value if needed):
uint32_t
Scalar::GetAsMemoryData (void *dst,
uint32_t dst_len,
lldb::ByteOrder dst_byte_order,
Error &error) const;
The "dst_len" can be smaller that the size of the scalar and the least
significant bytes will be written. "dst_len" can also be larger and the
most significant bytes will be padded with zeroes.
Centralized the code that adds or removes address bits for callable and opcode
addresses into lldb_private::Target:
lldb::addr_t
Target::GetCallableLoadAddress (lldb::addr_t load_addr, AddressClass addr_class) const;
lldb::addr_t
Target::GetOpcodeLoadAddress (lldb::addr_t load_addr, AddressClass addr_class) const;
All necessary lldb_private::Address functions now use the target versions so
changes should only need to happen in one place if anything needs updating.
Fixed up a lot of places that were calling :
addr_t
Address::GetLoadAddress(Target*);
to call the Address::GetCallableLoadAddress() or Address::GetOpcodeLoadAddress()
as needed. There were many places in the breakpoint code where things could
go wrong for ARM if these weren't used.
llvm-svn: 131878
StoppointLocation.h.
Added a new lldb_private::Address function:
addr_t
Address::GetOpcodeLoadAddress (Target *target) const;
This will strip any special bits from an address to make sure it is suitable
for use in addressing an opcode. Often ARM addresses have an extra bit zero
that can be set to indicate ARM vs Thumb addresses (gotten from return address
registers, or symbol addresses that may be marked up specially). We need to
strip these bits off prior to setting breakpoints, so we can centralized the
place to do this inside the Address class.
llvm-svn: 131658
set by default when dumping registers. If you want to see all of the register
sets you can use the "--all" option:
(lldb) register read --all
If you want to just see some register sets, you can currently specify them
by index:
(lldb) register read --set 0 --set 2
We need to get shorter register set names soon so we can specify the register
sets by name without having to type too much. I will make this change soon.
You can also have any integer encoded registers resolve the address values
back to any code or data from the object files using the "--lookup" option.
Below is sample output when stopped in the libc function "puts" with some
const strings in registers:
Process 8973 stopped
* thread #1: tid = 0x2c03, 0x00007fff828fa30f libSystem.B.dylib`puts + 1, stop reason = instruction step into
frame #0: 0x00007fff828fa30f libSystem.B.dylib`puts + 1
(lldb) register read --lookup
General Purpose Registers:
rax = 0x0000000100000e98 "----------------------------------------------------------------------"
rbx = 0x0000000000000000
rcx = 0x0000000000000001
rdx = 0x0000000000000000
rdi = 0x0000000100000e98 "----------------------------------------------------------------------"
rsi = 0x0000000100800000
rbp = 0x00007fff5fbff710
rsp = 0x00007fff5fbff280
r8 = 0x0000000000000040
r9 = 0x0000000000000000
r10 = 0x0000000000000000
r11 = 0x0000000000000246
r12 = 0x0000000000000000
r13 = 0x0000000000000000
r14 = 0x0000000000000000
r15 = 0x0000000000000000
rip = 0x00007fff828fa30f libSystem.B.dylib`puts + 1
rflags = 0x0000000000000246
cs = 0x0000000000000027
fs = 0x0000000000000000
gs = 0x0000000000000000
As we can see, we see two constant strings and the PC (register "rip") is
showing the code it resolves to.
I fixed the register "--format" option to work as expected.
Added a setting to disable skipping the function prologue when setting
breakpoints as a target settings variable:
(lldb) settings set target.skip-prologue false
Updated the user settings controller boolean value handler funciton to be able
to take the default value so it can correctly respond to the eVarSetOperationClear
operation.
Did some usability work on the OptionValue classes.
Fixed the "image lookup" command to correctly respond to the "--verbose"
option and display the detailed symbol context information when looking up
line table entries and functions by name. This previously was only working
for address lookups.
llvm-svn: 129977
platform status -- gets status information for the selected platform
platform create <platform-name> -- creates a new instance of a remote platform
platform list -- list all available platforms
platform select -- select a platform instance as the current platform (not working yet)
When using "platform create" it will create a remote platform and make it the
selected platform. For instances for iPhone OS debugging on Mac OS X one can
do:
(lldb) platform create remote-ios --sdk-version=4.0
Remote platform: iOS platform
SDK version: 4.0
SDK path: "/Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.0"
Not connected to a remote device.
(lldb) file ~/Documents/a.out
Current executable set to '~/Documents/a.out' (armv6).
(lldb) image list
[ 0] /Volumes/work/gclayton/Documents/devb/attach/a.out
[ 1] /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.0/Symbols/usr/lib/dyld
[ 2] /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.0/Symbols/usr/lib/libSystem.B.dylib
Note that this is all happening prior to running _or_ connecting to a remote
platform. Once connected to a remote platform the OS version might change which
means we will need to update our dependecies. Also once we run, we will need
to match up the actualy binaries with the actualy UUID's to files in the
SDK, or download and cache them locally.
This is just the start of the remote platforms, but this modification is the
first iteration in getting the platforms really doing something.
llvm-svn: 127934
lldb_private::Function objects. Previously the SymbolFileSymtab subclass
would return lldb_private::Symbol objects when it was asked to find functions.
The Module::FindFunctions (...) now take a boolean "bool include_symbols" so
that the module can track down functions and symbols, yet functions are found
by the SymbolFile plug-ins (through the SymbolVendor class), and symbols are
gotten through the ObjectFile plug-ins.
Fixed and issue where the DWARF parser might run into incomplete class member
function defintions which would make clang mad when we tried to make certain
member functions with invalid number of parameters (such as an operator=
operator that had no parameters). Now we just avoid and don't complete these
incomplete functions.
llvm-svn: 124359
by LLDB. Instead of being materialized into the input structure
passed to the expression, variables are left in place and pointers
to them are materialzied into the structure. Variables not resident
in memory (notably, registers) get temporary memory regions allocated
for them.
Persistent variables are the most complex part of this, because they
are made in various ways and there are different expectations about
their lifetime. Persistent variables now have flags indicating their
status and what the expectations for longevity are. They can be
marked as residing in target memory permanently -- this is the
default for result variables from expressions entered on the command
line and for explicitly declared persistent variables (but more on
that below). Other result variables have their memory freed.
Some major improvements resulting from this include being able to
properly take the address of variables, better and cleaner support
for functions that return references, and cleaner C++ support in
general. One problem that remains is the problem of explicitly
declared persistent variables; I have not yet implemented the code
that makes references to them into indirect references, so currently
materialization and dematerialization of these variables is broken.
llvm-svn: 123371
ModuleList so they don't show up in the images. Breakpoint locations that are
in shared libraries that get unloaded will persist though so that if you
have plug-ins that load/unload and you have a breakpoint set on functions
in the plug-ins, the hit counts will persist between loads/unloads.
llvm-svn: 121069
that the result of an expression should be coerced to
a specific type. Also made breakpoint conditions pass
in the bool type for this type.
The expression parser ignores this indication for now.
llvm-svn: 119779
by being able to get the data count and data. Each thread stop reason
has one or more data words that can help describe the stop. To do this
I added:
size_t
SBThread::GetStopReasonDataCount();
uint64_t
SBThread::GetStopReasonDataAtIndex(uint32_t idx);
llvm-svn: 119720
breakpoints on inlined functions by name. This involved fixing the DWARF parser
to correctly back up and parse the concrete function when we find inlined
functions by name, then grabbing any appropriate inlined blocks and returning
symbol contexts with the block filled in. After this was fixed, the breakpoint
by name resolver needed to correctly deal with symbol contexts that had the
inlined block filled in in the symbol contexts.
llvm-svn: 119017
don't crash if we disable logging when some code already has a copy of the
logger. Prior to this fix, logs were handed out as pointers and if they were
held onto while a log got disabled, then it could cause a crash. Now all logs
are handed out as shared pointers so this problem shouldn't happen anymore.
We are also using our new shared pointers that put the shared pointer count
and the object into the same allocation for a tad better performance.
llvm-svn: 118319
than just the entire log channel.
Add checks, where appropriate, to make sure a log channel/category has
not been disabled before attempting to write to it.
llvm-svn: 117715
which holds the name of a file whose contents are
prefixed to each expression. For example, if the file
~/lldb.prefix.header contains:
typedef unsigned short my_type;
then you can do this:
(lldb) settings set target.expr-prefix '~/lldb.prefix.header'
(lldb) expr sizeof(my_type)
(unsigned long) $0 = 2
When the variable is changed, the corresponding file
is loaded and its contents are fetched into a string
that is stored along with the target. This string
is then passed to each expression and inserted into
it during parsing, like this:
typedef unsigned short my_type;
void
$__lldb_expr(void *$__lldb_arg)
{
sizeof(my_type);
}
llvm-svn: 117627
the breakpoint associated with the (filename, line_number) combo when an arrow is pointing to
a source position using Emacs Grand Unified Debugger library to interact with lldb.
The current implmentation is insufficient in that it only asks the breakpoint whether it is
associated with a breakpoint resolver with FileLine type and whether it matches the (filename, line_number)
combo. There are other breakpoint resolver types whose breakpoint locations can potentially
match the (filename, line_number) combo.
The BreakpointResolver, BreakpointResolverName, BreakpointResolverAddress, and BreakpointResolverFileLine
classes have extra static classof methods to support LLVM style type inquiry through isa, cast, and dyn_cast.
The Breakpoint class has an API method bool GetMatchingFileLine(...) which is invoked from CommandObjectBreak.cpp
to implement the "breakpoint clear" command.
llvm-svn: 117562
function. It will inspect NAME and do the following:
- if the name contains '(' or starts with "-[" or "+[" then a full name search
will happen to match full function names with args (C++ demangled names) or
full objective C method prototypes.
- if the name contains "::" and no '(', then it is assumed to be a qualified
function name that is in a namespace or class. For "foo::bar::baz" we will
search for any functions with the basename or method name of "baz", then
filter the results to only those that contain "foo::bar::baz". This allows
setting breakpoint on C++ functions and methods without having to fully
qualify all of the types that would appear in C++ mangled names.
- if the name contains ":" (not "::"), then NAME is assumed to be an ObjC
selector.
_ otherwise, we assume just a plain function basename.
Now that "--name" is our "auto" mode, I introduced the new "--basename" option
("breakpoint set --basename NAME") to allow for function names that aren't
methods or selectors, just basenames. This can also be used to ignore C++
namespaces and class hierarchies for class methods.
Fixed clang enumeration promotion types to be correct.
llvm-svn: 116293