Commit Graph

5092 Commits

Author SHA1 Message Date
Sean Callanan 0c5aabc2c7 Made nil resolve as (id)0 and not be looked up
(which regularly conflicts with existing symbols
in Objective-C).

llvm-svn: 157758
2012-05-31 17:49:31 +00:00
Greg Clayton d9896733c7 <rdar://problem/11486302>
Fixed a case where multiple threads can be asking to send a packet to the GDB server and one of three things will happen:
1 - everything works
2 - one thread will fail to send the packet due to not being able to get the sequence mutex
3 - one thread will try and interrupt the other packet sending and fail and not send the packet

Now the flow is a bit different. Prior to this fix we did:

if (try_get_sequence_mutex()) {
    send_packet()
    return success;
} else {
   if (async_ok) {
       interrupt()
       send_packet() 
       resume()
       return success;
   }
}
return fail

The issue is that the call to "try_get_sequence_mutex()" could fail if another thread was sending a packet and could cause us to just not send the packet and an error would be returned.

What we really want is to try and get the sequence mutex, and if this succeeds, send the packet. Else check if we are running and if we are, do what we used to do. The big difference is when we aren't running, we wait for the sequence mutex so we don't drop packets. Pseudo code is:

if (try_get_sequence_mutex()) {
    // Safe to send the packet right away
    send_packet()
    return success;
} else {
    if (running) {
       // We are running, interrupt and send async packet if ok to do so,
       // else it is ok to fail
       if (async_ok) {
           interrupt()
           send_packet() 
           resume()
           return success;
        }
    }
    else {
        // Not running, wait for the sequence mutex so we don't drop packets
        get_sequence_mutex()
        send_packet()
        return success;
    }
}
return fail

llvm-svn: 157751
2012-05-31 16:54:51 +00:00
Filipe Cabecinhas b76d5c965d FreeBSD patch by Viktor Kutuzov
llvm-svn: 157735
2012-05-31 07:49:36 +00:00
Sean Callanan 5bcaf5836b Fixed a missed case in the patch to make
HandleCommand take a LazyBool instead of a bool.

llvm-svn: 157728
2012-05-31 01:30:08 +00:00
Enrico Granata 5f5ab60274 <rdar://problem/11328896> Fixing a bug where regex commands were saved in the history even if they came from a 'command sourced' file - this fix introduces a command sourcing depth and disables history for all levels of depth > 0, which means no commands go into history when being sourced from a file. we need an integer depth because command files might themselves source other command files, ...
llvm-svn: 157727
2012-05-31 01:09:06 +00:00
Greg Clayton 76927ee56d <rdar://problem/11562050>
"thread continue" uses zero based thread indexes, not the thread index ID.

Also fixed "thread until" if it uses the -t option.

llvm-svn: 157724
2012-05-31 00:29:20 +00:00
Greg Clayton 177b855ed7 <rdar://problem/11537498>
Fixed an issue with the symbol table parsing of files that have STAB entries in them where there are two N_SO entries where the first has a directory, and the second contains a full path:

[     0] 00000002 64 (N_SO         ) 00     0000   0000000000000000 '/Volumes/data/src/'
[     1] 0000001e 64 (N_SO         ) 00     0000   0000000000000000 '/Volumes/data/src/Source/main.m'
[     2] 00000047 66 (N_OSO        ) 09     0001   000000004fc642d2 '/tmp/main.o'
[     3] 00000001 2e (N_BNSYM      ) 01     0000   0000000000003864
[     4] 000000bd 24 (N_FUN        ) 01     0000   0000000000003864 '_main'
[     5] 00000001 24 (N_FUN        ) 00     0000   00000000000000ae
[     6] 00000001 4e (N_ENSYM      ) 01     0000   00000000000000ae
[     7] 00000001 64 (N_SO         ) 01     0000   0000000000000000

We now correctly combine entries 0 and 1 into a single entry.

llvm-svn: 157712
2012-05-30 20:20:34 +00:00
Filipe Cabecinhas 22889540dc Mark the test as failing on both architectures, since LLDB won't handle the function to clang.
llvm-svn: 157679
2012-05-30 05:44:59 +00:00
Filipe Cabecinhas 51c277876a Make the test suite work again on Mac OS X without the LLDB_BUILD_TYPE env var
llvm-svn: 157678
2012-05-30 05:40:23 +00:00
Filipe Cabecinhas f96964b6ef Clean all files when executing 'make clean'
llvm-svn: 157677
2012-05-30 05:35:14 +00:00
Filipe Cabecinhas 9f84da9b52 Clean renamed files on 'make clean'
llvm-svn: 157669
2012-05-30 02:52:29 +00:00
Jim Ingham 3ee12ef26e We were accessing the ModuleList in the target without locking it for tasks like
setting breakpoints.  That's dangerous, since while we are setting a breakpoint,
the target might hit the dyld load notification, and start removing modules from
the list.  This change adds a GetMutex accessor to the ModuleList class, and
uses it whenever we are accessing the target's ModuleList (as returned by GetImages().)

<rdar://problem/11552372>

llvm-svn: 157668
2012-05-30 02:19:25 +00:00
Filipe Cabecinhas 970c6f39da Make dbgnub-config.pl work with multiline env vars.
llvm-svn: 157664
2012-05-30 00:44:14 +00:00
Johnny Chen f728f40873 For dump_register_value() sub-routine, issue a return after an error condition occurs.
llvm-svn: 157656
2012-05-30 00:29:12 +00:00
Jim Ingham 1afbfd0c76 Check for NULL modules coming into the SearchFilter's ModulePasses & PlatformDarwin::ModuleIsExcludedForNonModuleSpecificSearches functions.
llvm-svn: 157653
2012-05-29 23:48:51 +00:00
Sean Callanan 53bacf2130 Insert dynamic checks only if the appropriate
checker functions exist.

llvm-svn: 157652
2012-05-29 23:46:46 +00:00
Johnny Chen 6d4d4f7db3 rdar://problem/11541676
Do not show the derived registers like "eax", ... for the vanilla "register read" command.
Also add a test scenario for that.

llvm-svn: 157647
2012-05-29 21:55:08 +00:00
Johnny Chen 797a1b37e5 Fix arch_helper() to return the list of supported architectures.
llvm-svn: 157643
2012-05-29 20:04:10 +00:00
Enrico Granata de4ca5b789 rdar://problem/10996978 - Fixing an issue where crash reports for the expression parser might include symbols from the user's application
llvm-svn: 157631
2012-05-29 18:06:49 +00:00
Filipe Cabecinhas 3de2a75997 Commit Charles Davis' patch with some additional modifications.
llvm-svn: 157621
2012-05-29 14:08:19 +00:00
Filipe Cabecinhas 54d730430c Update the Makefile to expect the lldb package
llvm-svn: 157620
2012-05-29 14:06:40 +00:00
Filipe Cabecinhas 3f4b843fd1 Don't include LLDBWrapPython.cpp here. Use it in Interpreter.
llvm-svn: 157619
2012-05-29 14:03:55 +00:00
Filipe Cabecinhas fefeba65f0 Continue the work started by Dragos' Makefile patch (LLVMLibsOptions usage)
Also replace hard-coded paths with a variable.
Fixed a comment.
Included missing dependencies on Mac OS X (lldbPluginDynamicLoaderPOSIX.a
is a common dependency).
We can't use EXPORTED_SYMBOL_FILE on Darwin right now, don't pass it to
the linker just yet.

llvm-svn: 157618
2012-05-29 13:41:50 +00:00
Filipe Cabecinhas 20a5813a5f Substitute LLVMLibsOptions for LD.Flags so we can find the mentioned libs
llvm-svn: 157616
2012-05-29 13:35:46 +00:00
Filipe Cabecinhas 2137c928b0 Remove all written files
llvm-svn: 157562
2012-05-28 04:07:56 +00:00
Greg Clayton d70b14ea9d Fixed memory management issues introduced by revision 157507.
A local std::string was being filled in and then the function would return "s.c_str()".
A local StreamString (which contains a std::string) was being filled in, and essentially also returning the c string from the std::string, though it was in a the StreamString class.

The fix was to not do this by passing a stream object into StringList::Join() and fix the "arch_helper()" function to do what it should: cache the result in a global.

llvm-svn: 157519
2012-05-26 17:21:14 +00:00
Johnny Chen ca7835c685 rdar://problem/11535045
Make 'help arch' return the list of supported architectures.
Add a convenience method StringList::Join(const char *separator) which is called from the help function for 'arch'.
Also add a simple test case.

llvm-svn: 157507
2012-05-26 00:32:39 +00:00
Jim Ingham de22182b33 Fix the comments about LLDB_DISABLE_PYTHON in the python swig shell scripts to be more clear.
llvm-svn: 157506
2012-05-26 00:23:52 +00:00
Johnny Chen 7d49c9c861 rdar://problem/11533713
Allow setting conditions inline with breakpoints.  Add test cases.

llvm-svn: 157497
2012-05-25 21:10:46 +00:00
Sean Callanan 48e894bdc9 Fixed a crash in logging when the name of an
entity imported by the ASTImporter had a NamedDecl
with a name that wasn't a plain string (e.g., a
selector).

llvm-svn: 157488
2012-05-25 18:12:26 +00:00
Greg Clayton 4d78c40825 <rdar://problem/11535465>
LC_ENCRYPTION_INFO with "cryptid == 0" is not actually encrypted and LLDB fails to read memory from file.

llvm-svn: 157487
2012-05-25 18:09:55 +00:00
Greg Clayton 57f0630cc5 <rdar://problem/11534686>
Reading memory from a file when the section is encrypted doesn't show an error. No we do.

llvm-svn: 157484
2012-05-25 17:05:55 +00:00
Greg Clayton debb881079 Fixed an issue where we might have easy access to the string table data for a mach file from memory even though we have a process. So now we don't read the string table strings from memory when we don't have to.
llvm-svn: 157482
2012-05-25 17:04:00 +00:00
Jason Molenda 6bfd821ad0 Bump to lldb 152.
llvm-svn: 157456
2012-05-25 02:05:58 +00:00
Jason Molenda 6f5e8c2647 Add support for function with stack frame checks added by the compiler;
these functions will end in the sequence

  mov %rbp, %rsp
  ret
  call __stack_chk_fail

instead of the usual mov, ret.  The x86 assembly profiler only looked
for functions ending in 'ret' and added the Unwind row describing how to
set the CFA based on that -- the addition of the call insn (which is jumped
to earlier in the function body) threw off that inspection.

Resolves the need to "step" twice to get out of these functions when doing
source-level stepping.

<rdar://problem/11469705>

llvm-svn: 157454
2012-05-25 01:54:06 +00:00
Greg Clayton f1186de3f4 <rdar://problem/11529853>
Sending async packets can deadlock a program on darwin. We currently allow breakpoint packets and memory read/write packets (for software breakpoints) to be sent while a program is running. In the GDB remote plug-in, we will interrupt the run, send the async packet and resume (currently with the continue packet that caused the program to resume). If the GDB server supports the "vCont" packet, we might have initially continued with each thread stating it should continue. If new threads show up while we are stopped, which happend when running GCD, we can end up with new threads that we aren't mentioning in the continue list. So we start with a thread list of 1,2,3 and continue:

continue thread 1, continue thread 2, continue thread 3 

Now we interrupt and set a breakpoint and we actually have threads 1,2,3,4 now when we are about to resume, yet we send:

continue thread 1, continue thread 2, continue thread 3 

Any thread that isn't mentioned is currently going to stay suspended. This causes the deadlock.

llvm-svn: 157439
2012-05-24 23:42:14 +00:00
Johnny Chen a0d4b5da35 Fix missing Resources/Python directory for macosx build.
llvm-svn: 157405
2012-05-24 18:14:18 +00:00
Jim Ingham 777e6d01ea Change the "Debug" build to use the current MacOSX SDK. Fix the swig builder to have an explicit
short-circuit of the Python SWIG building, rather than relying on the SDKROOT being set.

llvm-svn: 157363
2012-05-24 01:16:09 +00:00
Johnny Chen a95ce623d8 rdar://problem/11457634
Supports the use-case scenario of immediately continuing the process once attached.
Add a simple completion test case from "process attach --con" to "process attach --continue ".

llvm-svn: 157361
2012-05-24 00:43:00 +00:00
Johnny Chen f9ef60d236 Add SBProcess::GetNumSupportedHardwareWatchpoints() API and export it through the Python scripting bridge.
Add/modify some test cases.

llvm-svn: 157353
2012-05-23 22:34:34 +00:00
Johnny Chen 6463720505 Add the capability to display the number of supported hardware watchpoints to the "watchpoint list" command.
Add default Process::GetWatchpointSupportInfo() impl which returns an error of "not supported".
Add "qWatchpointSupportInfo" packet to the gdb communication layer to support this, and modify TestWatchpointCommands.py to test it.

llvm-svn: 157345
2012-05-23 21:09:52 +00:00
Filipe Cabecinhas c34f776877 extra ';' outside of a function [-pedantic,-Wextra-semi]
llvm-svn: 157330
2012-05-23 16:27:09 +00:00
Filipe Cabecinhas 52008c641c Small fixes: actually return a boolean and remove semi-colons.
llvm-svn: 157328
2012-05-23 16:24:11 +00:00
Jim Ingham 04e0a2270a Process::Destroy should Halt before it tries to destroy so we don't have race conditions where we are in the middle of trying to service an event when we go to Destroy.
The AttachCompletionHandler should note that it has restarted the target if it indeed does so.

llvm-svn: 157327
2012-05-23 15:46:31 +00:00
Johnny Chen ebffd2e7fd Add more convenience registers to x86_64 and a simple test scenario:
self.expect("expr -- $ax == (($ah << 8) | $al)",
            substrs = ['true'])

llvm-svn: 157302
2012-05-22 23:32:12 +00:00
Sean Callanan 8b1e432113 Integrated a fix for an ARM disassembler crash
(0xd 0xd 0xa0 0xf4, or "vld2hs.8 {d0[], d1[]}, [r0]!")

llvm-svn: 157289
2012-05-22 21:42:43 +00:00
Johnny Chen 6c26f0b2a7 Fix a typo.
llvm-svn: 157278
2012-05-22 19:41:53 +00:00
Johnny Chen 819b35daf7 Add a test case to check that eax's content equals the lower half of rax.
Plus fix the test class name as well as wrong directory path.

llvm-svn: 157277
2012-05-22 19:37:01 +00:00
Johnny Chen b42b05e6de The RegisterInfo descriptors for the convenience registers can specify an offset to be added to the offset as derived from
the value_regs field, which is useful for future expansion purposes.  As of now, we have:

    calculated_offset_of_eax = offset_of_rax + (offset_of_eax_from_the_descriptor which is 0)

llvm-svn: 157275
2012-05-22 18:59:38 +00:00
Johnny Chen 377c63da9e Fix wrong offset of eax and friends pointed out by Greg.
rdar://problem/11487457

llvm-svn: 157272
2012-05-22 18:34:18 +00:00