View Single Post
Old 10-05-2017, 02:09 AM   #3
GeoffR
Wizard
GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.
 
GeoffR's Avatar
 
Posts: 3,821
Karma: 19162882
Join Date: Nov 2012
Location: Te Riu-a-Māui
Device: Kobo Glo
Finding function addresses

External functions are called indirectly via a jump table. Slots in the jump table are filled in by the linker when the program is loaded.

To find the C++ function ValueDisplaySlider::setStep
Code:
objdump -dC libnickel.so.1.0.0 | grep ValueDisplaySlider::setStep | grep ":$"
output for firmware 4.5.9587:
Code:
004d9d14 <ValueDisplaySlider::setStep(int)@plt>:
008214f0 <ValueDisplaySlider::setStep(int)>:
the first line with @plt shows the address of the jump slot, the second line shows the address of the function itself. If only the jump slot is present then the function itself will be located in another file.

To find where the function is called:
Code:
objdump -dC libnickel.so.1.0.0 | grep ValueDisplaySlider::setStep | grep @plt
output for firmware 4.5.9587:
Code:
004d9d14 <ValueDisplaySlider::setStep(int)@plt>:
  741dce:	f597 efa2 	blx	4d9d14 <ValueDisplaySlider::setStep(int)@plt>
  7420ee:	f597 ee12 	blx	4d9d14 <ValueDisplaySlider::setStep(int)@plt>
  7c692a:	f513 e9f4 	blx	4d9d14 <ValueDisplaySlider::setStep(int)@plt>
  7c69c2:	f513 e9a8 	blx	4d9d14 <ValueDisplaySlider::setStep(int)@plt>
  7c6a58:	f513 e95c 	blx	4d9d14 <ValueDisplaySlider::setStep(int)@plt>
  7c6af0:	f513 e910 	blx	4d9d14 <ValueDisplaySlider::setStep(int)@plt>
the first line is the address of the jump slot, the other lines are the addresses from where the function is called.

(The function could be called from other places too, via a pointer variable. I don't know of any easy way to find such calls.)

Last edited by GeoffR; 10-05-2017 at 02:23 AM. Reason: indirect calls via a pointer variable
GeoffR is offline   Reply With Quote