-cat <<EOF > count-files.gdb
-set breakpoint pending on
-set logging file count-files-gdb.log
-set logging on
-break count_files
-commands
-shell cp /dev/null ${MAIL_DIR}/.notmuch/xapian/postlist.*
-continue
-end
-run
+make_shim qsm-shim<<EOF
+#include <notmuch-test.h>
+
+WRAP_DLFUNC (notmuch_status_t, notmuch_query_search_messages, (notmuch_query_t *query, notmuch_messages_t **messages))
+
+ /* XXX WARNING THIS CORRUPTS THE DATABASE */
+ int fd = open ("target_postlist", O_WRONLY|O_TRUNC);
+ if (fd < 0)
+ exit (8);
+ close (fd);
+
+ return notmuch_query_search_messages_orig(query, messages);
+}