Commit 36e0bc46 authored by Olivier Li's avatar Olivier Li Committed by Commit Bot

Add mention of function arguments to base::debug::Alias comments

Change-Id: I40bdae31b55837021cccac92661431da5a161c5d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2210021Reviewed-by: default avatarFrançois Doray <fdoray@chromium.org>
Commit-Queue: Oliver Li <olivierli@google.com>
Cr-Commit-Position: refs/heads/master@{#770695}
parent 7325a425
...@@ -19,12 +19,15 @@ namespace debug { ...@@ -19,12 +19,15 @@ namespace debug {
// otherwise be live at the point of a potential crash. This can only be done // otherwise be live at the point of a potential crash. This can only be done
// with local variables, not globals, object members, or function return values // with local variables, not globals, object members, or function return values
// - these must be copied to locals if you want to ensure they are recorded in // - these must be copied to locals if you want to ensure they are recorded in
// crash dumps. Note that if the local variable is a pointer then its value will // crash dumps. Function arguments are fine to use since the
// be retained but the memory that it points to will probably not be saved in // base::debug::Alias() call on them will make sure they are copied to the stack
// the crash dump - by default only stack memory is saved. Therefore the // even if they were passed in a register. Note that if the local variable is a
// aliasing technique is usually only worthwhile with non-pointer variables. If // pointer then its value will be retained but the memory that it points to will
// you have a pointer to an object and you want to retain the object's state you // probably not be saved in the crash dump - by default only stack memory is
// need to copy the object or its fields to local variables. // saved. Therefore the aliasing technique is usually only worthwhile with
// non-pointer variables. If you have a pointer to an object and you want to
// retain the object's state you need to copy the object or its fields to local
// variables.
// //
// Example usage: // Example usage:
// int last_error = err_; // int last_error = err_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment