On 11/15/19 5:35 PM, Mark Wielaard wrote: > IMHO it would be best to avoid any global state from the start. Since > we haven't released this api yet we can make it so that it is easy to > have state per request object.
+1 > In the gdb thread > https://sourceware.org/ml/gdb-patches/2019-11/msg00118.html Simon > Marchi suggested something like: > > debuginfod_client *client = debuginfod_create_client (); > debuginfod_set_progressfn (client, my_progress_cb); > > With debuginfod_client * being an opaque pointer. I think that is a > good idea. It also matches what libelf (with Elf *) and libdw (with > Dwarf *) do. It also makes it easy to add other kinds of state to > client requests later. > We were discussing this on the #gdb channel on IRC, and I think Simon's idea is the best one so far. It reminded me of libabc, http://0pointer.de/blog/projects/libabc.html which promotes that client pointer mechanism. I recommend reading this: https://git.kernel.org/pub/scm/linux/kernel/git/kay/libabc.git/plain/README Notably, the "Zero global state" part. Thanks, Pedro Alves