Browse code

symbolFromIndex() can now be instructed to fetch symbols from a specific dynsym section.

Xavier G authored on 17/08/2015 21:54:34
Showing 1 changed files
... ...
@@ -3598,8 +3598,12 @@ sub segmentIncludesSection {
3598 3598
 sub symbolFromIndex {
3599 3599
 	my $elf_data = shift;
3600 3600
 	my $index = shift;
3601
+	my $dynsym_index = shift;
3601 3602
 
3602 3603
 	for my $section_index (@{$elf_data->{'SHT_DYNSYM'}}) {
3604
+		if (defined($dynsym_index)) {
3605
+			next if ($section_index != $dynsym_index);
3606
+		}
3603 3607
 		if (exists($elf_data->{'sections'}->{$section_index}->{'_symbols'}->{$index})) {
3604 3608
 			return $elf_data->{'sections'}->{$section_index}->{'_symbols'}->{$index};
3605 3609
 		}
... ...
@@ -3610,8 +3614,9 @@ sub symbolFromIndex {
3610 3614
 sub symbolNameFromIndex {
3611 3615
 	my $elf_data = shift;
3612 3616
 	my $index = shift;
3617
+	my $dynsym_index = shift;
3613 3618
 
3614
-	my $symbol = symbolFromIndex($elf_data, $index);
3619
+	my $symbol = symbolFromIndex($elf_data, $index, $dynsym_index);
3615 3620
 	return defined($symbol) ? $symbol->{'_name'} : undef;
3616 3621
 }
3617 3622