target: fix profiler output on Windows

Open output file in binary mode to disable EOL
conversion on Windows (and sometimes cygwin depending
on installation settings and path).

Change-Id: I38276dd1af011ce5781b0264b7cbb08c32a1a2ad
Signed-off-by: Richard Allen <rsaxvc@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8278
Reviewed-by: Karl Palsson <karlp@tweak.au>
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
Richard Allen 2024-05-15 12:29:05 -05:00 committed by Antonio Borneo
parent ff22f78d46
commit 5cb184a732
1 changed files with 1 additions and 1 deletions

View File

@ -4209,7 +4209,7 @@ static void write_gmon(uint32_t *samples, uint32_t sample_num, const char *filen
uint32_t start_address, uint32_t end_address, struct target *target, uint32_t duration_ms)
{
uint32_t i;
FILE *f = fopen(filename, "w");
FILE *f = fopen(filename, "wb");
if (!f)
return;
write_string(f, "gmon");