garrysmod-issues icon indicating copy to clipboard operation
garrysmod-issues copied to clipboard

[Linux DS 64] VProf doesn't work.

Open RaphaelIT7 opened this issue 4 months ago • 0 comments

Details

On 64x Linux DS, vprof doesn't seem to work.
As far as I found out, it is caused by CVProfile::InTargetThread failing.
It fails because it compares CVProfile::m_TargetThreadId(an unsigned int) against ThreadGetCurrentId(an ThreadId_t / uint64) which then fails to compare.
CVProfile::m_TargetThreadId should probably be changed to ThreadId_t / an uint64 to match ThreadGetCurrentId.

An example to easily see the Issue I mean:

#include <cstdio>
#include <pthread.h>

int main()
{
    unsigned m_TargetThreadId = pthread_self(); // Basicly what vprof does
    unsigned long int pthread_Id = pthread_self(); // You can see the type difference
    printf("%u %lu %s!\n", m_TargetThreadId, pthread_Id, m_TargetThreadId == pthread_Id ? "true" : "false");
    return 0;
}

Steps to reproduce

  1. Run vprof_on
  2. Run vprof_generate_report
  3. See the empty report

NOTE: This could maybe be linked to https://github.com/Facepunch/garrysmod-issues/issues/5981

RaphaelIT7 avatar Oct 07 '24 06:10 RaphaelIT7