Browse code

displayStringTableForSection(): add $content parameter.

This parameter allows the caller to specify the first words of the sentences
displayed by this function. If this extra parameter is omitted, the function
will default to "Strings". The point of this parameter is that ELF string
tables can hold various things that are not symbol names, e.g. file names or
versions.

Xavier G authored on10/09/2015 00:52:32
Showing1 changed files

  • elfwalk index c8a40bb..e19065f 100755
... ...
@@ -3812,19 +3812,25 @@ sub displayStringTableForSection {
3812 3812
 	my $ind = shift;
3813 3813
 	my $elf_data = shift;
3814 3814
 	my $section_index = shift;
3815
+	my $content = shift || 'Strings';
3815 3816
 
3816 3817
 	my $strtab = displayLinkedSection($ind, $elf_data, $section_index);
3817 3818
 	if (defined($strtab)) {
3818 3819
 		if ($strtab->{'_type'} eq 'SHT_STRTAB') {
3819 3820
 			sayf(
3820 3821
 				$ind + 1,
3821
-				'Symbol names will be read from it, i.e. from offset %s.',
3822
+				'%s will be read from it, i.e. from offset %s.',
3823
+				$content,
3822 3824
 				formatOffset($strtab->{'sh_offset'})
3823 3825
 			);
3824 3826
 			return $strtab->{'_index'};
3825 3827
 		}
3826 3828
 		else {
3827
-			say($ind + 1, 'Symbol names will not be read from there though, as its type is not SHT_STRTAB.');
3829
+			sayf(
3830
+				$ind + 1,
3831
+				'%s will not be read from there though, as its type is not SHT_STRTAB.',
3832
+				$content
3833
+			);
3828 3834
 		}
3829 3835
 	}
3830 3836
 	return undef;