summaryrefslogtreecommitdiff
path: root/UnixPkg/Sec/SecMain.c
diff options
context:
space:
mode:
authoreric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524>2008-06-30 06:25:43 +0000
committereric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524>2008-06-30 06:25:43 +0000
commit865c7e1722d96b37ef2684fc76d8daecc29c1f21 (patch)
tree5a893cb0279f1f5cd02e2d63ab73b51e1117fa0e /UnixPkg/Sec/SecMain.c
parented0b86b1838a525dc5e9e86dc0acd47e3a16dc50 (diff)
downloadedk2-platforms-865c7e1722d96b37ef2684fc76d8daecc29c1f21.tar.xz
Provide source level debug ability in *unix environment.
[Background] The UnixPkg provide an simulator in *unix. To support source level debug, we need force all modules be built as ELF shard objects and dynamically load all of modules using dlopen(). For peicore, peim and dxecore, we provide a wrapper to provide PeCoffLoader interface git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5382 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'UnixPkg/Sec/SecMain.c')
-rw-r--r--UnixPkg/Sec/SecMain.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/UnixPkg/Sec/SecMain.c b/UnixPkg/Sec/SecMain.c
index a6da20b135..bfa44e7a17 100644
--- a/UnixPkg/Sec/SecMain.c
+++ b/UnixPkg/Sec/SecMain.c
@@ -983,6 +983,21 @@ SecNt32PeCoffRelocateImage (
(unsigned long)ImageContext->ImageAddress,
(unsigned long)ImageContext->EntryPoint);
+ Handle = dlopen(ImageContext->PdbPointer, RTLD_NOW);
+
+ if (Handle) {
+ Entry = dlsym(Handle, "_ModuleEntryPoint");
+ } else {
+ printf("%s\n", dlerror());
+ }
+
+ if (Entry != NULL) {
+ ImageContext->EntryPoint = Entry;
+ printf("Change %s Entrypoint to :0x%08lx\n", ImageContext->PdbPointer, Entry);
+ } else {
+ printf("Could not find _ModuleEntryPoint Entry, Module may be built error\n");
+ }
+
SecUnixLoaderBreak ();
return Status;