Another simpler option would be to open up a new file in the log directory something like "debug_dump.<pid>.txt" and print whatever you want there. Then print out a reasonable size log entry saying "Debug dump output to file 'debug_dump.<pid>.txt'". You could provide a function that reads such files out of the log directory or just document how to access them using the pg_read_file().
It's not perfect but it's got most of the advantages of communicating with the requesting process without the complexities of a DSM segment and it's a bit more flexible too. Users can have automated monitoring tools watch for dumps for example. And regular tools can be used to back up and clean out old files.