gmodule.pl.in 635 B

12345678910111213141516171819202122232425262728293031
  1. ###
  2. ### Generate GDB commands, that load symbols for specified module,
  3. ### with proper section relocations. See .gdbinit
  4. ###
  5. ### $Id: gmodule.pl,v 1.2 2006/05/14 11:38:42 lkundrak Exp lkundrak $
  6. ### Lubomir Kundrak <lkudrak@skosi.org>
  7. ###
  8. use strict;
  9. while (<>) {
  10. my ($name, %sections) = split;
  11. print "add-symbol-file $name.module";
  12. open (READELF, "readelf -S $name.mod |") or die;
  13. while (<READELF>) {
  14. /\[\s*(\d+)\]\s+(\.\S+)/ or next;
  15. if ($2 eq '.text') {
  16. print " $sections{$1}";
  17. next;
  18. }
  19. print " -s $2 $sections{$1}"
  20. if ($sections{$1} ne '0x0' and $sections{$1} ne '');
  21. };
  22. close (READELF);
  23. print "\n";
  24. }