In these days when we run almost all test cases in parallel, it's frequently not that easy to tie a "TRAP: ..." message in the log to nearby log messages. (The postmaster's subsequent complaint often helps, but it could be some distance away in the log; and good luck untangling things if more than one Assert failure happens concurrently.) We could add a simple bread crumb trail by including the process's PID in such messages. Any objections?
regards, tom lane