[RFC] Entry point update with "run" command

Luis Machado
2008-04-24T15:59:05Z

[-- Attachment #1: Type: text/plain, Size: 825 bytes --]

Hi folks,

It seems GDB doesn't really update the entry point of an object file if
we "reload" the modified binary through the "run" command.

This can be clearly seen with the reread.exp testcase:

1 - Run reread until "foo" breakpoint
2 - Move reread2 on top of reread
3 - "Run" and expect GDB to notice that the binary has changed
4 - GDB says it will re-read the symbols
5 - The entry point of the second binary is just the same as the first
one. This causes problems with the displaced stepping since the entry
point is used to store the instructions.

The problem is that "init_entry_point_info" is never called with the
"run" command. If we do a "file", then we get the right entry point.

The attached patch does this on "reread_symbols", though it seems a
brute-force method. Is this OK?

Regards

--
Luis Machado

[-- Attachment #2: entry_point.diff --]
[-- Type: text/x-patch, Size: 405 bytes --]

Index: hg/gdb/symfile.c
===================================================================
--- hg.orig/gdb/symfile.c 2008-04-24 08:09:30.000000000 -0700
+++ hg/gdb/symfile.c 2008-04-24 08:45:50.000000000 -0700
@@ -2467,6 +2467,7 @@
objfile->mtime = new_modtime;
reread_one = 1;
reread_separate_symbols (objfile);
+ init_entry_point_info (objfile);
}
}
}