Skip to content

Commit 44e27c4

Browse files
committed
fixup! remove current_module logic
1 parent fbc32ba commit 44e27c4

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

lldb/source/Commands/CommandObjectTarget.cpp

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3946,46 +3946,46 @@ class CommandObjectTargetModulesLookup : public CommandObjectParsed {
39463946

39473947
Options *GetOptions() override { return &m_options; }
39483948

3949-
ModuleSP LookupHere(CommandInterpreter &interpreter,
3950-
CommandReturnObject &result, bool &syntax_error) {
3949+
bool LookupHere(CommandInterpreter &interpreter, CommandReturnObject &result,
3950+
bool &syntax_error) {
39513951
switch (m_options.m_type) {
39523952
case eLookupTypeAddress:
39533953
case eLookupTypeFileLine:
39543954
case eLookupTypeFunction:
39553955
case eLookupTypeFunctionOrSymbol:
39563956
case eLookupTypeSymbol:
39573957
default:
3958-
return nullptr;
3958+
return false;
39593959
case eLookupTypeType:
39603960
break;
39613961
}
39623962

39633963
StackFrameSP frame = m_exe_ctx.GetFrameSP();
39643964

39653965
if (!frame)
3966-
return nullptr;
3966+
return false;
39673967

39683968
const SymbolContext &sym_ctx(frame->GetSymbolContext(eSymbolContextModule));
39693969

39703970
if (!sym_ctx.module_sp)
3971-
return nullptr;
3971+
return false;
39723972

39733973
switch (m_options.m_type) {
39743974
default:
3975-
return nullptr;
3975+
return false;
39763976
case eLookupTypeType:
39773977
if (!m_options.m_str.empty()) {
39783978
if (LookupTypeHere(&GetTarget(), m_interpreter,
39793979
result.GetOutputStream(), *sym_ctx.module_sp,
39803980
m_options.m_str.c_str(), m_options.m_use_regex)) {
39813981
result.SetStatus(eReturnStatusSuccessFinishResult);
3982-
return sym_ctx.module_sp;
3982+
return true;
39833983
}
39843984
}
39853985
break;
39863986
}
39873987

3988-
return nullptr;
3988+
return false;
39893989
}
39903990

39913991
bool LookupInModule(CommandInterpreter &interpreter, Module *module,
@@ -4089,9 +4089,7 @@ class CommandObjectTargetModulesLookup : public CommandObjectParsed {
40894089
// Where it is possible to look in the current symbol context first,
40904090
// try that. If this search was successful and --all was not passed,
40914091
// don't print anything else.
4092-
ModuleSP current_module_sp =
4093-
LookupHere(m_interpreter, result, syntax_error);
4094-
if (current_module_sp) {
4092+
if (LookupHere(m_interpreter, result, syntax_error)) {
40954093
result.GetOutputStream().EOL();
40964094
num_successful_lookups++;
40974095
if (!m_options.m_print_all) {
@@ -4110,8 +4108,7 @@ class CommandObjectTargetModulesLookup : public CommandObjectParsed {
41104108
}
41114109

41124110
for (ModuleSP module_sp : target_modules.ModulesNoLocking()) {
4113-
if (module_sp != current_module_sp &&
4114-
LookupInModule(m_interpreter, module_sp.get(), result,
4111+
if (LookupInModule(m_interpreter, module_sp.get(), result,
41154112
syntax_error)) {
41164113
result.GetOutputStream().EOL();
41174114
num_successful_lookups++;

lldb/test/Shell/Commands/command-image-lookup-current-module.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,6 @@ target modules lookup --type Foo --all
3939
# CHECK-NEXT: Best match found in
4040
# CHECK-NEXT: name = "Foo"
4141

42+
# CHECK: 1 match found in {{.*}}.out
4243
# CHECK: 1 match found in {{.*}}lib1.dylib
4344
# CHECK: 1 match found in {{.*}}lib2.dylib

0 commit comments

Comments
 (0)