Confirmed users
1,345
edits
Nnethercote (talk | contribs) (→Run) |
Nnethercote (talk | contribs) No edit summary |
||
Line 145: | Line 145: | ||
The <tt>run-gdb.sh</tt> script also knows to start DMD builds with DMD enabled, so you don't need to do anything special. | The <tt>run-gdb.sh</tt> script also knows to start DMD builds with DMD enabled, so you don't need to do anything special. | ||
If you want to run B2G on a device with non-default options, you'll need to modify the value of <tt>DMD</tt> in the <tt>gonk-misc/b2g.sh</tt> script and then push it to the device like so: | |||
adb shell stop b2g | |||
adb remount | |||
adb push b2g.sh /system/bin | |||
adb shell chmod 0755 /system/bin/b2g.sh | |||
adb shell start b2g | |||
If you want to run B2G on the device under GDB with non-default options, modify the run-gdb.sh script. You don't need to push anything. | |||
==== Analyze ==== | ==== Analyze ==== | ||
Line 265: | Line 275: | ||
Setting the <tt>DMD</tt> environment variable to <tt>1</tt> gives default options. But you can also specify non-default options by setting <tt>DMD</tt> to a whitespace separated list of <tt>--option=val</tt> entries. | Setting the <tt>DMD</tt> environment variable to <tt>1</tt> gives default options. But you can also specify non-default options by setting <tt>DMD</tt> to a whitespace separated list of <tt>--option=val</tt> entries. | ||
==== --sample-below=<1..n> ==== | |||
By default, DMD samples blocks with a sample-below size of 4093. I.e. it ignores some small allocations in order to run (much) faster. | |||
If you want DMD to record all allocations precisely, pass <tt>--sample-below=1</tt>. Otherwise, you should probably leave it unchanged. If you do pick a different value, prime numbers work best. | |||
=== -- | ==== --max-frames=<1..24> ==== | ||
By default, DMD | By default, DMD stack traces do not exceed 24 frames. You can reduce this. | ||
==== --max-records=<1..1000000> ==== | |||
By default, DMD will print 1000 stack trace records of each kind. You can | |||
increase or decrease this. | |||
=== --mode=<normal|test|stress> === | ==== --mode=<normal|test|stress> ==== | ||
<tt>--mode=<normal|test|stress></tt> can be used to invoke "test" or "stress" mode, which are useful if you're hacking on DMD. The default is normal mode. | <tt>--mode=<normal|test|stress></tt> can be used to invoke "test" or "stress" mode, which are useful if you're hacking on DMD. The default is normal mode. | ||
Line 287: | Line 304: | ||
This script checks the output produced by the previous step, and will indicate if the test passed or failed. It should work on Linux and Mac, but is unreliable on Windows. | This script checks the output produced by the previous step, and will indicate if the test passed or failed. It should work on Linux and Mac, but is unreliable on Windows. | ||
== Which heap blocks are reported? == | == Which heap blocks are reported? == | ||
Line 306: | Line 309: | ||
At this stage you might wonder how DMD knows which allocations have been reported and which haven't. DMD only knows about heap blocks that are measured via a function created with one of the following two macros: | At this stage you might wonder how DMD knows which allocations have been reported and which haven't. DMD only knows about heap blocks that are measured via a function created with one of the following two macros: | ||
MOZ_DEFINE_MALLOC_SIZE_OF | |||
MOZ_DEFINE_MALLOC_SIZE_OF_ON_ALLOC | |||
Fortunately, most of the existing memory reporters do this. See [[Platform/Memory_Reporting]] for more details about how memory reporters are written. | Fortunately, most of the existing memory reporters do this. See [[Platform/Memory_Reporting]] for more details about how memory reporters are written. | ||
== Troubleshooting | == Troubleshooting == | ||
Contact Nick Nethercote ("njn" on IRC) or Nathan Froyd ("froydnj" on IRC). | Contact Nick Nethercote ("njn" on IRC) or Nathan Froyd ("froydnj" on IRC). |