On 1/11/22 16:13, Andres Freund wrote: > Hi, > > On 2022-01-11 12:01:42 -0500, Andrew Dunstan wrote: >> On 1/11/22 02:51, Andres Freund wrote: >>> It'd be a bit of a fight with cdb's awfully documented and quirky >>> scripting [1], but the best solution would probably be to just use an >>> environment variable from the target process to determine the dump >>> location. Then each buildfarm config could set a BF_BACKTRACE_LOCATION >>> variable or such... >>> >>> [1] So there's !envvar. But that yields a string like >>> BF_BACKTRACE_LOCATION = value of environment variable when set to an >>> alias. And I haven't found an easy way to get rid of the "variablename >>> = ". There is .foreach /pS [2] which could be used to skip over the >>> varname =, but that then splits on all whitespaces. Gah. >>> >>> [2] >>> https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/-foreach >>> >> Ugly as heck. > Indeed. I think I figured it out: > > 0:000> !envvar frak > frak = C:\Program Files\Application Verifier\ > 0:000> ad /q path; .foreach /pS 2 (component {!envvar frak}){ .if > (${/d:path}) {aS ${/v:path} ${/f:path} ${component}} .else {aS ${/v:path} > ${component}}}; .block {.echo ${path}} > C:\Program Files\Application Verifier\ > > I mean, no explanation needed, right? > > >> But in theory these animals could be running in parallel, and in theory >> each animal could have more than one branch being run concurrently. In >> fact locking them against each other can be difficult/impossible. > The environment variable solution directing dumps for each animal / branch to > different directories should take care of that, right? > > > Do you have a preference where a script file implementing the necessary > cdb.exe commands would reside? It's getting too long to comfortably implement > it inside the registry setting itself... That script would be used by all > branches, rather than be branch specific.
Well, the buildfarm code sets up a file for gdb in the branch's pgsql.build: my $cmdfile = "./gdbcmd"; my $handle; open($handle, '>', $cmdfile) || die "opening $cmdfile: $!"; print $handle "bt\n"; print $handle 'p $_siginfo', "\n"; close($handle); my @trace = ("\n\n"); foreach my $core (@cores) { my @onetrace = run_log("gdb -x $cmdfile --batch $bindir/postgres $core"); push(@trace, "$log_file_marker stack trace: $core $log_file_marker\n", @onetrace); } So by analogy we could do something similar for the Windows debugger. Or we could pick up a file from the repo if we wanted to commit it in src/tools somewhere. cheers andrew -- Andrew Dunstan EDB: https://www.enterprisedb.com