JDevlieghere created this revision. JDevlieghere added a reviewer: jingham. Herald added subscribers: teemperor, abidh. Herald added a project: LLDB.
We were incorrectly parsing the `-C` argument to `breakpoint set` as the column breakpoint, even though according to the help this should be the breakpoint command. This fixes that by renaming the option to `-u`, adding it to help, and adding a test case. Repository: rLLDB LLDB https://reviews.llvm.org/D73284 Files: lldb/include/lldb/lldb-enumerations.h lldb/source/Commands/CommandObjectBreakpoint.cpp lldb/source/Commands/Options.td lldb/source/Interpreter/CommandObject.cpp lldb/test/Shell/Commands/command-breakpoint-col.test Index: lldb/test/Shell/Commands/command-breakpoint-col.test =================================================================== --- /dev/null +++ lldb/test/Shell/Commands/command-breakpoint-col.test @@ -0,0 +1,5 @@ +# RUN: %clang_host -g -O0 %S/Inputs/main.c -o %t.out +# RUN: %lldb -b -o 'help breakpoint set' -o 'breakpoint set -f main.c -l 2 -u 21' %t.out | FileCheck %s +# CHECK: -u <colnum> ( --column <colnum> ) +# CHECK-NEXT: Specifies the column number on which to set this breakpoint. +# CHECK: at main.c:2:21 Index: lldb/source/Interpreter/CommandObject.cpp =================================================================== --- lldb/source/Interpreter/CommandObject.cpp +++ lldb/source/Interpreter/CommandObject.cpp @@ -1105,7 +1105,8 @@ { eArgTypeWatchpointIDRange, "watchpt-id-list", CommandCompletions::eNoCompletion, { nullptr, false }, "For example, '1-3' or '1 to 3'." }, { eArgTypeWatchType, "watch-type", CommandCompletions::eNoCompletion, { nullptr, false }, "Specify the type for a watchpoint." }, { eArgRawInput, "raw-input", CommandCompletions::eNoCompletion, { nullptr, false }, "Free-form text passed to a command without prior interpretation, allowing spaces without requiring quotes. To pass arguments and free form text put two dashes ' -- ' between the last argument and any raw input." }, - { eArgTypeCommand, "command", CommandCompletions::eNoCompletion, { nullptr, false }, "An LLDB Command line command." } + { eArgTypeCommand, "command", CommandCompletions::eNoCompletion, { nullptr, false }, "An LLDB Command line command." }, + { eArgTypeColumnNum, "column", CommandCompletions::eNoCompletion, { nullptr, false }, "Column number in a source file." } // clang-format on }; Index: lldb/source/Commands/Options.td =================================================================== --- lldb/source/Commands/Options.td +++ lldb/source/Commands/Options.td @@ -115,6 +115,8 @@ def breakpoint_set_line : Option<"line", "l">, Group<1>, Arg<"LineNum">, Required, Desc<"Specifies the line number on which to set this breakpoint.">; + def breakpoint_set_column : Option<"column", "u">, Group<1>, Arg<"ColumnNum">, + Desc<"Specifies the column number on which to set this breakpoint.">; def breakpoint_set_address : Option<"address", "a">, Group<2>, Arg<"AddressOrExpression">, Required, Desc<"Set the breakpoint at the specified address. If the address maps " Index: lldb/source/Commands/CommandObjectBreakpoint.cpp =================================================================== --- lldb/source/Commands/CommandObjectBreakpoint.cpp +++ lldb/source/Commands/CommandObjectBreakpoint.cpp @@ -274,7 +274,7 @@ m_func_name_type_mask |= eFunctionNameTypeBase; break; - case 'C': + case 'u': if (option_arg.getAsInteger(0, m_column)) error.SetErrorStringWithFormat("invalid column number: %s", option_arg.str().c_str()); Index: lldb/include/lldb/lldb-enumerations.h =================================================================== --- lldb/include/lldb/lldb-enumerations.h +++ lldb/include/lldb/lldb-enumerations.h @@ -590,6 +590,7 @@ eArgTypeWatchType, eArgRawInput, eArgTypeCommand, + eArgTypeColumnNum, eArgTypeLastArg // Always keep this entry as the last entry in this // enumeration!! };
Index: lldb/test/Shell/Commands/command-breakpoint-col.test =================================================================== --- /dev/null +++ lldb/test/Shell/Commands/command-breakpoint-col.test @@ -0,0 +1,5 @@ +# RUN: %clang_host -g -O0 %S/Inputs/main.c -o %t.out +# RUN: %lldb -b -o 'help breakpoint set' -o 'breakpoint set -f main.c -l 2 -u 21' %t.out | FileCheck %s +# CHECK: -u <colnum> ( --column <colnum> ) +# CHECK-NEXT: Specifies the column number on which to set this breakpoint. +# CHECK: at main.c:2:21 Index: lldb/source/Interpreter/CommandObject.cpp =================================================================== --- lldb/source/Interpreter/CommandObject.cpp +++ lldb/source/Interpreter/CommandObject.cpp @@ -1105,7 +1105,8 @@ { eArgTypeWatchpointIDRange, "watchpt-id-list", CommandCompletions::eNoCompletion, { nullptr, false }, "For example, '1-3' or '1 to 3'." }, { eArgTypeWatchType, "watch-type", CommandCompletions::eNoCompletion, { nullptr, false }, "Specify the type for a watchpoint." }, { eArgRawInput, "raw-input", CommandCompletions::eNoCompletion, { nullptr, false }, "Free-form text passed to a command without prior interpretation, allowing spaces without requiring quotes. To pass arguments and free form text put two dashes ' -- ' between the last argument and any raw input." }, - { eArgTypeCommand, "command", CommandCompletions::eNoCompletion, { nullptr, false }, "An LLDB Command line command." } + { eArgTypeCommand, "command", CommandCompletions::eNoCompletion, { nullptr, false }, "An LLDB Command line command." }, + { eArgTypeColumnNum, "column", CommandCompletions::eNoCompletion, { nullptr, false }, "Column number in a source file." } // clang-format on }; Index: lldb/source/Commands/Options.td =================================================================== --- lldb/source/Commands/Options.td +++ lldb/source/Commands/Options.td @@ -115,6 +115,8 @@ def breakpoint_set_line : Option<"line", "l">, Group<1>, Arg<"LineNum">, Required, Desc<"Specifies the line number on which to set this breakpoint.">; + def breakpoint_set_column : Option<"column", "u">, Group<1>, Arg<"ColumnNum">, + Desc<"Specifies the column number on which to set this breakpoint.">; def breakpoint_set_address : Option<"address", "a">, Group<2>, Arg<"AddressOrExpression">, Required, Desc<"Set the breakpoint at the specified address. If the address maps " Index: lldb/source/Commands/CommandObjectBreakpoint.cpp =================================================================== --- lldb/source/Commands/CommandObjectBreakpoint.cpp +++ lldb/source/Commands/CommandObjectBreakpoint.cpp @@ -274,7 +274,7 @@ m_func_name_type_mask |= eFunctionNameTypeBase; break; - case 'C': + case 'u': if (option_arg.getAsInteger(0, m_column)) error.SetErrorStringWithFormat("invalid column number: %s", option_arg.str().c_str()); Index: lldb/include/lldb/lldb-enumerations.h =================================================================== --- lldb/include/lldb/lldb-enumerations.h +++ lldb/include/lldb/lldb-enumerations.h @@ -590,6 +590,7 @@ eArgTypeWatchType, eArgRawInput, eArgTypeCommand, + eArgTypeColumnNum, eArgTypeLastArg // Always keep this entry as the last entry in this // enumeration!! };
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits