Re: [Lldb-commits] [lldb] r202956 - Add support for JIT debugging on Linux using the GDB JIT interface. Patch written with Keno Fischer.

2014-03-07 Thread Andrew MacPherson
Hi Jim,

I've attached a patch here that does what you suggest, I created a
ModulesDidLoad() on both the Process and the JITLoader and use this now to
only search the new modules for necessary JIT symbols. This works great and
startup time does seem faster on programs with large shared libraries.

I didn't make ModulesDidLoad() on the Process virtual for now as there was
no need for it in this particular case but if you'd prefer I do it anyway
just let me know. I also left out SymbolsDidLoad() as I'd prefer to have a
use case that I can test with it and I don't right now, I will certainly
keep it in mind for later though.

This new patch also does away with the need for the patch I sent yesterday
as that code (and the crashing code you hit) has been replaced with this
new method. I'm not sure what the status of building the JITLoaderGDB on
OSX is right now, I haven't made any commits since the initial patch commit.

Thanks for the help!

Andrew



On Thu, Mar 6, 2014 at 7:10 PM, jing...@apple.com wrote:

 Andrew,

 I'll have to check out this patch when I get back home.  You very nicely
 turned off the JITLoaderGDB for MacOS X, but now that I've updated, that
 means I can't tell whether your patch fixes the crash :-(  I'm in the
 middle of something else so I don't want to have to mess with this right
 now, but my checkout at home is still in the state it was last night, so
 I'll check it out there.

 We don't currently have a pluggable mechanism for watching shared library
 loads, but there is a place where code belonging to Target  Process can
 observe these changes synchronously.  That place is Target::ModulesDidLoad.
  Currently it handles the breakpoint resetting, and some work that Jason
 needed to do for the SystemRuntime plugin.  Since your JITLoader is also
 internal to the process, it would be fine for you to hook in there and look
 for your symbol.  I don't thing we need to come up with some generic
 mechanism for this yet.

 However, when we had only one process thing doing a job in
 Target::ModulesDidLoad it was kinda okay to check for m_process_sp and do
 what is arguably process related work there:

 void
 Target::ModulesDidLoad (ModuleList module_list)
 {
 if (module_list.GetSize())
 {
 m_breakpoint_list.UpdateBreakpoints (module_list, true, false);
 if (m_process_sp)
 {
 SystemRuntime *sys_runtime = m_process_sp-GetSystemRuntime();
 if (sys_runtime)
 {
 sys_runtime-ModulesDidLoad (module_list);
 }
 }
 // TODO: make event data that packages up the module_list
 BroadcastEvent (eBroadcastBitModulesLoaded, NULL);
 }
 }

 but now that there are two process related jobs, we should break this out
 and make a Process::ModulesDidLoad and do the process related stuff there.
  If you don't mind splitting this off, then feel free to do so and put your
 symbol search there rather than in the stop hook.

 If the work you have to do is applicable to generic processes there's no
 reason to make Process::ModulesDidLoad virtual, but that might arguably be
 useful.  Since there is Process generic work that is done here as well (the
 SystemRuntime call) you'll have to deal with how partition the generic 
 overridable behaviors.

 We have two patterns for structuring a task that requires some generic
 work and some subclass, related work in lldb.  In some places we just
 document in the base class method that you have to call the base class
 method in your derived method.  Generally that's in code that aren't going
 to have a lot of folks touching it, so you can trust that whoever changes
 it will read the headers first.  In other places we have a non-virtual Task
 method, and a virtual DoTask method, then the Task method does the generic
 stuff and calls DoTask for the virtual part of the task.  The latter is
 cleaner though it adds another method to the internal API.  Anyway, if it
 makes sense to have this Process::ModulesDidLoad be virtual, feel free to
 do this either way...

 You might also want to hook into SymbolsDidLoad, which gets called when a
 symbol file gets added to a binary already loaded in the process.  That
 would catch the case where your symbol was stripped from the binary, but
 somebody added a symbol file that contained the symbol mid-way through the
 debug run.

 Jim

 On Mar 6, 2014, at 1:52 AM, Andrew MacPherson andrew.m...@gmail.com
 wrote:

  Hi Jim,
 
  I agree that this part of the patch isn't pretty but I wasn't able to
 find a way to be notified when a shared library is loaded (exactly as you
 suggest). We need to check on launch or attach and then whenever a new
 library is loaded, if there's a better way to do that it would be great to
 clean this up.
 
  I can't reproduce the crash on Linux but it looks like we need to
 unregister the notification callback that's set, that's the only reason I
 can think of that you would end up in the 

[Lldb-commits] [lldb] r203231 - The ThreadPlanCallFunction needs to pass its StopOthers to its run to address subplan.

2014-03-07 Thread Jim Ingham
Author: jingham
Date: Fri Mar  7 05:16:37 2014
New Revision: 203231

URL: http://llvm.org/viewvc/llvm-project?rev=203231view=rev
Log:
The ThreadPlanCallFunction needs to pass its StopOthers to its run to address 
subplan.

Modified:
lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h
lldb/trunk/source/Target/ThreadPlanCallFunction.cpp

Modified: lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h?rev=203231r1=203230r2=203231view=diff
==
--- lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h (original)
+++ lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h Fri Mar  7 05:16:37 
2014
@@ -125,7 +125,10 @@ public:
 m_takedown_done = true;
 }
 
-protected:
+virtual void
+SetStopOthers (bool new_value);
+
+protected:
 void ReportRegisterState (const char *message);
 
 virtual bool

Modified: lldb/trunk/source/Target/ThreadPlanCallFunction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanCallFunction.cpp?rev=203231r1=203230r2=203231view=diff
==
--- lldb/trunk/source/Target/ThreadPlanCallFunction.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanCallFunction.cpp Fri Mar  7 05:16:37 2014
@@ -536,6 +536,13 @@ ThreadPlanCallFunction::BreakpointsExpla
 return false;
 }
 
+void
+ThreadPlanCallFunction::SetStopOthers (bool new_value)
+{
+m_subplan_sp-SetStopOthers(new_value);
+}
+
+
 bool
 ThreadPlanCallFunction::RestoreThreadState()
 {


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r203253 - Fix test 'make clean' target for empty $(DSYM) on FreeBSD

2014-03-07 Thread Ed Maste
Author: emaste
Date: Fri Mar  7 11:20:50 2014
New Revision: 203253

URL: http://llvm.org/viewvc/llvm-project?rev=203253view=rev
Log:
Fix test 'make clean' target for empty $(DSYM) on FreeBSD

A freebsd issue with rm prevents '[g]make clean' from working if $(DSYM)
is empty (fts_open(3) fails if passed an empty argument).

To work around this, simplify the clean target by using three separate
rm invocations: one for the common files, one for the case of non-empty
$(DYLIB_NAME), and one for non-empty $(DSYM).

Issue diagnosed (and reported to FreeBSD) by John Wolfe.

llvm.org/pr17933

Modified:
lldb/trunk/test/functionalities/inferior-changed/TestInferiorChanged.py
lldb/trunk/test/make/Makefile.rules

Modified: 
lldb/trunk/test/functionalities/inferior-changed/TestInferiorChanged.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/inferior-changed/TestInferiorChanged.py?rev=203253r1=203252r2=203253view=diff
==
--- lldb/trunk/test/functionalities/inferior-changed/TestInferiorChanged.py 
(original)
+++ lldb/trunk/test/functionalities/inferior-changed/TestInferiorChanged.py Fri 
Mar  7 11:20:50 2014
@@ -21,7 +21,6 @@ class ChangedInferiorTestCase(TestBase):
 self.setTearDownCleanup(dictionary=d)
 self.inferior_not_crashing()
 
-@expectedFailureFreeBSD('llvm.org/pr17933')
 def test_inferior_crashing_dwarf(self):
 Test lldb reloads the inferior after it was changed during the 
session.
 self.buildDwarf()

Modified: lldb/trunk/test/make/Makefile.rules
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/make/Makefile.rules?rev=203253r1=203252r2=203253view=diff
==
--- lldb/trunk/test/make/Makefile.rules (original)
+++ lldb/trunk/test/make/Makefile.rules Fri Mar  7 11:20:50 2014
@@ -363,11 +363,14 @@ endif
 dsym:  $(DSYM)
 all:   $(EXE) $(DSYM)
 clean::
-ifeq $(DYLIB_NAME) 
-   rm -rf $(EXE) $(DSYM) $(OBJECTS) $(PREREQS) $(ARCHIVE_NAME) 
$(ARCHIVE_OBJECTS) *.d.[0-9] *.d.[0-9][0-9] *.d.[0-9][0-9][0-9] 
*.d.[0-9][0-9][0-9][0-9] *.d.[0-9][0-9][0-9][0-9][0-9]
-else
-   rm -rf $(EXE) $(DSYM) $(OBJECTS) $(PREREQS) $(ARCHIVE_NAME) 
$(ARCHIVE_OBJECTS) $(DYLIB_OBJECTS) $(DYLIB_PREREQS) $(DYLIB_FILENAME) 
$(DYLIB_FILENAME).dSYM $(DYLIB_FILENAME).debug *.d.[0-9] *.d.[0-9][0-9] 
*.d.[0-9][0-9][0-9] *.d.[0-9][0-9][0-9][0-9] *.d.[0-9][0-9][0-9][0-9][0-9]
+   rm -rf $(EXE) $(OBJECTS) $(PREREQS) $(ARCHIVE_NAME) 
$(ARCHIVE_OBJECTS) *.d.[0-9] *.d.[0-9][0-9] *.d.[0-9][0-9][0-9] 
*.d.[0-9][0-9][0-9][0-9] *.d.[0-9][0-9][0-9][0-9][0-9]
+ifneq $(DYLIB_NAME) 
+   rm -rf $(DYLIB_OBJECTS) $(DYLIB_PREREQS) $(DYLIB_FILENAME) 
$(DYLIB_FILENAME).dSYM $(DYLIB_FILENAME).debug
 endif
+ifneq $(DSYM) 
+   rm -rf $(DSYM)
+endif
+   
 
 #--
 # From http://blog.melski.net/tag/debugging-makefiles/


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r203253 - Fix test 'make clean' target for empty $(DSYM) on FreeBSD

2014-03-07 Thread Ed Maste
On 7 March 2014 13:01, Todd Fiala tfi...@google.com wrote:

 Ah I see, ok.

 It might be worth taking a pass at the makefiles at some point and converting 
 the direct rm usage to $(RM), but I wouldn't worry about it now.  Only if it 
 it would have fixed the issue on FreeBSD.

Ah, applying -r only to the cases that actually need to remove
directories would solve it too.  I gave 'rm -f file1  file2' as a
failing example but that does work; it's only w/ -r that an empty
argument caused a failure (now fixed in FreeBSD head).

Anyway, I'm here now so might as well fix up this instance.
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r203217 - Update for clang r203213

2014-03-07 Thread Ben Langmuir
Author: benlangmuir
Date: Fri Mar  7 02:31:36 2014
New Revision: 203217

URL: http://llvm.org/viewvc/llvm-project?rev=203217view=rev
Log:
Update for clang r203213

Modified:
lldb/trunk/source/Expression/ClangExpressionParser.cpp

Modified: lldb/trunk/source/Expression/ClangExpressionParser.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionParser.cpp?rev=203217r1=203216r2=203217view=diff
==
--- lldb/trunk/source/Expression/ClangExpressionParser.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionParser.cpp Fri Mar  7 02:31:36 
2014
@@ -337,7 +337,7 @@ ClangExpressionParser::ClangExpressionPa
 m_compiler-createSourceManager(*m_file_manager.get());
 
 m_compiler-createFileManager();
-m_compiler-createPreprocessor();
+m_compiler-createPreprocessor(TU_Complete);
 
 // 6. Most of this we get from the CompilerInstance, but we 
 // also want to give the context an ExternalASTSource.


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r203268 - Fix malloc thread step-out test on FreeBSD

2014-03-07 Thread Ed Maste
Author: emaste
Date: Fri Mar  7 13:02:20 2014
New Revision: 203268

URL: http://llvm.org/viewvc/llvm-project?rev=203268view=rev
Log:
Fix malloc thread step-out test on FreeBSD

After hitting the malloc() breakpoint on FreeBSD our top frame is actually
an inlined function malloc_init.

  * frame #0: 0x000800dcba19 libc.so.7`malloc [inlined] malloc_init at 
malloc.c:5397
frame #1: 0x000800dcba19 libc.so.7`malloc(size=1024) + 9 at 
malloc.c:5949
frame #2: 0x004006e5 
test_step_out_of_malloc_into_function_b_with_dwarf`b(val=1) + 37 at main2.cpp:29

Add a heuristic to keep stepping out until we come to a non-malloc caller,
before checking if it is our desired caller from the test code.

llvm.org/pr17944

Modified:
lldb/trunk/test/python_api/thread/TestThreadAPI.py

Modified: lldb/trunk/test/python_api/thread/TestThreadAPI.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/thread/TestThreadAPI.py?rev=203268r1=203267r2=203268view=diff
==
--- lldb/trunk/test/python_api/thread/TestThreadAPI.py (original)
+++ lldb/trunk/test/python_api/thread/TestThreadAPI.py Fri Mar  7 13:02:20 2014
@@ -74,7 +74,6 @@ class ThreadAPITestCase(TestBase):
 self.setTearDownCleanup(dictionary=d)
 self.step_out_of_malloc_into_function_b(self.exe_name)
 
-@expectedFailureFreeBSD('llvm.org/pr17944')
 @expectedFailureLinux # llvm.org/pr14416
 @python_api_test
 @dwarf_test
@@ -187,6 +186,15 @@ class ThreadAPITestCase(TestBase):
 #print caller symbol of malloc:, caller_symbol
 if not caller_symbol:
 self.fail(Test failed: could not locate the caller symbol of 
malloc)
+
+# Our top frame may be an inlined function in malloc() (e.g., on
+# FreeBSD).  Apply a simple heuristic of stepping out until we find
+# a non-malloc caller
+while caller_symbol.startswith(malloc):
+thread.StepOut()
+self.assertTrue(thread.IsValid(), Thread valid after stepping 
to outer malloc)
+caller_symbol = get_caller_symbol(thread)
+
 if caller_symbol == b(int):
 break
 #self.runCmd(thread backtrace)


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r203271 - Use predefined $(RM) in clean rule, and -r only for (expected) directories

2014-03-07 Thread Ed Maste
Author: emaste
Date: Fri Mar  7 13:11:00 2014
New Revision: 203271

URL: http://llvm.org/viewvc/llvm-project?rev=203271view=rev
Log:
Use predefined $(RM) in clean rule, and -r only for (expected) directories

Modified:
lldb/trunk/test/make/Makefile.rules

Modified: lldb/trunk/test/make/Makefile.rules
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/make/Makefile.rules?rev=203271r1=203270r2=203271view=diff
==
--- lldb/trunk/test/make/Makefile.rules (original)
+++ lldb/trunk/test/make/Makefile.rules Fri Mar  7 13:11:00 2014
@@ -363,12 +363,13 @@ endif
 dsym:  $(DSYM)
 all:   $(EXE) $(DSYM)
 clean::
-   rm -rf $(EXE) $(OBJECTS) $(PREREQS) $(ARCHIVE_NAME) 
$(ARCHIVE_OBJECTS) *.d.[0-9] *.d.[0-9][0-9] *.d.[0-9][0-9][0-9] 
*.d.[0-9][0-9][0-9][0-9] *.d.[0-9][0-9][0-9][0-9][0-9]
+   $(RM) $(EXE) $(OBJECTS) $(PREREQS) $(ARCHIVE_NAME) $(ARCHIVE_OBJECTS)
+   $(RM) -r *.d.[0-9] *.d.[0-9][0-9] *.d.[0-9][0-9][0-9] 
*.d.[0-9][0-9][0-9][0-9] *.d.[0-9][0-9][0-9][0-9][0-9]
 ifneq $(DYLIB_NAME) 
-   rm -rf $(DYLIB_OBJECTS) $(DYLIB_PREREQS) $(DYLIB_FILENAME) 
$(DYLIB_FILENAME).dSYM $(DYLIB_FILENAME).debug
+   $(RM) $(DYLIB_OBJECTS) $(DYLIB_PREREQS) $(DYLIB_FILENAME) 
$(DYLIB_FILENAME).dSYM $(DYLIB_FILENAME).debug
 endif
 ifneq $(DSYM) 
-   rm -rf $(DSYM)
+   $(RM) $(DSYM)
 endif

 


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r203274 - Verify we have a correct ELF or Mach core file before we return a valid instace of ProcessElfCore or ProcessMachCore respectively.

2014-03-07 Thread Greg Clayton
Author: gclayton
Date: Fri Mar  7 13:24:39 2014
New Revision: 203274

URL: http://llvm.org/viewvc/llvm-project?rev=203274view=rev
Log:
Verify we have a correct ELF or Mach core file before we return a valid instace 
of ProcessElfCore or ProcessMachCore respectively.


Modified:
lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp
lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp

Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h?rev=203274r1=203273r2=203274view=diff
==
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h (original)
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h Fri Mar  7 
13:24:39 2014
@@ -162,14 +162,13 @@ public:
 
 virtual uint32_t
 GetSDKVersion (uint32_t *versions, uint32_t num_versions);
-
-protected:
-
+
 static bool
 ParseHeader (lldb_private::DataExtractor data,
  lldb::offset_t *data_offset_ptr,
  llvm::MachO::mach_header header);
 
+protected:
 
 static bool
 GetUUID (const llvm::MachO::mach_header header,

Modified: lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp?rev=203274r1=203273r2=203274view=diff
==
--- lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp (original)
+++ lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp Fri Mar  7 
13:24:39 2014
@@ -19,6 +19,9 @@
 #include lldb/Core/DataBufferHeap.h
 #include lldb/Target/Target.h
 #include lldb/Target/DynamicLoader.h
+
+#include llvm/Support/ELF.h
+
 #include ProcessPOSIXLog.h
 
 #include Plugins/ObjectFile/ELF/ObjectFileELF.h
@@ -54,8 +57,24 @@ lldb::ProcessSP
 ProcessElfCore::CreateInstance (Target target, Listener listener, const 
FileSpec *crash_file)
 {
 lldb::ProcessSP process_sp;
-if (crash_file) 
-process_sp.reset(new ProcessElfCore (target, listener, *crash_file));
+if (crash_file)
+{
+// Read enough data for a ELF32 header or ELF64 header
+const size_t header_size = sizeof(llvm::ELF::Elf64_Ehdr);
+
+lldb::DataBufferSP data_sp (crash_file-ReadFileContents(0, 
header_size));
+if (data_sp-GetByteSize() == header_size)
+{
+elf::ELFHeader elf_header;
+DataExtractor data(data_sp, lldb::eByteOrderLittle, 4);
+lldb::offset_t data_offset = 0;
+if (elf_header.Parse(data, data_offset))
+{
+if (elf_header.e_type == llvm::ELF::ET_CORE)
+process_sp.reset(new ProcessElfCore (target, listener, 
*crash_file));
+}
+}
+}
 return process_sp;
 }
 

Modified: lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp?rev=203274r1=203273r2=203274view=diff
==
--- lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp (original)
+++ lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp Fri Mar  7 
13:24:39 2014
@@ -35,6 +35,7 @@
 // Needed for the plug-in names for the dynamic loaders.
 #include Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h
 #include Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h
+#include Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
 
 using namespace lldb;
 using namespace lldb_private;
@@ -64,7 +65,23 @@ ProcessMachCore::CreateInstance (Target
 {
 lldb::ProcessSP process_sp;
 if (crash_file)
-process_sp.reset(new ProcessMachCore (target, listener, *crash_file));
+{
+const size_t header_size = sizeof(llvm::MachO::mach_header);
+lldb::DataBufferSP data_sp (crash_file-ReadFileContents(0, 
header_size));
+if (data_sp-GetByteSize() == header_size)
+{
+DataExtractor data(data_sp, lldb::eByteOrderLittle, 4);
+
+lldb::offset_t data_offset = 0;
+llvm::MachO::mach_header mach_header;
+if (ObjectFileMachO::ParseHeader(data, data_offset, mach_header))
+{
+if (mach_header.filetype == llvm::MachO::MH_CORE)
+process_sp.reset(new ProcessMachCore (target, listener, 
*crash_file));
+}
+}
+
+}
 return process_sp;
 }
 


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r203107 - Fix Windows build break introduced in r203035.

2014-03-07 Thread Greg Clayton
The logging is just used in one spot in ProcessELFCore, I would switch the 
include from:

#include ProcessPOSIXLog.h

to:

#include lldb/lldb-private-log.h

And change the logging from:

Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_PROCESS));

to:

Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));


Let me know if this fixes your issues?

On Mar 6, 2014, at 9:00 PM, Ahmed Charles achar...@outlook.com wrote:

 Unfortunately, adding ProcessElfCore and JITLoaderGDB to the cmake build 
 isn't 'obvious', since ProcessElfCore replies on ProcessPOSIXLog.h, which is 
 in the ProcessPOSIX plugin, which is also not built on Windows. I don't know 
 if that plugin is supported on Windows, for remote debugging or not, so 
 adding it would be premature.
 
 Any advice would be appreciated.
 
 
 
 From: gclay...@apple.com
 Date: Thu, 6 Mar 2014 15:36:55 -0800
 To: ahmedchar...@gmail.com
 CC: lldb-commits@cs.uiuc.edu
 Subject: Re: [Lldb-commits] [lldb] r203107 - Fix Windows build break 
 introduced in r203035.
 
 JITLoader and ProcessELFCore should be able to build on any system so that 
 you can use this functionality to do remote debugging.
 
 I reverted your patch with:
 
 % svn commit
 Sending source/lldb.cpp
 Transmitting file data .
 Committed revision 203178.
 
 The real fix for Windows is to make sure it builds all that it needs to in 
 order to support ProcessElfCore and JITLoaderGDB. That probably means fixing 
 the Makefiles or CMakeList.txt files.
 
 On Mar 6, 2014, at 3:30 AM, Ahmed Charles ahmedchar...@gmail.com wrote:
 
 Author: ace2001ac
 Date: Thu Mar 6 05:30:34 2014
 New Revision: 203107
 
 URL: http://llvm.org/viewvc/llvm-project?rev=203107view=rev
 Log:
 Fix Windows build break introduced in r203035.
 
 Add '#if defined(__linux__) || defined(__FreeBSD__)' around JITLoaderGDB
 and ProcessElfCore, which are only built on Linux and FreeBSD.
 
 Modified:
 lldb/trunk/source/lldb.cpp
 
 Modified: lldb/trunk/source/lldb.cpp
 URL: 
 http://llvm.org/viewvc/llvm-project/lldb/trunk/source/lldb.cpp?rev=203107r1=203106r2=203107view=diff
 ==
 --- lldb/trunk/source/lldb.cpp (original)
 +++ lldb/trunk/source/lldb.cpp Thu Mar 6 05:30:34 2014
 @@ -124,8 +124,10 @@ lldb_private::Initialize ()
 ScriptInterpreterPython::InitializePrivate();
 OperatingSystemPython::Initialize();
 #endif
 +#if defined(__linux__) || defined(__FreeBSD__)
 JITLoaderGDB::Initialize();
 ProcessElfCore::Initialize();
 +#endif
 
 #if defined (__APPLE__)
 //--
 @@ -208,9 +210,11 @@ lldb_private::Terminate ()
 #ifndef LLDB_DISABLE_PYTHON
 OperatingSystemPython::Terminate();
 #endif
 +#if defined(__linux__) || defined(__FreeBSD__)
 JITLoaderGDB::Terminate();
 ProcessElfCore::Terminate();
 -
 +#endif
 +
 #if defined (__APPLE__)
 DynamicLoaderMacOSXDYLD::Terminate();
 DynamicLoaderDarwinKernel::Terminate();
 
 
 ___
 lldb-commits mailing list
 lldb-commits@cs.uiuc.edu
 http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
 
 ___
 lldb-commits mailing list
 lldb-commits@cs.uiuc.edu
 http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits   
   

___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r203292 - Remove unused code.

2014-03-07 Thread Greg Clayton
Author: gclayton
Date: Fri Mar  7 15:51:19 2014
New Revision: 203292

URL: http://llvm.org/viewvc/llvm-project?rev=203292view=rev
Log:
Remove unused code.


Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.h

Modified: 
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp?rev=203292r1=203291r2=203292view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp 
Fri Mar  7 15:51:19 2014
@@ -92,84 +92,6 @@ DWARFAbbreviationDeclaration::IsValid()
 }
 
 
-void
-DWARFAbbreviationDeclaration::CopyExcludingAddressAttributes(const 
DWARFAbbreviationDeclaration abbr_decl, const uint32_t idx)
-{
-m_code = abbr_decl.Code();  // Invalidate the code since that can't be 
copied safely.
-m_tag = abbr_decl.Tag();
-m_has_children = abbr_decl.HasChildren();
-
-const DWARFAttribute::collection attributes = abbr_decl.Attributes();
-const uint32_t num_abbr_decl_attributes = attributes.size();
-
-dw_attr_t attr;
-dw_form_t form;
-uint32_t i;
-
-for (i = 0; i  num_abbr_decl_attributes; ++i)
-{
-attributes[i].get(attr, form);
-switch (attr)
-{
-case DW_AT_location:
-case DW_AT_frame_base:
-// Only add these if they are location expressions (have a single
-// value) and not location lists (have a lists of location
-// expressions which are only valid over specific address ranges)
-if (DWARFFormValue::IsBlockForm(form))
-m_attributes.push_back(DWARFAttribute(attr, form));
-break;
-
-case DW_AT_low_pc:
-case DW_AT_high_pc:
-case DW_AT_ranges:
-case DW_AT_entry_pc:
-// Don't add these attributes
-if (i = idx)
-break;
-// Fall through and add attribute
-default:
-// Add anything that isn't address related
-m_attributes.push_back(DWARFAttribute(attr, form));
-break;
-}
-}
-}
-
-void
-DWARFAbbreviationDeclaration::CopyChangingStringToStrp(
-const DWARFAbbreviationDeclaration abbr_decl,
-const DWARFDataExtractor debug_info_data,
-dw_offset_t debug_info_offset,
-const DWARFCompileUnit* cu,
-const uint32_t strp_min_len
-)
-{
-m_code = InvalidCode;
-m_tag = abbr_decl.Tag();
-m_has_children = abbr_decl.HasChildren();
-
-const DWARFAttribute::collection attributes = abbr_decl.Attributes();
-const uint32_t num_abbr_decl_attributes = attributes.size();
-
-dw_attr_t attr;
-dw_form_t form;
-uint32_t i;
-lldb::offset_t offset = debug_info_offset;
-
-for (i = 0; i  num_abbr_decl_attributes; ++i)
-{
-attributes[i].get(attr, form);
-dw_offset_t attr_offset = offset;
-DWARFFormValue::SkipValue(form, debug_info_data, offset, cu);
-
-if (form == DW_FORM_string  ((offset - attr_offset) = strp_min_len))
-m_attributes.push_back(DWARFAttribute(attr, DW_FORM_strp));
-else
-m_attributes.push_back(DWARFAttribute(attr, form));
-}
-}
-
 
 uint32_t
 DWARFAbbreviationDeclaration::FindAttributeIndex(dw_attr_t attr) const
@@ -193,19 +115,3 @@ DWARFAbbreviationDeclaration::operator =
  Attributes() == rhs.Attributes();
 }
 
-#if 0
-DWARFAbbreviationDeclaration::Append(BinaryStreamBuf out_buff) const
-{
-out_buff.Append32_as_ULEB128(Code());
-out_buff.Append32_as_ULEB128(Tag());
-out_buff.Append8(HasChildren());
-const uint32_t kNumAttributes = m_attributes.size();
-for (uint32_t i = 0; i  kNumAttributes; ++i)
-{
-out_buff.Append32_as_ULEB128(m_attributes[i].attr());
-out_buff.Append32_as_ULEB128(m_attributes[i].form());
-}
-out_buff.Append8(0);// Output a zero for attr (faster than using 
Append32_as_ULEB128)
-out_buff.Append8(0);// Output a zero for attr (faster than using 
Append32_as_ULEB128)
-}
-#endif  // 0

Modified: 
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.h?rev=203292r1=203291r2=203292view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.h 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.h 
Fri Mar  7 15:51:19 2014
@@ -55,21 +55,12 @@ public:
 {
 return m_attributes[idx].get_form();
  

[Lldb-commits] [lldb] r203310 - Re-enable ProcessElfCore for non-FreeBSD/Linux builds; with Greg's fix in r203274

2014-03-07 Thread Jason Molenda
Author: jmolenda
Date: Fri Mar  7 17:23:10 2014
New Revision: 203310

URL: http://llvm.org/viewvc/llvm-project?rev=203310view=rev
Log:
Re-enable ProcessElfCore for non-FreeBSD/Linux builds; with Greg's fix in 
r203274 
this is not installing itself for Mach-O binaries.

Modified:
lldb/trunk/source/lldb.cpp

Modified: lldb/trunk/source/lldb.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/lldb.cpp?rev=203310r1=203309r2=203310view=diff
==
--- lldb/trunk/source/lldb.cpp (original)
+++ lldb/trunk/source/lldb.cpp Fri Mar  7 17:23:10 2014
@@ -125,9 +125,7 @@ lldb_private::Initialize ()
 OperatingSystemPython::Initialize();
 #endif
 JITLoaderGDB::Initialize();
-#if defined(__linux__) || defined(__FreeBSD__)
 ProcessElfCore::Initialize();
-#endif
 
 #if defined (__APPLE__)
 
//--
@@ -211,9 +209,7 @@ lldb_private::Terminate ()
 OperatingSystemPython::Terminate();
 #endif
 JITLoaderGDB::Terminate();
-#if defined(__linux__) || defined(__FreeBSD__)
 ProcessElfCore::Terminate();
-#endif
 
 #if defined (__APPLE__)
 DynamicLoaderMacOSXDYLD::Terminate();


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r203330 - Add API logging to the SBQueue/SBQueueItem/SBThread calls.

2014-03-07 Thread Jason Molenda
Author: jmolenda
Date: Fri Mar  7 19:34:55 2014
New Revision: 203330

URL: http://llvm.org/viewvc/llvm-project?rev=203330view=rev
Log:
Add API logging to the SBQueue/SBQueueItem/SBThread calls.

Modified:
lldb/trunk/source/API/SBQueue.cpp
lldb/trunk/source/API/SBQueueItem.cpp
lldb/trunk/source/API/SBThread.cpp

Modified: lldb/trunk/source/API/SBQueue.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBQueue.cpp?rev=203330r1=203329r2=203330view=diff
==
--- lldb/trunk/source/API/SBQueue.cpp (original)
+++ lldb/trunk/source/API/SBQueue.cpp Fri Mar  7 19:34:55 2014
@@ -301,13 +301,21 @@ SBQueue::~SBQueue()
 bool
 SBQueue::IsValid() const
 {
-return m_opaque_sp-IsValid();
+bool is_valid = m_opaque_sp-IsValid ();
+Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+if (log)
+log-Printf(SBQueue(0x% PRIx64 )::IsValid() == %s, 
m_opaque_sp-GetQueueID(),
+is_valid ? true : false);
+return is_valid;
 }
 
 
 void
 SBQueue::Clear ()
 {
+Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+if (log)
+log-Printf(SBQueue(0x% PRIx64 )::Clear(), 
m_opaque_sp-GetQueueID());
 m_opaque_sp-Clear();
 }
 
@@ -321,43 +329,71 @@ SBQueue::SetQueue (const QueueSP queue_
 lldb::queue_id_t
 SBQueue::GetQueueID () const
 {
-return m_opaque_sp-GetQueueID ();
+lldb::queue_id_t qid = m_opaque_sp-GetQueueID ();
+Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+if (log)
+log-Printf(SBQueue(0x% PRIx64 )::GetQueueID() == 0x% PRIx64, 
m_opaque_sp-GetQueueID(), (uint64_t) qid);
+return qid;
 }
 
 uint32_t
 SBQueue::GetIndexID () const
 {
-return m_opaque_sp-GetIndexID ();
+uint32_t index_id = m_opaque_sp-GetIndexID ();
+Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+if (log)
+log-Printf(SBQueue(0x% PRIx64 )::GetIndexID() == 0x% PRIx32, 
m_opaque_sp-GetQueueID(), index_id);
+return index_id;
 }
 
 const char *
 SBQueue::GetName () const
 {
-return m_opaque_sp-GetName ();
+const char *name = m_opaque_sp-GetName ();
+Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+if (log)
+log-Printf(SBQueue(0x% PRIx64 )::GetName() == %s, 
m_opaque_sp-GetQueueID(), 
+ name ? name : );
+return name;
 }
 
 uint32_t
 SBQueue::GetNumThreads ()
 {
-return m_opaque_sp-GetNumThreads ();
+uint32_t numthreads = m_opaque_sp-GetNumThreads ();
+Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+if (log)
+log-Printf(SBQueue(0x% PRIx64 )::GetNumThreads() == %d, 
m_opaque_sp-GetQueueID(), numthreads);
+return numthreads;
 }
 
 SBThread
 SBQueue::GetThreadAtIndex (uint32_t idx)
 {
-return m_opaque_sp-GetThreadAtIndex (idx);
+SBThread th = m_opaque_sp-GetThreadAtIndex (idx);
+Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+if (log)
+log-Printf(SBQueue(0x% PRIx64 )::GetThreadAtIndex(%d), 
m_opaque_sp-GetQueueID(), idx);
+return th;
 }
 
 
 uint32_t
 SBQueue::GetNumPendingItems ()
 {
-return m_opaque_sp-GetNumPendingItems ();
+uint32_t pending_items = m_opaque_sp-GetNumPendingItems ();
+Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+if (log)
+log-Printf(SBQueue(0x% PRIx64 )::GetNumPendingItems() == %d, 
m_opaque_sp-GetQueueID(), pending_items);
+return pending_items;
 }
 
 SBQueueItem
 SBQueue::GetPendingItemAtIndex (uint32_t idx)
 {
+Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+if (log)
+log-Printf(SBQueue(0x% PRIx64 )::GetPendingItemAtIndex(%d), 
m_opaque_sp-GetQueueID(),  idx);
 return m_opaque_sp-GetPendingItemAtIndex (idx);
 }
 

Modified: lldb/trunk/source/API/SBQueueItem.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBQueueItem.cpp?rev=203330r1=203329r2=203330view=diff
==
--- lldb/trunk/source/API/SBQueueItem.cpp (original)
+++ lldb/trunk/source/API/SBQueueItem.cpp Fri Mar  7 19:34:55 2014
@@ -14,6 +14,7 @@
 #include lldb/API/SBQueueItem.h
 #include lldb/API/SBThread.h
 #include lldb/Core/Address.h
+#include lldb/Core/Log.h
 #include lldb/Target/Process.h
 #include lldb/Target/QueueItem.h
 #include lldb/Target/Thread.h
@@ -45,13 +46,20 @@ SBQueueItem::~SBQueueItem()
 bool
 SBQueueItem::IsValid() const
 {
-return m_queue_item_sp.get() != NULL;
+bool is_valid = m_queue_item_sp.get() != NULL;
+Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+if (log)
+log-Printf(SBQueueItem(%p)::IsValid() == %s, m_queue_item_sp.get(), 
is_valid ? true : false);
+return is_valid;
 }
 
 
 void
 SBQueueItem::Clear ()
 {
+Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+if