Closed Bug 1078837 Opened 10 years ago Closed 10 years ago

[refactor] Replace IsSystemElf/reinterpret_cast dance with better API

Categories

(Core :: mozglue, defect)

All
Android
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla36

People

(Reporter: glandium, Assigned: glandium)

References

Details

Attachments

(2 files, 1 obsolete file)

From bug 1077384 comment 8: Also, more of a code cleanliness idea than anything: this IsSystemElf/reinterpret_cast stuff seems to happen fairly often, you could just consider: if (CustomElf* ce = (*it)->AsCustomElf()) { ... } or similar.
Assignee: nobody → mh+mozilla
Blocks: 1081034
Mentor: mh+mozilla
Whiteboard: [good-first-bug][lang=C++]
Depends on: 1082529
Attachment #8504677 - Flags: review?(nfroyd)
Comment on attachment 8504677 [details] [diff] [review] Replace IsSystemElf/reinterpret_cast dance with better API Review of attachment 8504677 [details] [diff] [review]: ----------------------------------------------------------------- Huh, I thought there were more of these. ::: mozglue/linker/ElfLoader.cpp @@ +458,5 @@ > +ElfLoader::Register(CustomElf *handle) > +{ > + Register(static_cast<LibHandle *>(handle)); > + if (dbg) > + dbg.Add(handle); Braces. @@ +483,5 @@ > +ElfLoader::Forget(CustomElf *handle) > +{ > + Forget(static_cast<LibHandle *>(handle)); > + if (dbg) > + dbg.Remove(handle); Braces. @@ +1216,5 @@ > mozilla::RefPtr<LibHandle> handle = > ElfLoader::Singleton.GetHandleByPtr(info->si_addr); > + DEBUG_LOG("Within the address space of %s", handle->GetPath()); > + if (handle && handle->mappable && handle->mappable->ensure(info->si_addr)) > + return; Braces. This seems a little strange insofar as we don't have the IsSystemElf check here anymore. If we segfault inside of libc or similar, doesn't this just hit the default implementation of |ensure()|, which returns true always: http://mxr.mozilla.org/mozilla-central/source/mozglue/linker/Mappable.h#55 ? That seems undesirable. (I mean, we're segfaulting trying to access the text segment, which is bad, but just returning here isn't helping the situation.)
Attachment #8504677 - Flags: review?(nfroyd) → review+
Depends on: 1083020
Attachment #8504677 - Attachment is obsolete: true
No longer depends on: 1082529
Attachment #8505268 - Flags: review?(nfroyd) → review+
Comment on attachment 8505270 [details] [diff] [review] Replace IsSystemElf/reinterpret_cast dance with better API Review of attachment 8505270 [details] [diff] [review]: ----------------------------------------------------------------- I guess this is OK.
Attachment #8505270 - Flags: review?(nfroyd) → review+
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla36
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: