Move [vdso] after exe/linker in _r_debug
gdbserver assumes that the first entry is the exe, so it must come
first.
Fixes debugging of executables with gdb.
Bug: https://issuetracker.google.com/112627083
Bug: http://b/110967431
Test: gdbclient.py -r toybox
Change-Id: I7b30398d679c3f8b92d8d02572f9073ae0fce798
diff --git a/linker/linker_main.cpp b/linker/linker_main.cpp
index 3410f90..af47619 100644
--- a/linker/linker_main.cpp
+++ b/linker/linker_main.cpp
@@ -289,8 +289,6 @@
}
}
- add_vdso(args);
-
struct stat file_stat;
// Stat "/proc/self/exe" instead of executable_path because
// the executable could be unlinked by this point and it should
@@ -320,6 +318,8 @@
insert_link_map_into_debug_map(map);
insert_link_map_into_debug_map(&linker_link_map);
+ add_vdso(args);
+
// Extract information passed from the kernel.
si->phdr = reinterpret_cast<ElfW(Phdr)*>(args.getauxval(AT_PHDR));
si->phnum = args.getauxval(AT_PHNUM);