-
Notifications
You must be signed in to change notification settings - Fork 560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
i#7046 Add Linux support to dr_create_memory_dump. #7047
base: master
Are you sure you want to change the base?
i#7046 Add Linux support to dr_create_memory_dump. #7047
Conversation
a6cee2c
to
f37ddc3
Compare
1c8c659
to
971b2d1
Compare
39dcddf
to
05727e4
Compare
05727e4
to
37f8abf
Compare
Sorry for the delay: I missed this. Please ping earlier in the future. |
Please don't force-push on shared branches (documented at https://dynamorio.org/page_code_reviews.html#autotoc_md118 and in other places) |
I've pull a new request #7053. |
@@ -390,6 +390,7 @@ if (UNIX) | |||
set(OS_SRCS ${OS_SRCS} unix/loader_android.c) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
save under the logs directory following the WIN example.
grammar: s/save/saved/
@@ -390,6 +390,7 @@ if (UNIX) | |||
set(OS_SRCS ${OS_SRCS} unix/loader_android.c) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code is test with the following change:
Grammar: s/test/tested/
/** | ||
* Memory dump in Executable and Linkable Format. | ||
* | ||
* \note Linux and X64 only. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"X64 Linux only" would be more clear (as is, it could mean Linux is supported and X64 (Windows, Mac, etc.) is supported).
/** | ||
* Memory dump in Executable and Linkable Format. | ||
* | ||
* \note Linux and X64 only. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a release note to api/docs/release.dox on the new feature.
|
||
#ifdef X64 | ||
# define ELF_HEADER_TYPE Elf64_Ehdr | ||
# define ELF_PROGRAM_HEADER_TYPE Elf64_Phdr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are all in module_elf.h? Can we share from there, or in a new header?
} | ||
|
||
#ifdef DEADLOCK_AVOIDANCE | ||
/* first turn off deadlock avoidance for this thread (needed for live dump |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Capitalize and punctuate new comments.
dcontext->thread_owned_locks = NULL; | ||
} | ||
#endif | ||
/* only allow one thread to dumpcore at a time, also protects static |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Capitalize and punctuate new comments.
d_r_mutex_unlock(&dump_core_lock); | ||
|
||
#ifdef DEADLOCK_AVOIDANCE | ||
/* restore deadlock avoidance for this thread */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Capitalize and punctuate new comments.
|
||
#ifdef DEADLOCK_AVOIDANCE | ||
/* first turn off deadlock avoidance for this thread (needed for live dump | ||
* to try to grab all_threads and thread_initexit locks) */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I don't see code grabbing those locks?
@@ -417,7 +417,8 @@ locks_not_closed() | |||
cur_lock->rank == | |||
LOCK_RANK(options_lock) | |||
/* This lock can be used parallel to detach cleanup. */ | |||
IF_UNIX(|| cur_lock->rank == LOCK_RANK(detached_sigact_lock)))) { | |||
IF_UNIX(|| cur_lock->rank == LOCK_RANK(detached_sigact_lock)) | |||
IF_LINUX(|| cur_lock->rank == LOCK_RANK(dump_core_lock)))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This new lock should be cleaned up: please add a destroy instead of an exception.
Is that b/c of the force pushes? Probably not necessary; if anyone had pulled the branch (not likely) the damage is already done; avoiding future ones will avoid review issues now that reviewing has started. |
This is the first change to add Linux support to dr_create_memory_dump. The memory dump is written in ELF format and save under the logs directory following the WIN example.
The code is test with the following change:
and use "readelf -a" to ensure the elf file is built correctly.
Issue: #7046