<div dir="ltr">Hello Vince,<div><br></div><div>Sorry for broken build and thanks for roll back (I was unable to do it myself).</div><div><br></div><div>Thanks,</div><div>Ilia</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, May 16, 2015 at 12:47 AM, Vince Harron <span dir="ltr"><<a href="mailto:vince@nethacker.com" target="_blank">vince@nethacker.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Ilia,<div><br></div><div>I've reverted this change.  r237479</div><div><br></div><div>Sincerely,</div><div><br></div><div>Vince</div><div><br></div><div><br></div><div><div><br></div></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 15, 2015 at 2:17 PM, Vince Harron <span dir="ltr"><<a href="mailto:vince@nethacker.com" target="_blank">vince@nethacker.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Illia,<div><br></div><div>This appears to have broken both OSX and Linux builders.</div><div><br></div><div><a href="http://lab.llvm.org:8011/builders/lldb-x86_64-darwin-13.4/builds/2941" target="_blank">http://lab.llvm.org:8011/builders/lldb-x86_64-darwin-13.4/builds/2941</a><br></div><div><a href="http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-cmake/builds/2421" target="_blank">http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-cmake/builds/2421</a><br></div><div><br></div><div><div style="font-size:12.8000001907349px">Is it a quick fix?</div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">If not, can you roll back?</div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">Thanks,</div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">Vince</div></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 15, 2015 at 11:16 AM, Ilia K <span dir="ltr"><<a href="mailto:ki.stfu@gmail.com" target="_blank">ki.stfu@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: ki.stfu<br>
Date: Fri May 15 13:16:15 2015<br>
New Revision: 237460<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=237460&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=237460&view=rev</a><br>
Log:<br>
Add --move-to-nearest-code / target.move-to-nearest-code options<br>
<br>
Summary:<br>
This option forces to only set a source line breakpoint when there is an exact-match<br>
<br>
This patch includes the following commits:<br>
# Add the -m/--exact-match option in "breakpoint set" command<br>
## Add exact_match arg in BreakpointResolverFileLine ctor<br>
## Add m_exact_match field in BreakpointResolverFileLine<br>
## Add exact_match arg in BreakpointResolverFileRegex ctor<br>
## Add m_exact_match field in BreakpointResolverFileRegex<br>
## Add exact_match arg in Target::CreateSourceRegexBreakpoint<br>
## Add exact_match arg in Target::CreateBreakpoint<br>
## Add -m/--exact-match option in "breakpoint set" command<br>
# Add target.exact-match option to skip BP if source line doesn't match<br>
## Add target.exact-match global option<br>
## Add Target::GetExactMatch<br>
## Refactor Target::CreateSourceRegexBreakpoint to accept LazyBool exact_match (was bool)<br>
## Refactor Target::CreateBreakpoint to accept LazyBool exact_match (was bool)<br>
# Add target.exact-match test in SettingsCommandTestCase<br>
# Add BreakpointOptionsTestCase tests to test --skip-prologue/--exact-match options<br>
# Fix a few typos in lldbutil.check_breakpoint_result func<br>
# Rename --exact-match/m_exact_match/exact_match/GetExactMatch to --move-to-nearest-code/m_move_to_nearest_code/move_to_nearest_code/GetMoveToNearestCode<br>
# Add exact_match field in BreakpointResolverFileLine::GetDescription and BreakpointResolverFileRegex::GetDescription, for example:<br>
was:<br>
```<br>
1: file = '/Users/IliaK/p/llvm/tools/lldb/test/functionalities/breakpoint/breakpoint_command/main.c', line = 12, locations = 1, resolved = 1, hit count = 2<br>
  1.1: where = a.out`main + 20 at main.c:12, address = 0x0000000100000eb4, resolved, hit count = 2<br>
```<br>
now:<br>
```<br>
1: file = '/Users/IliaK/p/llvm/tools/lldb/test/functionalities/breakpoint/breakpoint_command/main.c', line = 12, exact_match = 0, locations = 1, resolved = 1, hit count = 2<br>
  1.1: where = a.out`main + 20 at main.c:12, address = 0x0000000100000eb4, resolved, hit count = 2<br>
```<br>
<br>
Test Plan:<br>
./dotest.py -v --executable $BUILDDIR/bin/lldb functionalities/breakpoint/<br>
./dotest.py -v --executable $BUILDDIR/bin/lldb settings/<br>
./dotest.py -v --executable $BUILDDIR/bin/lldb tools/lldb-mi/breakpoint/<br>
<br>
Reviewers: jingham, clayborg<br>
<br>
Reviewed By: clayborg<br>
<br>
Subscribers: lldb-commits, clayborg, jingham<br>
<br>
Differential Revision: <a href="http://reviews.llvm.org/D9273" target="_blank">http://reviews.llvm.org/D9273</a><br>
<br>
Added:<br>
    lldb/trunk/test/functionalities/breakpoint/breakpoint_options/<br>
    lldb/trunk/test/functionalities/breakpoint/breakpoint_options/Makefile<br>
    lldb/trunk/test/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py<br>
    lldb/trunk/test/functionalities/breakpoint/breakpoint_options/main.c<br>
Modified:<br>
    lldb/trunk/include/lldb/Breakpoint/BreakpointResolverFileLine.h<br>
    lldb/trunk/include/lldb/Breakpoint/BreakpointResolverFileRegex.h<br>
    lldb/trunk/include/lldb/Target/Target.h<br>
    lldb/trunk/source/API/SBTarget.cpp<br>
    lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp<br>
    lldb/trunk/source/Breakpoint/BreakpointResolverFileRegex.cpp<br>
    lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp<br>
    lldb/trunk/source/Core/IOHandler.cpp<br>
    lldb/trunk/source/Target/Target.cpp<br>
    lldb/trunk/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py<br>
    lldb/trunk/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py<br>
    lldb/trunk/test/functionalities/breakpoint/dummy_target_breakpoints/TestBreakpointsWithNoTargets.py<br>
    lldb/trunk/test/lldbutil.py<br>
    lldb/trunk/test/settings/TestSettings.py<br>
    lldb/trunk/test/tools/lldb-mi/breakpoint/TestMiBreak.py<br>
    lldb/trunk/test/tools/lldb-mi/breakpoint/main.cpp<br>
<br>
Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointResolverFileLine.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointResolverFileLine.h?rev=237460&r1=237459&r2=237460&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointResolverFileLine.h?rev=237460&r1=237459&r2=237460&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/include/lldb/Breakpoint/BreakpointResolverFileLine.h (original)<br>
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointResolverFileLine.h Fri May 15 13:16:15 2015<br>
@@ -32,7 +32,8 @@ public:<br>
                                 const FileSpec &resolver,<br>
                                 uint32_t line_no,<br>
                                 bool check_inlines,<br>
-                                bool skip_prologue);<br>
+                                bool skip_prologue,<br>
+                                bool exact_match);<br>
<br>
     virtual<br>
     ~BreakpointResolverFileLine ();<br>
@@ -67,6 +68,7 @@ protected:<br>
     uint32_t m_line_number; // This is the line number that we are looking for.<br>
     bool m_inlines; // This determines whether the resolver looks for inlined functions or not.<br>
     bool m_skip_prologue;<br>
+    bool m_exact_match;<br>
<br>
 private:<br>
     DISALLOW_COPY_AND_ASSIGN(BreakpointResolverFileLine);<br>
<br>
Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointResolverFileRegex.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointResolverFileRegex.h?rev=237460&r1=237459&r2=237460&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointResolverFileRegex.h?rev=237460&r1=237459&r2=237460&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/include/lldb/Breakpoint/BreakpointResolverFileRegex.h (original)<br>
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointResolverFileRegex.h Fri May 15 13:16:15 2015<br>
@@ -29,7 +29,8 @@ class BreakpointResolverFileRegex :<br>
 {<br>
 public:<br>
     BreakpointResolverFileRegex (Breakpoint *bkpt,<br>
-                                RegularExpression &regex);<br>
+                                 RegularExpression &regex,<br>
+                                 bool exact_match);<br>
<br>
     virtual<br>
     ~BreakpointResolverFileRegex ();<br>
@@ -61,6 +62,7 @@ public:<br>
 protected:<br>
     friend class Breakpoint;<br>
     RegularExpression m_regex; // This is the line expression that we are looking for.<br>
+    bool m_exact_match;<br>
<br>
 private:<br>
     DISALLOW_COPY_AND_ASSIGN(BreakpointResolverFileRegex);<br>
<br>
Modified: lldb/trunk/include/lldb/Target/Target.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=237460&r1=237459&r2=237460&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=237460&r1=237459&r2=237460&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/include/lldb/Target/Target.h (original)<br>
+++ lldb/trunk/include/lldb/Target/Target.h Fri May 15 13:16:15 2015<br>
@@ -64,6 +64,9 @@ public:<br>
     void<br>
     SetDefaultArchitecture (const ArchSpec& arch);<br>
<br>
+    bool<br>
+    GetMoveToNearestCode () const;<br>
+<br>
     lldb::DynamicValueType<br>
     GetPreferDynamicValue() const;<br>
<br>
@@ -698,7 +701,8 @@ public:<br>
                       LazyBool check_inlines,<br>
                       LazyBool skip_prologue,<br>
                       bool internal,<br>
-                      bool request_hardware);<br>
+                      bool request_hardware,<br>
+                      LazyBool move_to_nearest_code);<br>
<br>
     // Use this to create breakpoint that matches regex against the source lines in files given in source_file_list:<br>
     lldb::BreakpointSP<br>
@@ -706,7 +710,8 @@ public:<br>
                                  const FileSpecList *source_file_list,<br>
                                  RegularExpression &source_regex,<br>
                                  bool internal,<br>
-                                 bool request_hardware);<br>
+                                 bool request_hardware,<br>
+                                 LazyBool move_to_nearest_code);<br>
<br>
     // Use this to create a breakpoint from a load address<br>
     lldb::BreakpointSP<br>
<br>
Modified: lldb/trunk/source/API/SBTarget.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=237460&r1=237459&r2=237460&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=237460&r1=237459&r2=237460&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/API/SBTarget.cpp (original)<br>
+++ lldb/trunk/source/API/SBTarget.cpp Fri May 15 13:16:15 2015<br>
@@ -808,7 +808,8 @@ SBTarget::BreakpointCreateByLocation (co<br>
         const LazyBool skip_prologue = eLazyBoolCalculate;<br>
         const bool internal = false;<br>
         const bool hardware = false;<br>
-        *sb_bp = target_sp->CreateBreakpoint (NULL, *sb_file_spec, line, check_inlines, skip_prologue, internal, hardware);<br>
+        const LazyBool move_to_nearest_code = eLazyBoolCalculate;<br>
+        *sb_bp = target_sp->CreateBreakpoint (NULL, *sb_file_spec, line, check_inlines, skip_prologue, internal, hardware, move_to_nearest_code);<br>
     }<br>
<br>
     if (log)<br>
@@ -1055,6 +1056,7 @@ SBTarget::BreakpointCreateBySourceRegex<br>
         RegularExpression regexp(source_regex);<br>
         FileSpecList source_file_spec_list;<br>
         const bool hardware = false;<br>
+        const LazyBool move_to_nearest_code = eLazyBoolCalculate;<br>
         source_file_spec_list.Append (source_file.ref());<br>
<br>
         if (module_name && module_name[0])<br>
@@ -1062,11 +1064,11 @@ SBTarget::BreakpointCreateBySourceRegex<br>
             FileSpecList module_spec_list;<br>
             module_spec_list.Append (FileSpec (module_name, false));<br>
<br>
-            *sb_bp = target_sp->CreateSourceRegexBreakpoint (&module_spec_list, &source_file_spec_list, regexp, false, hardware);<br>
+            *sb_bp = target_sp->CreateSourceRegexBreakpoint (&module_spec_list, &source_file_spec_list, regexp, false, hardware, move_to_nearest_code);<br>
         }<br>
         else<br>
         {<br>
-            *sb_bp = target_sp->CreateSourceRegexBreakpoint (NULL, &source_file_spec_list, regexp, false, hardware);<br>
+            *sb_bp = target_sp->CreateSourceRegexBreakpoint (NULL, &source_file_spec_list, regexp, false, hardware, move_to_nearest_code);<br>
         }<br>
     }<br>
<br>
@@ -1095,8 +1097,9 @@ SBTarget::BreakpointCreateBySourceRegex<br>
     {<br>
         Mutex::Locker api_locker (target_sp->GetAPIMutex());<br>
         const bool hardware = false;<br>
+        const LazyBool move_to_nearest_code = eLazyBoolCalculate;<br>
         RegularExpression regexp(source_regex);<br>
-        *sb_bp = target_sp->CreateSourceRegexBreakpoint (module_list.get(), source_file_list.get(), regexp, false, hardware);<br>
+        *sb_bp = target_sp->CreateSourceRegexBreakpoint (module_list.get(), source_file_list.get(), regexp, false, hardware, move_to_nearest_code);<br>
     }<br>
<br>
     if (log)<br>
<br>
Modified: lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp?rev=237460&r1=237459&r2=237460&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp?rev=237460&r1=237459&r2=237460&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp (original)<br>
+++ lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp Fri May 15 13:16:15 2015<br>
@@ -32,13 +32,15 @@ BreakpointResolverFileLine::BreakpointRe<br>
     const FileSpec &file_spec,<br>
     uint32_t line_no,<br>
     bool check_inlines,<br>
-    bool skip_prologue<br>
+    bool skip_prologue,<br>
+    bool exact_match<br>
 ) :<br>
     BreakpointResolver (bkpt, BreakpointResolver::FileLineResolver),<br>
     m_file_spec (file_spec),<br>
     m_line_number (line_no),<br>
     m_inlines (check_inlines),<br>
-    m_skip_prologue(skip_prologue)<br>
+    m_skip_prologue(skip_prologue),<br>
+    m_exact_match(exact_match)<br>
 {<br>
 }<br>
<br>
@@ -78,7 +80,7 @@ BreakpointResolverFileLine::SearchCallba<br>
         if (cu_sp)<br>
         {<br>
             if (filter.CompUnitPasses(*cu_sp))<br>
-                cu_sp->ResolveSymbolContext (m_file_spec, m_line_number, m_inlines, false, eSymbolContextEverything, sc_list);<br>
+                cu_sp->ResolveSymbolContext (m_file_spec, m_line_number, m_inlines, m_exact_match, eSymbolContextEverything, sc_list);<br>
         }<br>
     }<br>
     StreamString s;<br>
@@ -100,7 +102,7 @@ BreakpointResolverFileLine::GetDepth()<br>
 void<br>
 BreakpointResolverFileLine::GetDescription (Stream *s)<br>
 {<br>
-    s->Printf ("file = '%s', line = %u", m_file_spec.GetPath().c_str(), m_line_number);<br>
+    s->Printf ("file = '%s', line = %u, exact_match = %d", m_file_spec.GetPath().c_str(), m_line_number, m_exact_match);<br>
 }<br>
<br>
 void<br>
@@ -116,7 +118,8 @@ BreakpointResolverFileLine::CopyForBreak<br>
                                                                      m_file_spec,<br>
                                                                      m_line_number,<br>
                                                                      m_inlines,<br>
-                                                                     m_skip_prologue));<br>
+                                                                     m_skip_prologue,<br>
+                                                                     m_exact_match));<br>
<br>
     return ret_sp;<br>
 }<br>
<br>
Modified: lldb/trunk/source/Breakpoint/BreakpointResolverFileRegex.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolverFileRegex.cpp?rev=237460&r1=237459&r2=237460&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolverFileRegex.cpp?rev=237460&r1=237459&r2=237460&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Breakpoint/BreakpointResolverFileRegex.cpp (original)<br>
+++ lldb/trunk/source/Breakpoint/BreakpointResolverFileRegex.cpp Fri May 15 13:16:15 2015<br>
@@ -29,10 +29,12 @@ using namespace lldb_private;<br>
 BreakpointResolverFileRegex::BreakpointResolverFileRegex<br>
 (<br>
     Breakpoint *bkpt,<br>
-    RegularExpression &regex<br>
+    RegularExpression &regex,<br>
+    bool exact_match<br>
 ) :<br>
     BreakpointResolver (bkpt, BreakpointResolver::FileLineResolver),<br>
-    m_regex (regex)<br>
+    m_regex (regex),<br>
+    m_exact_match (exact_match)<br>
 {<br>
 }<br>
<br>
@@ -64,9 +66,8 @@ BreakpointResolverFileRegex::SearchCallb<br>
     {<br>
         SymbolContextList sc_list;<br>
         const bool search_inlines = false;<br>
-        const bool exact = false;<br>
<br>
-        cu->ResolveSymbolContext (cu_file_spec, line_matches[i], search_inlines, exact, eSymbolContextEverything, sc_list);<br>
+        cu->ResolveSymbolContext (cu_file_spec, line_matches[i], search_inlines, m_exact_match, eSymbolContextEverything, sc_list);<br>
         const bool skip_prologue = true;<br>
<br>
         BreakpointResolver::SetSCMatchesByLine (filter, sc_list, skip_prologue, m_regex.GetText());<br>
@@ -85,7 +86,7 @@ BreakpointResolverFileRegex::GetDepth()<br>
 void<br>
 BreakpointResolverFileRegex::GetDescription (Stream *s)<br>
 {<br>
-    s->Printf ("source regex = \"%s\"", m_regex.GetText());<br>
+    s->Printf ("source regex = \"%s\", exact_match = %d", m_regex.GetText(), m_exact_match);<br>
 }<br>
<br>
 void<br>
@@ -97,7 +98,7 @@ BreakpointResolverFileRegex::Dump (Strea<br>
 lldb::BreakpointResolverSP<br>
 BreakpointResolverFileRegex::CopyForBreakpoint (Breakpoint &breakpoint)<br>
 {<br>
-    lldb::BreakpointResolverSP ret_sp(new BreakpointResolverFileRegex(&breakpoint, m_regex));<br>
+    lldb::BreakpointResolverSP ret_sp(new BreakpointResolverFileRegex(&breakpoint, m_regex, m_exact_match));<br>
     return ret_sp;<br>
 }<br>
<br>
<br>
Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp?rev=237460&r1=237459&r2=237460&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp?rev=237460&r1=237459&r2=237460&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp (original)<br>
+++ lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp Fri May 15 13:16:15 2015<br>
@@ -115,7 +115,8 @@ public:<br>
             m_exception_language (eLanguageTypeUnknown),<br>
             m_skip_prologue (eLazyBoolCalculate),<br>
             m_one_shot (false),<br>
-            m_all_files (false)<br>
+            m_all_files (false),<br>
+            m_move_to_nearest_code (eLazyBoolCalculate)<br>
         {<br>
         }<br>
<br>
@@ -249,6 +250,22 @@ public:<br>
                         error.SetErrorStringWithFormat ("invalid line number: %s.", option_arg);<br>
                     break;<br>
                 }<br>
+<br>
+                case 'm':<br>
+                {<br>
+                    bool success;<br>
+                    bool value;<br>
+                    value = Args::StringToBoolean (option_arg, true, &success);<br>
+                    if (value)<br>
+                        m_move_to_nearest_code = eLazyBoolYes;<br>
+                    else<br>
+                        m_move_to_nearest_code = eLazyBoolNo;<br>
+<br>
+                    if (!success)<br>
+                        error.SetErrorStringWithFormat ("Invalid boolean value for move-to-nearest-code option: '%s'", option_arg);<br>
+                    break;<br>
+                }<br>
+<br>
                 case 'M':<br>
                     m_func_names.push_back (option_arg);<br>
                     m_func_name_type_mask |= eFunctionNameTypeMethod;<br>
@@ -361,6 +378,7 @@ public:<br>
             m_breakpoint_names.clear();<br>
             m_all_files = false;<br>
             m_exception_extra_args.Clear();<br>
+            m_move_to_nearest_code = eLazyBoolCalculate;<br>
         }<br>
<br>
         const OptionDefinition*<br>
@@ -400,6 +418,7 @@ public:<br>
         bool m_use_dummy;<br>
         bool m_all_files;<br>
         Args m_exception_extra_args;<br>
+        LazyBool m_move_to_nearest_code;<br>
<br>
     };<br>
<br>
@@ -477,7 +496,8 @@ protected:<br>
                                                    check_inlines,<br>
                                                    m_options.m_skip_prologue,<br>
                                                    internal,<br>
-                                                   m_options.m_hardware).get();<br>
+                                                   m_options.m_hardware,<br>
+                                                   m_options.m_move_to_nearest_code).get();<br>
                 }<br>
                 break;<br>
<br>
@@ -558,7 +578,8 @@ protected:<br>
                                                               &(m_options.m_filenames),<br>
                                                               regexp,<br>
                                                               internal,<br>
-                                                              m_options.m_hardware).get();<br>
+                                                              m_options.m_hardware,<br>
+                                                              m_options.m_move_to_nearest_code).get();<br>
                 }<br>
                 break;<br>
             case eSetTypeException:<br>
@@ -689,6 +710,7 @@ private:<br>
 #define LLDB_OPT_FILE ( LLDB_OPT_SET_FROM_TO(1, 9) & ~LLDB_OPT_SET_2 )<br>
 #define LLDB_OPT_NOT_10 ( LLDB_OPT_SET_FROM_TO(1, 10) & ~LLDB_OPT_SET_10 )<br>
 #define LLDB_OPT_SKIP_PROLOGUE ( LLDB_OPT_SET_1 | LLDB_OPT_SET_FROM_TO(3,8) )<br>
+#define LLDB_OPT_MOVE_TO_NEAREST_CODE ( LLDB_OPT_SET_1 | LLDB_OPT_SET_9 )<br>
<br>
 OptionDefinition<br>
 CommandObjectBreakpointSet::CommandOptions::g_option_table[] =<br>
@@ -789,6 +811,9 @@ CommandObjectBreakpointSet::CommandOptio<br>
     { LLDB_OPT_SET_ALL, false, "breakpoint-name", 'N', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBreakpointName,<br>
         "Adds this to the list of names for this breakopint."},<br>
<br>
+    { LLDB_OPT_MOVE_TO_NEAREST_CODE, false, "move-to-nearest-code", 'm', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean,<br>
+        "Move breakpoints to nearest code. If not set the target.move-to-nearest-code setting is used." },<br>
+<br>
     { 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }<br>
 };<br>
<br>
<br>
Modified: lldb/trunk/source/Core/IOHandler.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/IOHandler.cpp?rev=237460&r1=237459&r2=237460&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/IOHandler.cpp?rev=237460&r1=237459&r2=237460&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Core/IOHandler.cpp (original)<br>
+++ lldb/trunk/source/Core/IOHandler.cpp Fri May 15 13:16:15 2015<br>
@@ -5326,7 +5326,8 @@ public:<br>
                                                                                       eLazyBoolCalculate,        // Check inlines using global setting<br>
                                                                                       eLazyBoolCalculate,        // Skip prologue using global setting,<br>
                                                                                       false,                     // internal<br>
-                                                                                      false);                    // request_hardware<br>
+                                                                                      false,                     // request_hardware<br>
+                                                                                      eLazyBoolCalculate);       // move_to_nearest_code<br>
                         // Make breakpoint one shot<br>
                         bp_sp->GetOptions()->SetOneShot(true);<br>
                         exe_ctx.GetProcessRef().Resume();<br>
@@ -5361,7 +5362,8 @@ public:<br>
                                                                                       eLazyBoolCalculate,        // Check inlines using global setting<br>
                                                                                       eLazyBoolCalculate,        // Skip prologue using global setting,<br>
                                                                                       false,                     // internal<br>
-                                                                                      false);                    // request_hardware<br>
+                                                                                      false,                     // request_hardware<br>
+                                                                                      eLazyBoolCalculate);       // move_to_nearest_code<br>
                     }<br>
                 }<br>
                 else if (m_selected_line < GetNumDisassemblyLines())<br>
<br>
Modified: lldb/trunk/source/Target/Target.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=237460&r1=237459&r2=237460&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=237460&r1=237459&r2=237460&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Target/Target.cpp (original)<br>
+++ lldb/trunk/source/Target/Target.cpp Fri May 15 13:16:15 2015<br>
@@ -273,10 +273,13 @@ Target::CreateSourceRegexBreakpoint (con<br>
                                      const FileSpecList *source_file_spec_list,<br>
                                      RegularExpression &source_regex,<br>
                                      bool internal,<br>
-                                     bool hardware)<br>
+                                     bool hardware,<br>
+                                     LazyBool move_to_nearest_code)<br>
 {<br>
     SearchFilterSP filter_sp(GetSearchFilterForModuleAndCUList (containingModules, source_file_spec_list));<br>
-    BreakpointResolverSP resolver_sp(new BreakpointResolverFileRegex (NULL, source_regex));<br>
+    if (move_to_nearest_code == eLazyBoolCalculate)<br>
+        move_to_nearest_code = GetMoveToNearestCode() ? eLazyBoolYes : eLazyBoolNo;<br>
+    BreakpointResolverSP resolver_sp(new BreakpointResolverFileRegex (NULL, source_regex, !static_cast<bool>(move_to_nearest_code)));<br>
     return CreateBreakpoint (filter_sp, resolver_sp, internal, hardware, true);<br>
 }<br>
<br>
@@ -288,7 +291,8 @@ Target::CreateBreakpoint (const FileSpec<br>
                           LazyBool check_inlines,<br>
                           LazyBool skip_prologue,<br>
                           bool internal,<br>
-                          bool hardware)<br>
+                          bool hardware,<br>
+                          LazyBool move_to_nearest_code)<br>
 {<br>
     if (check_inlines == eLazyBoolCalculate)<br>
     {<br>
@@ -325,12 +329,15 @@ Target::CreateBreakpoint (const FileSpec<br>
     }<br>
     if (skip_prologue == eLazyBoolCalculate)<br>
         skip_prologue = GetSkipPrologue() ? eLazyBoolYes : eLazyBoolNo;<br>
+    if (move_to_nearest_code == eLazyBoolCalculate)<br>
+        move_to_nearest_code = GetMoveToNearestCode() ? eLazyBoolYes : eLazyBoolNo;<br>
<br>
     BreakpointResolverSP resolver_sp(new BreakpointResolverFileLine (NULL,<br>
                                                                      file,<br>
                                                                      line_no,<br>
                                                                      check_inlines,<br>
-                                                                     skip_prologue));<br>
+                                                                     skip_prologue,<br>
+                                                                     !static_cast<bool>(move_to_nearest_code)));<br>
     return CreateBreakpoint (filter_sp, resolver_sp, internal, hardware, true);<br>
 }<br>
<br>
@@ -2928,6 +2935,7 @@ static PropertyDefinition<br>
 g_properties[] =<br>
 {<br>
     { "default-arch"                       , OptionValue::eTypeArch      , true , 0                         , NULL, NULL, "Default architecture to choose, when there's a choice." },<br>
+    { "move-to-nearest-code"               , OptionValue::eTypeBoolean   , false, true                      , NULL, NULL, "Move breakpoints to nearest code." },<br>
     { "expr-prefix"                        , OptionValue::eTypeFileSpec  , false, 0                         , NULL, NULL, "Path to a file containing expressions to be prepended to all expressions." },<br>
     { "prefer-dynamic-value"               , OptionValue::eTypeEnum      , false, eDynamicDontRunTarget     , NULL, g_dynamic_value_types, "Should printed values be shown as their dynamic value." },<br>
     { "enable-synthetic-value"             , OptionValue::eTypeBoolean   , false, true                      , NULL, NULL, "Should synthetic values be used by default whenever available." },<br>
@@ -2985,6 +2993,7 @@ g_properties[] =<br>
 enum<br>
 {<br>
     ePropertyDefaultArch,<br>
+    ePropertyMoveToNearestCode,<br>
     ePropertyExprPrefix,<br>
     ePropertyPreferDynamic,<br>
     ePropertyEnableSynthetic,<br>
@@ -3193,6 +3202,13 @@ TargetProperties::SetDefaultArchitecture<br>
         return value->SetCurrentValue(arch, true);<br>
 }<br>
<br>
+bool<br>
+TargetProperties::GetMoveToNearestCode() const<br>
+{<br>
+    const uint32_t idx = ePropertyMoveToNearestCode;<br>
+    return m_collection_sp->GetPropertyAtIndexAsBoolean (NULL, idx, g_properties[idx].default_uint_value != 0);<br>
+}<br>
+<br>
 lldb::DynamicValueType<br>
 TargetProperties::GetPreferDynamicValue() const<br>
 {<br>
<br>
Modified: lldb/trunk/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py?rev=237460&r1=237459&r2=237460&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py?rev=237460&r1=237459&r2=237460&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py (original)<br>
+++ lldb/trunk/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py Fri May 15 13:16:15 2015<br>
@@ -64,12 +64,12 @@ class BreakpointCommandTestCase(TestBase<br>
<br>
         # The breakpoint list now only contains breakpoint 1.<br>
         self.expect("breakpoint list", "Breakpoints 1 & 2 created",<br>
-            substrs = ["2: file = 'main.c', line = %d, locations = 1" % self.line],<br>
-            patterns = ["1: file = '.*main.c', line = %d, locations = 1" % self.line] )<br>
+            substrs = ["2: file = 'main.c', line = %d, exact_match = 0, locations = 1" % self.line],<br>
+            patterns = ["1: file = '.*main.c', line = %d, exact_match = 0, locations = 1" % self.line] )<br>
<br>
         self.expect("breakpoint list -f", "Breakpoints 1 & 2 created",<br>
-            substrs = ["2: file = 'main.c', line = %d, locations = 1" % self.line],<br>
-            patterns = ["1: file = '.*main.c', line = %d, locations = 1" % self.line,<br>
+            substrs = ["2: file = 'main.c', line = %d, exact_match = 0, locations = 1" % self.line],<br>
+            patterns = ["1: file = '.*main.c', line = %d, exact_match = 0, locations = 1" % self.line,<br>
                         "1.1: .+at main.c:%d, .+unresolved, hit count = 0" % self.line,<br>
                         "2.1: .+at main.c:%d, .+unresolved, hit count = 0" % self.line])<br>
<br>
@@ -151,13 +151,13 @@ class BreakpointCommandTestCase(TestBase<br>
<br>
         # The breakpoint list now only contains breakpoint 1.<br>
         self.expect("breakpoint list -f", "Breakpoint 1 exists",<br>
-            patterns = ["1: file = '.*main.c', line = %d, locations = 1, resolved = 1" %<br>
+            patterns = ["1: file = '.*main.c', line = %d, exact_match = 0, locations = 1, resolved = 1" %<br>
                         self.line,<br>
                        "hit count = 1"])<br>
<br>
         # Not breakpoint 2.<br>
         self.expect("breakpoint list -f", "No more breakpoint 2", matching=False,<br>
-            substrs = ["2: file = 'main.c', line = %d, locations = 1, resolved = 1" %<br>
+            substrs = ["2: file = 'main.c', line = %d, exact_match = 0, locations = 1, resolved = 1" %<br>
                         self.line])<br>
<br>
         # Run the program again, with breakpoint 1 remaining.<br>
<br>
Modified: lldb/trunk/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py?rev=237460&r1=237459&r2=237460&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py?rev=237460&r1=237459&r2=237460&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py (original)<br>
+++ lldb/trunk/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py Fri May 15 13:16:15 2015<br>
@@ -41,7 +41,7 @@ class BreakpointLocationsTestCase(TestBa<br>
<br>
         # The breakpoint list should show 3 locations.<br>
         self.expect("breakpoint list -f", "Breakpoint locations shown correctly",<br>
-            substrs = ["1: file = 'main.c', line = %d, locations = 3" % self.line],<br>
+            substrs = ["1: file = 'main.c', line = %d, exact_match = 0, locations = 3" % self.line],<br>
             patterns = ["where = a.out`func_inlined .+unresolved, hit count = 0",<br>
                         "where = a.out`main .+\[inlined\].+unresolved, hit count = 0"])<br>
<br>
<br>
Added: lldb/trunk/test/functionalities/breakpoint/breakpoint_options/Makefile<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/breakpoint/breakpoint_options/Makefile?rev=237460&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/breakpoint/breakpoint_options/Makefile?rev=237460&view=auto</a><br>
==============================================================================<br>
--- lldb/trunk/test/functionalities/breakpoint/breakpoint_options/Makefile (added)<br>
+++ lldb/trunk/test/functionalities/breakpoint/breakpoint_options/Makefile Fri May 15 13:16:15 2015<br>
@@ -0,0 +1,5 @@<br>
+LEVEL = ../../../make<br>
+<br>
+C_SOURCES := main.c<br>
+<br>
+include $(LEVEL)/Makefile.rules<br>
<br>
Added: lldb/trunk/test/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py?rev=237460&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py?rev=237460&view=auto</a><br>
==============================================================================<br>
--- lldb/trunk/test/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py (added)<br>
+++ lldb/trunk/test/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py Fri May 15 13:16:15 2015<br>
@@ -0,0 +1,77 @@<br>
+"""<br>
+Test breakpoint command for different options.<br>
+"""<br>
+<br>
+import os<br>
+import unittest2<br>
+import lldb<br>
+from lldbtest import *<br>
+import lldbutil<br>
+<br>
+class BreakpointOptionsTestCase(TestBase):<br>
+<br>
+    mydir = TestBase.compute_mydir(__file__)<br>
+<br>
+    @skipUnlessDarwin<br>
+    @dsym_test<br>
+    def test_with_dsym(self):<br>
+        """Test breakpoint command for different options."""<br>
+        self.buildDsym()<br>
+        self.breakpoint_options_test()<br>
+<br>
+    @dwarf_test<br>
+    def test_with_dwarf(self):<br>
+        """Test breakpoint command for different options."""<br>
+        self.buildDwarf()<br>
+        self.breakpoint_options_test()<br>
+<br>
+    def setUp(self):<br>
+        # Call super's setUp().<br>
+        TestBase.setUp(self)<br>
+        # Find the line number to break inside main().<br>
+        self.line = line_number('main.c', '// Set break point at this line.')<br>
+<br>
+    def breakpoint_options_test(self):<br>
+        """Test breakpoint command for different options."""<br>
+        exe = os.path.join(os.getcwd(), "a.out")<br>
+        self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)<br>
+<br>
+        # This should create a breakpoint with 1 locations.<br>
+        lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, extra_options = "-K 1", num_expected_locations = 1)<br>
+        lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, extra_options = "-K 0", num_expected_locations = 1)<br>
+<br>
+        # This should create a breakpoint 0 locations.<br>
+        lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, extra_options = "-m 0", num_expected_locations = 0)<br>
+<br>
+        # Run the program.<br>
+        self.runCmd("run", RUN_SUCCEEDED)<br>
+<br>
+        # Stopped once.<br>
+        self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,<br>
+            substrs = ["stop reason = breakpoint 2."])<br>
+<br>
+        # Check the list of breakpoint.<br>
+        self.expect("breakpoint list -f", "Breakpoint locations shown correctly",<br>
+            substrs = ["1: file = 'main.c', line = %d, exact_match = 0, locations = 1" % self.line,<br>
+                       "2: file = 'main.c', line = %d, exact_match = 0, locations = 1" % self.line,<br>
+                       "3: file = 'main.c', line = %d, exact_match = 1, locations = 0" % self.line])<br>
+<br>
+        # Continue the program, there should be another stop.<br>
+        self.runCmd("process continue")<br>
+<br>
+        # Stopped again.<br>
+        self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,<br>
+            substrs = ["stop reason = breakpoint 1."])<br>
+<br>
+        # Continue the program, we should exit.<br>
+        self.runCmd("process continue")<br>
+<br>
+        # We should exit.<br>
+        self.expect("process status", "Process exited successfully",<br>
+            patterns = ["^Process [0-9]+ exited with status = 0"])<br>
+<br>
+if __name__ == '__main__':<br>
+    import atexit<br>
+    lldb.SBDebugger.Initialize()<br>
+    atexit.register(lambda: lldb.SBDebugger.Terminate())<br>
+    unittest2.main()<br>
<br>
Added: lldb/trunk/test/functionalities/breakpoint/breakpoint_options/main.c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/breakpoint/breakpoint_options/main.c?rev=237460&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/breakpoint/breakpoint_options/main.c?rev=237460&view=auto</a><br>
==============================================================================<br>
--- lldb/trunk/test/functionalities/breakpoint/breakpoint_options/main.c (added)<br>
+++ lldb/trunk/test/functionalities/breakpoint/breakpoint_options/main.c Fri May 15 13:16:15 2015<br>
@@ -0,0 +1,7 @@<br>
+// Set break point at this line.<br>
+<br>
+int<br>
+main (int argc, char **argv)<br>
+{<br>
+  return 0;<br>
+}<br>
<br>
Modified: lldb/trunk/test/functionalities/breakpoint/dummy_target_breakpoints/TestBreakpointsWithNoTargets.py<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/breakpoint/dummy_target_breakpoints/TestBreakpointsWithNoTargets.py?rev=237460&r1=237459&r2=237460&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/breakpoint/dummy_target_breakpoints/TestBreakpointsWithNoTargets.py?rev=237460&r1=237459&r2=237460&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/test/functionalities/breakpoint/dummy_target_breakpoints/TestBreakpointsWithNoTargets.py (original)<br>
+++ lldb/trunk/test/functionalities/breakpoint/dummy_target_breakpoints/TestBreakpointsWithNoTargets.py Fri May 15 13:16:15 2015<br>
@@ -54,8 +54,8 @@ class BreakpointInDummyTarget (TestBase)<br>
<br>
         # The breakpoint list should show 3 locations.<br>
         self.expect("breakpoint list -f", "Breakpoint locations shown correctly",<br>
-            substrs = ["1: file = 'main.c', line = %d, locations = 1" % self.line,<br>
-                       "2: file = 'main.c', line = %d, locations = 1" % self.line2])<br>
+            substrs = ["1: file = 'main.c', line = %d, exact_match = 0, locations = 1" % self.line,<br>
+                       "2: file = 'main.c', line = %d, exact_match = 0, locations = 1" % self.line2])<br>
<br>
         # Run the program.<br>
         self.runCmd("run", RUN_SUCCEEDED)<br>
<br>
Modified: lldb/trunk/test/lldbutil.py<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbutil.py?rev=237460&r1=237459&r2=237460&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbutil.py?rev=237460&r1=237459&r2=237460&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/test/lldbutil.py (original)<br>
+++ lldb/trunk/test/lldbutil.py Fri May 15 13:16:15 2015<br>
@@ -466,7 +466,7 @@ def check_breakpoint_result (test, break<br>
         test.assertTrue (file_name == out_file_name, "Breakpoint file name '%s' doesn't match resultant name '%s'."%(file_name, out_file_name))<br>
<br>
     if line_number != -1:<br>
-        out_file_line = -1<br>
+        out_line_number = -1<br>
         if 'line_no' in break_results:<br>
             out_line_number = break_results['line_no']<br>
<br>
@@ -486,7 +486,7 @@ def check_breakpoint_result (test, break<br>
             test.assertTrue(out_symbol_name.find(symbol_name) != -1, "Symbol name '%s' isn't in resultant symbol '%s'."%(symbol_name, out_symbol_name))<br>
<br>
     if module_name:<br>
-        out_nodule_name = None<br>
+        out_module_name = None<br>
         if 'module' in break_results:<br>
             out_module_name = break_results['module']<br>
<br>
<br>
Modified: lldb/trunk/test/settings/TestSettings.py<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/test/settings/TestSettings.py?rev=237460&r1=237459&r2=237460&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/test/settings/TestSettings.py?rev=237460&r1=237459&r2=237460&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/test/settings/TestSettings.py (original)<br>
+++ lldb/trunk/test/settings/TestSettings.py Fri May 15 13:16:15 2015<br>
@@ -450,6 +450,7 @@ class SettingsCommandTestCase(TestBase):<br>
                                  "thread-format",<br>
                                  "use-external-editor",<br>
                                  "target.default-arch",<br>
+                                 "target.move-to-nearest-code",<br>
                                  "target.expr-prefix",<br>
                                  "target.prefer-dynamic-value",<br>
                                  "target.enable-synthetic-value",<br>
<br>
Modified: lldb/trunk/test/tools/lldb-mi/breakpoint/TestMiBreak.py<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/breakpoint/TestMiBreak.py?rev=237460&r1=237459&r2=237460&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/breakpoint/TestMiBreak.py?rev=237460&r1=237459&r2=237460&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/test/tools/lldb-mi/breakpoint/TestMiBreak.py (original)<br>
+++ lldb/trunk/test/tools/lldb-mi/breakpoint/TestMiBreak.py Fri May 15 13:16:15 2015<br>
@@ -159,5 +159,52 @@ class MiBreakTestCase(lldbmi_testcase.Mi<br>
         self.expect("\^running")<br>
         self.expect("\*stopped,reason=\"breakpoint-hit\"")<br>
<br>
+    @lldbmi_test<br>
+    @expectedFailureWindows("<a href="http://llvm.org/pr22274" target="_blank">llvm.org/pr22274</a>: need a pexpect replacement for windows")<br>
+    @skipIfFreeBSD # <a href="http://llvm.org/pr22411" target="_blank">llvm.org/pr22411</a>: Failure presumably due to known thread races<br>
+    def test_lldbmi_break_insert_settings(self):<br>
+        """Test that 'lldb-mi --interpreter' can set breakpoints accoridng to global options."""<br>
+<br>
+        self.spawnLldbMi(args = None)<br>
+<br>
+        # Load executable<br>
+        self.runCmd("-file-exec-and-symbols %s" % self.myexe)<br>
+        self.expect("\^done")<br>
+<br>
+        # Set target.move-to-nearest-code=off and try to set BP #1 that shouldn't be hit<br>
+        self.runCmd("-interpreter-exec console \"settings set target.move-to-nearest-code off\"")<br>
+        self.expect("\^done")<br>
+        line = line_number('main.cpp', '// BP_before_main')<br>
+        self.runCmd("-break-insert -f main.cpp:%d" % line)<br>
+        self.expect("\^done,bkpt={number=\"1\"")<br>
+<br>
+        # Set target.move-to-nearest-code=on and target.skip-prologue=on and set BP #2<br>
+        self.runCmd("-interpreter-exec console \"settings set target.move-to-nearest-code on\"")<br>
+        self.runCmd("-interpreter-exec console \"settings set target.skip-prologue on\"")<br>
+        self.expect("\^done")<br>
+        self.runCmd("-break-insert main.cpp:%d" % line)<br>
+        self.expect("\^done,bkpt={number=\"2\"")<br>
+<br>
+        # Set target.skip-prologue=off and set BP #3<br>
+        self.runCmd("-interpreter-exec console \"settings set target.skip-prologue off\"")<br>
+        self.expect("\^done")<br>
+        self.runCmd("-break-insert main.cpp:%d" % line)<br>
+        self.expect("\^done,bkpt={number=\"3\"")<br>
+<br>
+        # Test that BP #3 is located before BP #2<br>
+        self.runCmd("-exec-run")<br>
+        self.expect("\^running")<br>
+        self.expect("\*stopped,reason=\"breakpoint-hit\",disp=\"del\",bkptno=\"3\"")<br>
+<br>
+        # Test that BP #2 is hit<br>
+        self.runCmd("-exec-continue")<br>
+        self.expect("\^running")<br>
+        self.expect("\*stopped,reason=\"breakpoint-hit\",disp=\"del\",bkptno=\"2\"")<br>
+<br>
+        # Test that BP #1 wasn't set<br>
+        self.runCmd("-exec-continue")<br>
+        self.expect("\^running")<br>
+        self.expect("\*stopped,reason=\"exited-normally\"")<br>
+<br>
 if __name__ == '__main__':<br>
     unittest2.main()<br>
<br>
Modified: lldb/trunk/test/tools/lldb-mi/breakpoint/main.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/breakpoint/main.cpp?rev=237460&r1=237459&r2=237460&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/breakpoint/main.cpp?rev=237460&r1=237459&r2=237460&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/test/tools/lldb-mi/breakpoint/main.cpp (original)<br>
+++ lldb/trunk/test/tools/lldb-mi/breakpoint/main.cpp Fri May 15 13:16:15 2015<br>
@@ -9,6 +9,8 @@<br>
<br>
 #include <cstdio><br>
<br>
+// BP_before_main<br>
+<br>
 int<br>
 main(int argc, char const *argv[])<br>
 {<br>
<br>
<br>
_______________________________________________<br>
lldb-commits mailing list<br>
<a href="mailto:lldb-commits@cs.uiuc.edu" target="_blank">lldb-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits</a><br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>