rr-debugger / rr-debugger/rr

Running on MacBook Pro, Windows 10 Bootcamp, WSL 2

Open
#3,333 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
10.7k
Forks
662
Avg merge
2d 3h
Merged PRs (30d)
2

Description

An issue to track ability to run on Bootcamp on Apple Intel hardware.

Setup

https://ubuntu.com/tutorials/install-ubuntu-on-wsl2-on-windows-10#2-install-wsl

wsl --install -d ubuntu

Install perf

See: https://stackoverflow.com/a/65276025/130910

Test

Open PowerShell in Administrator mode.

wsl

Create a sample program to debug

multiple.c
#include <stdio.h>
#define SIZE 4

void zero(char *a, int size)
{
	while (size>0)
		a[size--] = 0; 
}

void initialize(char *a, int size)
{
	zero(a, size);
}

void multiply(char *a, int size, int mult)
{
	int i;
	for (i=0; i<size; i++)
		a[i] = i * mult;
}

void pr_array(char *a, int size)
{
	int i;
	for (i=0; i<size; i++)
		printf("f(%d)=%d\n", i, a[i]);
}

int main(int argc, char **argv)
{
	char a[SIZE];
	int mult = 2;

	initialize(a, SIZE);
	multiply(a, SIZE, mult);
	pr_array(a, SIZE);
	return 0;
}
sudo apt install gcc

gcc multiply.c -o multiply

./multiply
f(0)=0
f(1)=2
f(2)=4
f(3)=6
sudo rr record multiply

Fails to run:

[FATAL /home/roc/rr/rr/src/PerfCounters.cc:217:start_counter()] Unable to open performance counter with 'perf_event_open'; are hardware perf events available? See https://github.com/rr-debugger/rr/wiki/Will-rr-work-on-my-system

Check perf events supported

$ uname -a
Linux VMBP2019-WINBC 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
$ dmesg  | grep -i perf
[    0.062235] Performance Events: unsupported p6 CPU model 158 no PMU driver, software events only.

This seems to indicate that they are not.

Status

See: Support hardware performance counters - WSL2 - https://github.com/microsoft/WSL/issues/4678

Also: State of hardware performance monitoring in WSL2 - https://github.com/microsoft/WSL/issues/8480

No one seems to have got it working so far.

Potential fixes

Update custom Microsoft Linux kernel version for wsl2

5.10 to 5.15 (latest longterm - see https://www.kernel.org/)

Pending issue on wsl repo: https://github.com/microsoft/WSL/issues/8507

Doesn't seem to work

Try Windows 11

NOTE: Not compatible with Apple Intel hardware.

Doesn't seem to work

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the WSL hardware-performance-counter issues linked in the report, then reproduce the setup with WSL, the sample program, and sudo rr record multiply. Done would mean rr can record the sample on the described MacBook Pro and WSL 2 environment without the perf_event_open failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, linux
Domain
devtools, operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.