Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tcf-dev] Check no_read before reading register

Yes, it is good idea to check no_read.

I have committed a fix.

Thanks!

Eugene

 

From: tcf-dev-bounces@xxxxxxxxxxx [mailto:tcf-dev-bounces@xxxxxxxxxxx] On Behalf Of Lillieskold, Claes
Sent: Thursday, February 18, 2016 4:55 AM
To: TCF Development
Subject: [tcf-dev] Check no_read before reading register

 

Hi,

This is a minor, but in agent/tcf/services/stacktrace.c:trace_stack(), shouldn’t RegisterDefinition.no_read

be checked before reading with read_reg_value(), line 222 below?

 

    216 #if ENABLE_Trace

    217         if (LOG_STACK & log_mode) {

    218             uint64_t v;

    219             RegisterDefinition * def;

    220             trace(LOG_STACK, "Frame %d", stack->frame_cnt - 1);

    221             for (def = get_reg_definitions(ctx); def->name != NULL; def++) {

    222                 if (read_reg_value(frame, def, &v) == 0) {

    223                     trace(LOG_STACK, "  %-8s %16"PRIX64, def->name, v);

    224                 }

    225             }

    226         }

    227 #endif

 

Line 222 could be: if (def->no_read == 0 && read_reg_value(frame, def, &v) == 0) {

 

Or if logging of failure to read a readable register could be logged:

if (def->no_read == 0) {

if (read_reg_value(frame, def, &v) == 0) {

                    trace(LOG_STACK, "  %-8s %16"PRIX64, def->name, v);

} else {

trace(LOG_STACK, "Failed to read register:%s", def->name);

}

}

 

What do you think about this change?

 

Best regards,

Claes

 

----------------------------------------------------------------------
Intel Sweden AB
Registered Office: Isafjordsgatan 30B, 164 40 Kista, Stockholm, Sweden
Registration Number: 556189-6027

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.


Back to the top