blazesym icon indicating copy to clipboard operation
blazesym copied to clipboard

Provide a way to mock symbol resolution

Open josefbacik opened this issue 1 month ago • 2 comments

I had some test code that was abusing the process dispatcher to resolve test addresses so that I could validate that systing was doing the correct thing wrt generating stack trace tracks.

However I changed the systing code to no longer emit anything if we got an error other than MissingSyms, and then my tests broke. Turns out my mock dispatcher thing never actually worked, because I was using random test PIDs that didn't have a /proc/$PID/ directory, so blazesym was just throwing an UnknownAddr error.

I looked through the code and there doesn't appear to be a way to mock out what I need to provide custom symbolization since the /proc/$PID thing is internal. I'd love a way to mock this out so I can have unit testing around stack trace generation.

josefbacik avatar Nov 15 '25 14:11 josefbacik

If you need a process to test against can you create one?

danielocfb avatar Nov 17 '25 17:11 danielocfb

I de-duplicate symbol names in the perfetto trace, so the unit test validates that if I have two processes that have the same symbol data (kernel symbols is the normal case for this) that I only get that symbol showing up once in my trace. There's other stuff like this, so I don't want to fire up processes to do that when I can just have mocked versions of things.

josefbacik avatar Nov 17 '25 17:11 josefbacik