mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-03-26 08:41:47 -07:00
Mps br/gcdiag: split tracestartwhytostring into 2 parts (tostring
and ToTextBuffer), and fix DIAG in TraceStart to use ToString. (Previous hack of using the start-message's buffer only works if the client has enabled start messages). Copied from Perforce Change: 162964 ServerID: perforce.ravenbrook.com
This commit is contained in:
parent
b40ce0f0a7
commit
d50f668fb3
1 changed files with 36 additions and 16 deletions
|
|
@ -224,22 +224,16 @@ static void TraceStartMessageInit(Arena arena, TraceStartMessage tsMessage)
|
|||
return;
|
||||
}
|
||||
|
||||
/* traceStartWhyToString
|
||||
|
||||
/* traceStartWhyToString -- why-code to text
|
||||
*
|
||||
* Converts a TraceStartWhy* code into a string description.
|
||||
* s specifies the beginning of the buffer to write the string
|
||||
* into, len specifies the length of the buffer.
|
||||
* The string written into will be NUL terminated (truncated if
|
||||
* necessary). */
|
||||
static void traceStartWhyToString(char *s, size_t len, int why)
|
||||
* Converts a TraceStartWhy* code into a constant string describing
|
||||
* why a trace started.
|
||||
*/
|
||||
|
||||
static const char *traceStartWhyToString(int why)
|
||||
{
|
||||
const char *r;
|
||||
size_t i;
|
||||
|
||||
AVER(s);
|
||||
/* len can be anything, including 0. */
|
||||
AVER(TraceStartWhyBASE <= why);
|
||||
AVER(why < TraceStartWhyLIMIT);
|
||||
|
||||
switch(why) {
|
||||
case TraceStartWhyCHAIN_GEN0CAP:
|
||||
|
|
@ -269,6 +263,32 @@ static void traceStartWhyToString(char *s, size_t len, int why)
|
|||
break;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
/* traceStartWhyToTextBuffer
|
||||
*
|
||||
* Converts a TraceStartWhy* code into a string describing why a trace
|
||||
* started, and copies that into the text buffer the caller provides.
|
||||
* s specifies the beginning of the buffer to write the string
|
||||
* into, len specifies the length of the buffer.
|
||||
* The string written into will be NUL terminated (truncated if
|
||||
* necessary).
|
||||
*/
|
||||
|
||||
static void traceStartWhyToTextBuffer(char *s, size_t len, int why)
|
||||
{
|
||||
const char *r;
|
||||
size_t i;
|
||||
|
||||
AVER(s);
|
||||
/* len can be anything, including 0. */
|
||||
AVER(TraceStartWhyBASE <= why);
|
||||
AVER(why < TraceStartWhyLIMIT);
|
||||
|
||||
r = traceStartWhyToString(why);
|
||||
|
||||
for(i=0; i<len; ++i) {
|
||||
s[i] = r[i];
|
||||
if(r[i] == '\0')
|
||||
|
|
@ -900,8 +920,8 @@ found:
|
|||
trace->arena = arena;
|
||||
trace->why = why;
|
||||
TraceStartMessageInit(arena, &trace->startMessage);
|
||||
traceStartWhyToString(trace->startMessage.why,
|
||||
sizeof trace->startMessage.why, why);
|
||||
traceStartWhyToTextBuffer(trace->startMessage.why,
|
||||
sizeof trace->startMessage.why, why);
|
||||
trace->white = ZoneSetEMPTY;
|
||||
trace->mayMove = ZoneSetEMPTY;
|
||||
trace->ti = ti;
|
||||
|
|
@ -1856,7 +1876,7 @@ void TraceStart(Trace trace, double mortality, double finishingTime)
|
|||
|
||||
DIAG_WRITEF(( DIAG_STREAM,
|
||||
"MPS: TraceStart, because code $U: $S\n",
|
||||
trace->why, trace->startMessage.why,
|
||||
trace->why, traceStartWhyToString(trace->why),
|
||||
NULL ));
|
||||
{ /* @@ */
|
||||
/* Iterate over all chains, all GenDescs within a chain, and all */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue