This revision was automatically updated to reflect the committed changes.
Closed by commit rL254753: Fix breakpoint language filtering for other C 
variants (like C99) and Pascal. (authored by dperchik).

Changed prior to commit:
  http://reviews.llvm.org/D15175?vs=41713&id=41902#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D15175

Files:
  lldb/trunk/include/lldb/Target/LanguageRuntime.h
  lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp
  lldb/trunk/source/Target/LanguageRuntime.cpp

Index: lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp
===================================================================
--- lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp
+++ lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp
@@ -279,8 +279,9 @@
                 const char *name = 
sc.GetFunctionName(Mangled::ePreferMangled).AsCString();
                 if (name)
                 {
-                    LanguageType sym_language = 
LanguageRuntime::GetLanguageForSymbolByName(target, name);
-                    if (m_language == eLanguageTypeC)
+                    LanguageType sym_language = 
LanguageRuntime::GuessLanguageForSymbolByName(target, name);
+                    if (Language::LanguageIsC(m_language) ||
+                        Language::LanguageIsPascal(m_language))
                     {
                         // We don't currently have a way to say "This symbol 
name is C" so for now, C means
                         // not ObjC and not C++, etc...
@@ -293,6 +294,12 @@
                     }
                     else if (sym_language != m_language)
                     {
+                        // Note: This code prevents us from being able to find 
symbols
+                        // like 'printf' if the target language's option is 
set.  It
+                        // would be better to limit this filtering to only 
when the
+                        // breakpoint's language option is set (and not the 
target's),
+                        // but we can't know if m_language was set from the 
target or
+                        // breakpoint option.
                         remove_it = true;
                     }
                 }
Index: lldb/trunk/source/Target/LanguageRuntime.cpp
===================================================================
--- lldb/trunk/source/Target/LanguageRuntime.cpp
+++ lldb/trunk/source/Target/LanguageRuntime.cpp
@@ -347,15 +347,20 @@
 }
 
 lldb::LanguageType
-LanguageRuntime::GetLanguageForSymbolByName (Target &target, const char 
*symbol_name)
+LanguageRuntime::GuessLanguageForSymbolByName (Target &target, const char 
*symbol_name)
 {
-    // This is not the right way to do this.  Different targets could have 
different ways of mangling names
-    // from a given language.  So we should ask the various LanguageRuntime 
plugin instances for this target
-    // to recognize the name.  But right now the plugin instances depend on 
the process, not the target.
-    // That is unfortunate, because I want to use this for filtering 
breakpoints by language, and so I need to know
-    // the "language for symbol-name" prior to running.  So we'd have to make 
a "LanguageRuntimeTarget" and
-    // "LanguageRuntimeProcess", and direct the questions that don't need a 
running process to the former, and that
-    // do to the latter.
+    // We "guess" the language because we can't determine a symbol's language 
from it's name.
+    // For example, a Pascal symbol can be mangled using the C++ Itanium 
scheme, and defined
+    // in a compilation unit within the same module as other C++ units.
+    //
+    // In addition, different targets could have different ways of mangling 
names from a given
+    // language, likewise compilation units within those targets.  It would 
help to be able to
+    // ask the various LanguageRuntime plugin instances for this target to 
recognize the name,
+    // but right now the plugin instances depend on the process, not the 
target.  That is
+    // unfortunate, because to use this for filtering breakpoints by language, 
we need to know
+    // the "language for symbol-name" prior to running.  So we'd have to make a
+    // "LanguageRuntimeTarget" and "LanguageRuntimeProcess", and direct the 
questions that don't
+    // need a running process to the former, and that do to the latter.
     //
     // That's more work than I want to do for this feature.
     if (CPlusPlusLanguage::IsCPPMangledName (symbol_name))
Index: lldb/trunk/include/lldb/Target/LanguageRuntime.h
===================================================================
--- lldb/trunk/include/lldb/Target/LanguageRuntime.h
+++ lldb/trunk/include/lldb/Target/LanguageRuntime.h
@@ -118,7 +118,7 @@
     }
     
     static lldb::LanguageType
-    GetLanguageForSymbolByName (Target &target, const char *symbol_name);
+    GuessLanguageForSymbolByName (Target &target, const char *symbol_name);
     
     Target&
     GetTargetRef()


Index: lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp
===================================================================
--- lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp
+++ lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp
@@ -279,8 +279,9 @@
                 const char *name = sc.GetFunctionName(Mangled::ePreferMangled).AsCString();
                 if (name)
                 {
-                    LanguageType sym_language = LanguageRuntime::GetLanguageForSymbolByName(target, name);
-                    if (m_language == eLanguageTypeC)
+                    LanguageType sym_language = LanguageRuntime::GuessLanguageForSymbolByName(target, name);
+                    if (Language::LanguageIsC(m_language) ||
+                        Language::LanguageIsPascal(m_language))
                     {
                         // We don't currently have a way to say "This symbol name is C" so for now, C means
                         // not ObjC and not C++, etc...
@@ -293,6 +294,12 @@
                     }
                     else if (sym_language != m_language)
                     {
+                        // Note: This code prevents us from being able to find symbols
+                        // like 'printf' if the target language's option is set.  It
+                        // would be better to limit this filtering to only when the
+                        // breakpoint's language option is set (and not the target's),
+                        // but we can't know if m_language was set from the target or
+                        // breakpoint option.
                         remove_it = true;
                     }
                 }
Index: lldb/trunk/source/Target/LanguageRuntime.cpp
===================================================================
--- lldb/trunk/source/Target/LanguageRuntime.cpp
+++ lldb/trunk/source/Target/LanguageRuntime.cpp
@@ -347,15 +347,20 @@
 }
 
 lldb::LanguageType
-LanguageRuntime::GetLanguageForSymbolByName (Target &target, const char *symbol_name)
+LanguageRuntime::GuessLanguageForSymbolByName (Target &target, const char *symbol_name)
 {
-    // This is not the right way to do this.  Different targets could have different ways of mangling names
-    // from a given language.  So we should ask the various LanguageRuntime plugin instances for this target
-    // to recognize the name.  But right now the plugin instances depend on the process, not the target.
-    // That is unfortunate, because I want to use this for filtering breakpoints by language, and so I need to know
-    // the "language for symbol-name" prior to running.  So we'd have to make a "LanguageRuntimeTarget" and
-    // "LanguageRuntimeProcess", and direct the questions that don't need a running process to the former, and that
-    // do to the latter.
+    // We "guess" the language because we can't determine a symbol's language from it's name.
+    // For example, a Pascal symbol can be mangled using the C++ Itanium scheme, and defined
+    // in a compilation unit within the same module as other C++ units.
+    //
+    // In addition, different targets could have different ways of mangling names from a given
+    // language, likewise compilation units within those targets.  It would help to be able to
+    // ask the various LanguageRuntime plugin instances for this target to recognize the name,
+    // but right now the plugin instances depend on the process, not the target.  That is
+    // unfortunate, because to use this for filtering breakpoints by language, we need to know
+    // the "language for symbol-name" prior to running.  So we'd have to make a
+    // "LanguageRuntimeTarget" and "LanguageRuntimeProcess", and direct the questions that don't
+    // need a running process to the former, and that do to the latter.
     //
     // That's more work than I want to do for this feature.
     if (CPlusPlusLanguage::IsCPPMangledName (symbol_name))
Index: lldb/trunk/include/lldb/Target/LanguageRuntime.h
===================================================================
--- lldb/trunk/include/lldb/Target/LanguageRuntime.h
+++ lldb/trunk/include/lldb/Target/LanguageRuntime.h
@@ -118,7 +118,7 @@
     }
     
     static lldb::LanguageType
-    GetLanguageForSymbolByName (Target &target, const char *symbol_name);
+    GuessLanguageForSymbolByName (Target &target, const char *symbol_name);
     
     Target&
     GetTargetRef()
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to