public inbox for frysk-cvs@sourceware.org help / color / mirror / Atom feed
From: cagney@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Include VDSO in address map. Date: Thu, 19 Jun 2008 19:52:00 -0000 [thread overview] Message-ID: <20080619195229.17317.qmail@sourceware.org> (raw) The branch, master has been updated via edfa23da73934bf0ab40697a13b0731feabb337c (commit) from bd2d28691caa79f3434474ae2bb1537b428aaf41 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit edfa23da73934bf0ab40697a13b0731feabb337c Author: Andrew Cagney <cagney@redhat.com> Date: Thu Jun 19 15:51:27 2008 -0400 Include VDSO in address map. frysk-sys/lib/dwfl/ChangeLog 2008-06-19 Andrew Cagney <cagney@redhat.com> * cni/Dwfl.cxx (dwfl_frysk_proc_find_elf): Always set file_name so elfutils realises that the ELF was set. * jni/Dwfl.cxx: Ditto. * TestDwfl.java (testMapContainsVdso): Check the vdso's elf. * Dwfl.java (mapModule): Include segments starting with "[". ----------------------------------------------------------------------- Summary of changes: frysk-sys/lib/dwfl/ChangeLog | 6 +++++ frysk-sys/lib/dwfl/Dwfl.java | 5 +--- frysk-sys/lib/dwfl/TestDwfl.java | 3 +- frysk-sys/lib/dwfl/cni/Dwfl.cxx | 41 ++++++++++++--------------------- frysk-sys/lib/dwfl/cni/DwflModule.cxx | 21 +++++++--------- frysk-sys/lib/dwfl/jni/Dwfl.cxx | 19 +++++++-------- 6 files changed, 41 insertions(+), 54 deletions(-) First 500 lines of diff: diff --git a/frysk-sys/lib/dwfl/ChangeLog b/frysk-sys/lib/dwfl/ChangeLog index f9e9ea0..43dc64a 100644 --- a/frysk-sys/lib/dwfl/ChangeLog +++ b/frysk-sys/lib/dwfl/ChangeLog @@ -1,5 +1,11 @@ 2008-06-19 Andrew Cagney <cagney@redhat.com> + * cni/Dwfl.cxx (dwfl_frysk_proc_find_elf): Always set file_name so + elfutils realises that the ELF was set. + * jni/Dwfl.cxx: Ditto. + * TestDwfl.java (testMapContainsVdso): Check the vdso's elf. + * Dwfl.java (mapModule): Include segments starting with "[". + * DwflTestbed.java (createFromSelf()): Pass LocalMemory to the Dwfl. * cni/DwflModule.cxx (DwflModule::setUserData): Delete. * jni/DwflModule.cxx (DwflModule::setUserData): Delete. diff --git a/frysk-sys/lib/dwfl/Dwfl.java b/frysk-sys/lib/dwfl/Dwfl.java index ef77a05..f540e9f 100644 --- a/frysk-sys/lib/dwfl/Dwfl.java +++ b/frysk-sys/lib/dwfl/Dwfl.java @@ -266,10 +266,7 @@ public class Dwfl { finest.log(this, "ignoring empty name"); } else if (name.indexOf("(deleted") >= 0) { finest.log(this, "ignoring deleted", name); - } else if (!name.startsWith("/")) { - // XXX: This is too agressive, it ignores [vdso], on - // the other hand, if vdso is included this leads to - // segmentation faults. + } else if (!name.startsWith("/") && !name.equals("[vdso]")) { finest.log(this, "ignoring non-file", name); } else { // A new map, save it, will be reported later. diff --git a/frysk-sys/lib/dwfl/TestDwfl.java b/frysk-sys/lib/dwfl/TestDwfl.java index 2aee367..2d2bcc4 100644 --- a/frysk-sys/lib/dwfl/TestDwfl.java +++ b/frysk-sys/lib/dwfl/TestDwfl.java @@ -234,8 +234,6 @@ public class TestDwfl extends TestCase { } public void testMapContainsVdso() { - if (unresolved(6626)) - return; Dwfl dwfl = DwflTestbed.createFromSelf(); DwflModule[] modules = dwfl.getModules(); DwflModule vdso = null; @@ -248,5 +246,6 @@ public class TestDwfl extends TestCase { } } assertNotNull("vdso", vdso); + assertNotNull("elf", vdso.getElf()); } } diff --git a/frysk-sys/lib/dwfl/cni/Dwfl.cxx b/frysk-sys/lib/dwfl/cni/Dwfl.cxx index 167653d..e17af96 100644 --- a/frysk-sys/lib/dwfl/cni/Dwfl.cxx +++ b/frysk-sys/lib/dwfl/cni/Dwfl.cxx @@ -79,7 +79,6 @@ read_proc_memory (void *arg, void *data, GElf_Addr address, size_t minread, size_t maxread) { inua::eio::ByteBuffer* memory = (inua::eio::ByteBuffer *) arg; - jbyteArray bytes = JvNewByteArray(maxread); ssize_t nread = memory->safeGet((off64_t) address, bytes, 0, maxread); memcpy(data, elements(bytes), nread); @@ -94,34 +93,24 @@ dwfl_frysk_proc_find_elf (Dwfl_Module *mod, const char *module_name, Dwarf_Addr base, char **file_name, Elf **elfp) { - // There is an edge case here that was tripped by a corefile case. In that case the - // specified executable was defined as a relative path (ie ../foo/bar). And that is - // perfectly valid path name. However when the corefile created its maps it did not - // convert that path to an absolute path, causing the test below to fail and consider - // the file ../foo/bar to be an in memory elf image. - if (module_name[0] == '/') - { - int fd = open64 (module_name, O_RDONLY); - if (fd >= 0) - { - *file_name = strdup (module_name); - if (*file_name == NULL) - { - close (fd); - return ENOMEM; - } - } - return fd; - } - else - { + // There is an edge case here that was tripped by a corefile + // case. In that case the specified executable was defined as a + // relative path (ie ../foo/bar). And that is perfectly valid path + // name. However when the corefile created its maps it did not + // convert that path to an absolute path, causing the test below to + // fail and consider the file ../foo/bar to be an in memory elf + // image. + if (module_name[0] == '/') { + // Pass back the file name and let dwfl take care of the rest. + *file_name = strdup (module_name); + return -1; + } else { *elfp = elf_from_remote_memory (base, NULL, &read_proc_memory, *userdata); - + if (*elfp != NULL) { + *file_name = ::strdup(module_name); + } return -1; } - - //abort (); - return -1; } jlong diff --git a/frysk-sys/lib/dwfl/cni/DwflModule.cxx b/frysk-sys/lib/dwfl/cni/DwflModule.cxx index 5d7a41a..97892ff 100644 --- a/frysk-sys/lib/dwfl/cni/DwflModule.cxx +++ b/frysk-sys/lib/dwfl/cni/DwflModule.cxx @@ -68,18 +68,15 @@ #define DWFL_MODULE_POINTER ((Dwfl_Module *) pointer) lib::dwfl::ModuleElfBias* -lib::dwfl::DwflModule::module_getelf() -{ - Dwarf_Addr bias = 0; - ::Elf *elf = dwfl_module_getelf(DWFL_MODULE_POINTER, &bias); - if(elf == NULL) - return NULL; - - lib::dwfl::ModuleElfBias *ret = new lib::dwfl::ModuleElfBias(); - ret->elf = new lib::dwfl::Elf((jlong) elf); - ret->bias = (jlong) bias; - - return ret; +lib::dwfl::DwflModule::module_getelf() { + Dwarf_Addr bias = 0; + ::Elf *elf = dwfl_module_getelf(DWFL_MODULE_POINTER, &bias); + if(elf == NULL) + return NULL; + lib::dwfl::ModuleElfBias *ret = new lib::dwfl::ModuleElfBias(); + ret->elf = new lib::dwfl::Elf((jlong) elf); + ret->bias = (jlong) bias; + return ret; } typedef JArray<lib::dwfl::DwflLine *> DwflLineArray; diff --git a/frysk-sys/lib/dwfl/jni/Dwfl.cxx b/frysk-sys/lib/dwfl/jni/Dwfl.cxx index a04b9b8..7be62a5 100644 --- a/frysk-sys/lib/dwfl/jni/Dwfl.cxx +++ b/frysk-sys/lib/dwfl/jni/Dwfl.cxx @@ -107,21 +107,20 @@ dwfl_frysk_proc_find_elf(Dwfl_Module *mod, // that path to an absolute path, causing the test below to fail and // consider the file ../foo/bar to be an in memory elf image. if (module_name[0] == '/') { - int fd = ::open64(module_name, O_RDONLY); - if (fd >= 0) { - *file_name = ::strdup(module_name); - if (*file_name == NULL) { - ::close(fd); - return ENOMEM; - } - } - return fd; + // Return the file name, and then let elfutils decide what to do. + *file_name = ::strdup(module_name); + return -1; } else { // dwfl passes in the address of the Dwfl_Module user pointer // contained within. That pointer has been previously stuffed // with our "userdata". *elfp = elf_from_remote_memory (base, NULL, &read_proc_memory, *userdata); - return 0; + if (*elfp != NULL) { + // Poke something into FILE_NAME so that the caller notices that + // we've done something to ELF. + *file_name = ::strdup(module_name); + } + return -1; } } hooks/post-receive -- frysk system monitor/debugger
reply other threads:[~2008-06-19 19:52 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20080619195229.17317.qmail@sourceware.org \ --to=cagney@sourceware.org \ --cc=frysk-cvs@sourceware.org \ --cc=frysk@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).