Manpage Monday: backtrace(3)
Monday, October 27th, 2008New series: Manpage FridayMonday. Every Fridayother Monday, I will post a link to one manpage that comes with Mac OS X. [See update below.]
Today, it's backtrace(3), which tells you about three functions:
SYNOPSIS
#include <execinfo.h>
int backtrace(void** array, int size);
char** backtrace_symbols(void* const* array, int size);
void backtrace_symbols_fd(void* const* array, int size, int fd);DESCRIPTION
These routines provide a mechanism to examine the current thread’s call stack.
backtrace()writes the function return addresses of the current call stack to the array of pointers referenced by array. At most, size pointers are written. The number of pointers actually written to array is returned.
backtrace_symbols()attempts to transform a call stack obtained bybacktrace()into an array of human-readable strings usingdladdr(). The array of strings returned has size elements. It is allocated usingmalloc()and should be released usingfree(). There is no need to free the individual strings in the array.
backtrace_symbols_fd()performs the same operation asbacktrace_symbols(), but the resulting strings are immediately written to the file descriptor fd, and are not returned.
Added 2008-10-25: Here's a test app to show the output.
UPDATE 2008-10-24 21:19 PDT: I've decided to change the schedule on this. Instead of Manpage Friday, I'll do Manpage Monday, and it will be every two weeks. In between will be Framework Friday.
So this is now the first Manpage Monday post, and I will update its post date on Monday, the 27th. (I can't update it now because WordPress won't let me publish a post from the future—only schedule it. Grrr.) The week after that, November 7th will be the first Framework Friday. And in the week after that, November 10th will be the second Manpage Monday.
New website: Are the iPhone APIs public yet?
Thursday, October 23rd, 2008iTunes’ new worst alert box?
Sunday, October 19th, 2008I believe Apple added this alert box in version 8:

Let's enumerate the fail, shall we?
-
Applications cannot be purchased with Shopping Cart.
Yes, they can. You just won't let me.
-
Your preferences are currently set to buy using Shopping Cart.
Because that's what I want to do.
-
Application purchases cannot be placed in Shopping Cart; they must be purchased by 1-Click.
Passive voice is great, isn't it? It allows the subject to not take responsibility for their own actions.
This is not some law of nature, like gravity meaning that you cannot fly. Apple prevents you from buying applications using a Shopping Cart. The message should just say that.
-
Select Buy if you'd like to purchase application by using 1-Click …
I wouldn't, but since iTunes won't let me do what I really want, I have to either buy it the way iTunes wants me to, or not buy it at all.
-
… and your credit card will be charged immediately.
No, it won't, because I don't have a credit card on my iTunes account. If it did charge my credit card, I would be alarmed.
Now, let's rewrite the alert's message to be more accurate.
You may not purchase applications with Shopping Cart.
Regardless of the fact that you have chosen to buy from iTunes using a Shopping Cart, we have chosen to not allow you to buy applications using a Shopping Cart. Instead, we require you to buy using 1-Click. Select Buy if you accept this limitation, and we will deduct the money from your store credit immediately.
I have filed two bugs:
Happy vs. Unhappy: The New MacBooks
Wednesday, October 15th, 2008Happy:
-
Glass trackpad is intriguing. And they finally killed the button, which had long been unnecessary. Now I just want an external USB one of these, for my Mac Pro.
-
Unification of the MacBook and MacBook Pro lines. The new MacBook is just the 13.3″ MacBook Pro. (But only a partial unification: the low-end plastic MacBook is still available.)
-
Finally, a new Cinema Display with its own camera.
-
And, on the same display, a built-in MacBook power adapter!
Unhappy:
-
Still no 12″ MacBook Pro. (Actually, considering the lines' convergence, a 12″ MacBook would be OK now.)
Remember the 12″ PowerBook G4? I want an Intel version. That's all.
-
The glass screen could be heavy. Then again, LCDs are glass anyway. So, did they remove the plastic protection in front of the LCD, or did they replace it so that there's now glass in front of glass? (Regardless of the reason, the new 15″ MBP weighs 0.04 kg more than the previous 15″ MBP.)
-
No more anti-glare screens. I'm sure somebody will come out with an anti-glare stick-on (I have one on my iPod touch), and that it will be a popular accessory.
-
Not sure about this new entire-trackpad-is-a-button thing. Tap-to-click was nice and quiet. I hope the new trackpads will still allow it as an option.
-
Adapting between DVI and DisplayPort may be a pain.