Got the Virtualization GDB stub working! (Thanks for spotting this in the binary, @jmpews.) Two overlapping windows. In...
Using it is pretty simple: first, trick com.apple.Virtualization.VirtualMachine into thinking you have the https://t.co/Cj7K2yvHAG.private.virtualization entitlement. You’ll need to attach early; I this again:
Then just:

(lldb) b xpc_connection_copy_entitlement_value
(lldb) breakpoint command add
> thread return (id)xpc_bool_create(1)
> c

I think the XPC connection has a timeout, so make sure your breakpoint automatically continues execution.
Finally, initialize a _VZGDBDebugStubConfiguration with a port and then set your VZVirtualMachineConfiguration’s _debugStub to it.

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Saagar Jha

Saagar Jha Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @_saagarjha

1 Nov
Writing something cursed so here’s a thread me livetweeting what I find out in the process
You cannot use “auto” to deduce the type of a block parameter, even though you can for lambdas since C++14

(error: 'auto' not allowed in function prototype that is not a function declaration)
Declaring a C++ conversion operator that returns a function pointer does not seem to work (at least, the syntax I tried to use, “operator return_type (*)(arguments, …)()”, didn’t compile). However, it works with a typedef
Read 4 tweets
23 Oct
Something I’ve found interesting when working “at scale” is that it’s really just similar to working on smaller projects. Large companies like to show how they are somehow really careful and thorough, because of their special CI/tooling/whatever, but that just doesn’t seem true?
Everyone loves stories of the people who shave microseconds off a hot path or write software resilient to a CPU socket literally falling off, but most code is super pedestrian and as full of bugs as any other. Often the code I see on the outside is of far higher quality…
I used to think I needed to have a special mindset or something. What if I cause crashes for half of North America? But it turns out companies just do this all the time. A for loop here that killa battery life, a bad null check there that causes a crash at startup: it’s “normal”.
Read 4 tweets
11 Oct
I think what I love the most about scale is that I can sit down for a couple hours and write a five-line patch that will, when taken in aggregate, save many lifetimes of waiting for things to load
By the way, if you’re using method_setImplementation/method_exchangeImplementations in your app, you may wish to reconsider doing so if possible for performance reasons. (If you’re using them to swizzle, there might be correctness reasons as well–but I digress.)
In particular, Methods don’t keep a backpointer to which Class they come from. This means that using either of those two functions means that the Objective-C runtime needs to blow out the method cache for *all* classes–potentially tens of thousands of them in a large app.
Read 4 tweets
6 Oct
Just confirmed that @slackhq has fixed this issue, and I expect that they'll soon roll this out generally. If you noticed that your phone was getting poor battery life or would feel noticeably warm, this might help!
The main problem appeared to be an accidentally-quadratic loop in a part of the app that read log files between the app and an extension. For each file it would scan the entire directory, which doesn't really work if there are several thousand logs ;)
In addition, the loop had a high constant factor, because it was using readdir(3) from Swift. readdir returns a pointer to a struct dirent, which essentially declares the filename as "char d_name[1024]". Of course, in Swift this gets bridged to a 1024-element tuple…
Read 5 tweets
20 Sep
Looks like the final iOS 15 is a different build than the RC from last week–19A346 verus 19A344. Maybe this one will have the security fixes iOS 14.8 shipped with?
(I hear that the new build actually mostly exists to fix a last-minute crash. I’m not seeing the bug in the security notes at the moment…)
IPSWs are up for new devices
Read 6 tweets
19 Sep
Hey Mac Safari team, I know you're busy getting things ready for Monterey, but can you please fix the bug where Safari crashes when you try to reopen a window that has pinned tabs? I already filed FB9637329, but to make this as easy as possible I've already found the bug for you.
About halfway down -[BrowserWindowPersistentState initWithBrowserWindowController:encryptionProvider:skipTabStates:] you save the currently selected tab to self->_selectedUnpinnedTabIndex. The index you calculate includes all the pinned tabs… Disassembly of part of -[BrowserWindowPersistentState initWi
…but at the top of -[BrowserWindowPersistentState restoreWindowContents:] you use this combined index to read from self->_tabStates, which *doesn't* include pinned tabs. Sometimes, you'll just end up selecting the wrong tab, but other times the index will be out of bounds… Safari`-[BrowserWindowPersistentState restoreWindowContents:
Read 4 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!

:(