Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/bloaty.cc
Original file line number Diff line number Diff line change
Expand Up @@ -827,12 +827,11 @@ void RollupOutput::PrettyPrint(const OutputOptions& options,

uint64_t file_filtered = 0;
uint64_t vm_filtered = 0;
uint64_t filtered = 0;
if (ShowFile(options)) {
filtered += toplevel_row_.filtered_size.file;
file_filtered = toplevel_row_.filtered_size.file;
}
if (ShowVM(options)) {
filtered += toplevel_row_.filtered_size.vm;
vm_filtered = toplevel_row_.filtered_size.vm;
}

if (vm_filtered == 0 && file_filtered == 0) {
Expand Down
22 changes: 22 additions & 0 deletions tests/source-filter.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Test that --source-filter displays the filtering summary message.

# RUN: rm -rf %t && mkdir -p %t
# RUN: %yaml2obj %S/macho/no-dsym.test -o %t/test_binary

# Test 1: Both domains - should show file and vm omitted sizes
# RUN: %bloaty %t/test_binary -d sections --source-filter="text" | %FileCheck --check-prefix=BOTH %s
# BOTH: __TEXT,__text
# BOTH: TOTAL
# BOTH: Filtering enabled (source_filter); omitted

# Test 2: VM only - should show vm omitted size
# RUN: %bloaty %t/test_binary -d sections --domain=vm --source-filter="text" | %FileCheck --check-prefix=VM %s
# VM: __TEXT,__text
# VM: TOTAL
# VM: Filtering enabled (source_filter); omitted

# Test 3: File only - should show file omitted size
# RUN: %bloaty %t/test_binary -d sections --domain=file --source-filter="text" | %FileCheck --check-prefix=FILE %s
# FILE: __TEXT,__text
# FILE: TOTAL
# FILE: Filtering enabled (source_filter); omitted