Skip to content

Commit 3145ccc

Browse files
committed
address review comments
1 parent 2ad39b3 commit 3145ccc

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed

llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
//===- Symbolize.h ----------------------------------------------*- C++
2-
//-*-===//
1+
//===- Symbolize.h ----------------------------------------------*- C++//-*-===//
32
//
43
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
54
// See https://llvm.org/LICENSE.txt for license information.
@@ -247,8 +246,8 @@ class LLVMSymbolizer {
247246
};
248247

249248
/// Parsed object file for each path/member/architecture triple.
250-
/// Used to cache objects extracted from containers (Mach-O universal
251-
/// binaries, archives).
249+
/// Used to cache objects extracted from containers (e.g: Mach-O
250+
/// universal binaries, archives).
252251
std::map<ContainerCacheKey, std::unique_ptr<ObjectFile>> ObjectFileCache;
253252

254253
Expected<object::Binary *>

llvm/lib/DebugInfo/Symbolize/Symbolize.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
//===-- LLVMSymbolize.cpp
2-
//-------------------------------------------------===//
1+
//===-- LLVMSymbolize.cpp//-------------------------------------------------===//
32
//
43
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
54
// See https://llvm.org/LICENSE.txt for license information.
@@ -641,13 +640,21 @@ Expected<ObjectFile *> LLVMSymbolizer::getOrCreateObjectFromArchive(
641640
Error Err = Error::success();
642641
for (auto &Child : Archive->children(Err, /*SkipInternal=*/true)) {
643642
Expected<StringRef> NameOrErr = Child.getName();
644-
if (!NameOrErr)
643+
if (!NameOrErr) {
644+
// TODO: Report this as a warning to the client. Consider adding a
645+
// callback mechanism to report warning-level issues.
646+
consumeError(NameOrErr.takeError());
645647
continue;
648+
}
646649
if (*NameOrErr == MemberName) {
647650
Expected<std::unique_ptr<object::Binary>> MemberOrErr =
648651
Child.getAsBinary();
649-
if (!MemberOrErr)
652+
if (!MemberOrErr) {
653+
// TODO: Report this as a warning to the client. Consider adding a
654+
// callback mechanism to report warning-level issues.
655+
consumeError(MemberOrErr.takeError());
650656
continue;
657+
}
651658

652659
std::unique_ptr<object::Binary> Binary = std::move(*MemberOrErr);
653660
if (auto *Obj = dyn_cast<object::ObjectFile>(Binary.get())) {
@@ -691,9 +698,8 @@ LLVMSymbolizer::getOrCreateObject(const std::string &Path,
691698
StringRef ArchivePath = StringRef(Path).substr(0, OpenParen);
692699
StringRef MemberName =
693700
StringRef(Path).substr(OpenParen + 1, Path.size() - OpenParen - 2);
694-
StringRef FullPath = Path;
695701
return getOrCreateObjectFromArchive(ArchivePath, MemberName, ArchName,
696-
FullPath);
702+
Path);
697703
}
698704
}
699705

llvm/tools/llvm-symbolizer/Opts.td

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ class F<string name, string help>: Flag<["--"], name>, HelpText<help>;
1515

1616
def grp_mach_o : OptionGroup<"kind">,
1717
HelpText<"llvm-symbolizer Mach-O Specific Options">;
18-
def grp_symbolizer : OptionGroup<"Symbolizer Options">;
1918
def grp_gsym : OptionGroup<"kind">,
2019
HelpText<"llvm-symbolizer GSYM Related Options">;
2120

@@ -31,8 +30,7 @@ def color_EQ : Joined<["--"], "color=">, HelpText<"Whether to use color when sym
3130
defm debug_file_directory : Eq<"debug-file-directory", "Path to directory where to look for debug files">, MetaVarName<"<dir>">;
3231
defm debuginfod : B<"debuginfod", "Use debuginfod to find debug binaries", "Don't use debuginfod to find debug binaries">;
3332
defm default_arch
34-
: Eq<"default-arch", "Default architecture for multi-arch containers (Mach-O objects or AIX archives)">,
35-
Group<grp_symbolizer>;
33+
: Eq<"default-arch", "Default architecture for multi-arch containers (e.g. Mach-O objects or AIX archives)">;
3634
defm demangle : B<"demangle", "Demangle function names", "Don't demangle function names">;
3735
def disable_gsym : F<"disable-gsym", "Don't consider using GSYM files for symbolication">, Group<grp_gsym>;
3836
def filter_markup : Flag<["--"], "filter-markup">, HelpText<"Filter symbolizer markup from stdin.">;

0 commit comments

Comments
 (0)