~ubuntu-branches/debian/sid/subversion/sid

« back to all changes in this revision

Viewing changes to subversion/libsvn_subr/win32_crashrpt.c

  • Committer: Package Import Robot
  • Author(s): James McCoy, Peter Samuelson, James McCoy
  • Date: 2014-01-12 19:48:33 UTC
  • mfrom: (0.2.10)
  • Revision ID: package-import@ubuntu.com-20140112194833-w3axfwksn296jn5x
Tags: 1.8.5-1
[ Peter Samuelson ]
* New upstream release.  (Closes: #725787) Rediff patches:
  - Remove apr-abi1 (applied upstream), rename apr-abi2 to apr-abi
  - Remove loosen-sqlite-version-check (shouldn't be needed)
  - Remove java-osgi-metadata (applied upstream)
  - svnmucc prompts for a changelog if none is provided. (Closes: #507430)
  - Remove fix-bdb-version-detection, upstream uses "apu-config --dbm-libs"
  - Remove ruby-test-wc (applied upstream)
  - Fix “svn diff -r N file” when file has svn:mime-type set.
    (Closes: #734163)
  - Support specifying an encoding for mod_dav_svn's environment in which
    hooks are run.  (Closes: #601544)
  - Fix ordering of “svnadmin dump” paths with certain APR versions.
    (Closes: #687291)
  - Provide a better error message when authentication fails with an
    svn+ssh:// URL.  (Closes: #273874)
  - Updated Polish translations.  (Closes: #690815)

[ James McCoy ]
* Remove all traces of libneon, replaced by libserf.
* patches/sqlite_3.8.x_workaround: Upstream fix for wc-queries-test test
  failurse.
* Run configure with --with-apache-libexecdir, which allows removing part of
  patches/rpath.
* Re-enable auth-test as upstream has fixed the problem of picking up
  libraries from the environment rather than the build tree.
  (Closes: #654172)
* Point LD_LIBRARY_PATH at the built auth libraries when running the svn
  command during the build.  (Closes: #678224)
* Add a NEWS entry describing how to configure mod_dav_svn to understand
  UTF-8.  (Closes: #566148)
* Remove ancient transitional package, libsvn-ruby.
* Enable compatibility with Sqlite3 versions back to Wheezy.
* Enable hardening flags.  (Closes: #734918)
* patches/build-fixes: Enable verbose build logs.
* Build against the default ruby version.  (Closes: #722393)

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 * ====================================================================
22
22
 */
23
23
 
 
24
/* prevent "empty compilation unit" warning on e.g. UNIX */
 
25
typedef int win32_crashrpt__dummy;
 
26
 
24
27
#ifdef WIN32
25
28
#ifdef SVN_USE_WIN32_CRASHHANDLER
26
29
 
30
33
#include <direct.h>
31
34
#include <stdio.h>
32
35
#include <stdlib.h>
 
36
#include <time.h>
33
37
 
34
38
#include "svn_version.h"
35
39
 
46
50
 
47
51
#define LOGFILE_PREFIX "svn-crash-log"
48
52
 
 
53
#if defined(_M_IX86)
 
54
#define FORMAT_PTR "0x%08x"
 
55
#elif defined(_M_X64)
 
56
#define FORMAT_PTR "0x%016I64x"
 
57
#endif
 
58
 
49
59
/*** Code. ***/
50
60
 
51
61
/* Convert a wide-character string to utf-8. This function will create a buffer
158
168
      MINIDUMP_MODULE_CALLBACK module = callback_input->Module;
159
169
 
160
170
      char *buf = convert_wbcs_to_utf8(module.FullPath);
161
 
      fprintf(log_file, "0x%08x", module.BaseOfImage);
 
171
      fprintf(log_file, FORMAT_PTR, module.BaseOfImage);
162
172
      fprintf(log_file, "  %s", buf);
163
173
      free(buf);
164
174
 
257
267
  switch(length)
258
268
    {
259
269
      case 1:
260
 
        sprintf(buf, "%x", *(unsigned char *)address);
 
270
        sprintf(buf, "0x%02x", (int)*(unsigned char *)address);
261
271
        break;
262
272
      case 2:
263
 
        sprintf(buf, "%x", *(unsigned short *)address);
 
273
        sprintf(buf, "0x%04x", (int)*(unsigned short *)address);
264
274
        break;
265
275
      case 4:
266
276
        switch(basic_type)
268
278
            case 2:  /* btChar */
269
279
              {
270
280
                if (!IsBadStringPtr(*(PSTR*)address, 32))
271
 
                  sprintf(buf, "\"%.31s\"", *(unsigned long *)address);
 
281
                  sprintf(buf, "\"%.31s\"", *(const char **)address);
272
282
                else
273
 
                  sprintf(buf, "%x", *(unsigned long *)address);
 
283
                  sprintf(buf, FORMAT_PTR, *(DWORD_PTR *)address);
274
284
              }
275
285
            case 6:  /* btInt */
276
286
              sprintf(buf, "%d", *(int *)address);
279
289
              sprintf(buf, "%f", *(float *)address);
280
290
              break;
281
291
            default:
282
 
              sprintf(buf, "%x", *(unsigned long *)address);
 
292
              sprintf(buf, FORMAT_PTR, *(DWORD_PTR *)address);
283
293
              break;
284
294
          }
285
295
        break;
287
297
        if (basic_type == 8) /* btFloat */
288
298
          sprintf(buf, "%lf", *(double *)address);
289
299
        else
290
 
          sprintf(buf, "%I64X", *(unsigned __int64 *)address);
 
300
          sprintf(buf, "0x%016I64X", *(unsigned __int64 *)address);
 
301
        break;
 
302
      default:
 
303
        sprintf(buf, "[unhandled type 0x%08x of length " FORMAT_PTR "]",
 
304
                     basic_type, length);
291
305
        break;
292
306
    }
293
307
}
297
311
static void
298
312
format_value(char *value_str, DWORD64 mod_base, DWORD type, void *value_addr)
299
313
{
300
 
  DWORD tag;
 
314
  DWORD tag = 0;
301
315
  int ptr = 0;
302
316
  HANDLE proc = GetCurrentProcess();
303
317
 
325
339
              LocalFree(type_name_wbcs);
326
340
 
327
341
              if (ptr == 0)
328
 
                sprintf(value_str, "(%s) 0x%08x",
329
 
                        type_name, (DWORD *)value_addr);
 
342
                sprintf(value_str, "(%s) " FORMAT_PTR,
 
343
                        type_name, (DWORD_PTR *)value_addr);
330
344
              else if (ptr == 1)
331
 
                sprintf(value_str, "(%s *) 0x%08x",
332
 
                        type_name, *(DWORD *)value_addr);
 
345
                sprintf(value_str, "(%s *) " FORMAT_PTR,
 
346
                        type_name, *(DWORD_PTR *)value_addr);
333
347
              else
334
 
                sprintf(value_str, "(%s **) 0x%08x",
335
 
                        type_name, (DWORD *)value_addr);
 
348
                sprintf(value_str, "(%s **) " FORMAT_PTR,
 
349
                        type_name, *(DWORD_PTR *)value_addr);
336
350
 
337
351
              free(type_name);
338
352
            }
 
353
          else
 
354
            sprintf(value_str, "[no symbol tag]");
339
355
        }
340
356
        break;
341
357
      case 16: /* SymTagBaseType */
347
363
          /* print a char * as a string */
348
364
          if (ptr == 1 && length == 1)
349
365
            {
350
 
              sprintf(value_str, "0x%08x \"%s\"",
351
 
                      *(DWORD *)value_addr, (char *)*(DWORD*)value_addr);
352
 
              break;
 
366
              sprintf(value_str, FORMAT_PTR " \"%s\"",
 
367
                      *(DWORD_PTR *)value_addr, *(const char **)value_addr);
353
368
            }
354
 
          if (ptr >= 1)
 
369
          else if (ptr >= 1)
355
370
            {
356
 
              sprintf(value_str, "0x%08x", *(DWORD *)value_addr);
357
 
              break;
 
371
              sprintf(value_str, FORMAT_PTR, *(DWORD_PTR *)value_addr);
358
372
            }
359
 
          if (SymGetTypeInfo_(proc, mod_base, type, TI_GET_BASETYPE, &bt))
 
373
          else if (SymGetTypeInfo_(proc, mod_base, type, TI_GET_BASETYPE, &bt))
360
374
            {
361
375
              format_basic_type(value_str, bt, length, value_addr);
362
 
              break;
363
376
            }
364
377
        }
365
378
        break;
366
379
      case 12: /* SymTagEnum */
367
 
          sprintf(value_str, "%d", *(DWORD *)value_addr);
 
380
          sprintf(value_str, "%d", *(DWORD_PTR *)value_addr);
368
381
          break;
369
382
      case 13: /* SymTagFunctionType */
370
 
          sprintf(value_str, "0x%08x", *(DWORD *)value_addr);
371
 
          break;
372
 
      default: break;
 
383
          sprintf(value_str, FORMAT_PTR, *(DWORD_PTR *)value_addr);
 
384
          break;
 
385
      default:
 
386
          sprintf(value_str, "[unhandled tag: %d]", tag);
 
387
          break;
373
388
    }
374
389
}
375
390
 
412
427
 
413
428
      format_value(value_str, sym_info->ModBase, sym_info->TypeIndex,
414
429
                   (void *)var_data);
415
 
      fprintf(log_file, "%s=%s", sym_info->Name, value_str);
 
430
      fprintf(log_file, "%.*s=%s", (int)sym_info->NameLen, sym_info->Name,
 
431
              value_str);
416
432
    }
417
 
  if (log_params == FALSE && sym_info->Flags & SYMFLAG_LOCAL)
 
433
  if (!log_params && sym_info->Flags & SYMFLAG_LOCAL)
418
434
    {
419
435
      format_value(value_str, sym_info->ModBase, sym_info->TypeIndex,
420
436
                   (void *)var_data);
421
 
      fprintf(log_file, "        %s = %s\n", sym_info->Name, value_str);
 
437
      fprintf(log_file, "        %.*s = %s\n", (int)sym_info->NameLen,
 
438
              sym_info->Name, value_str);
422
439
    }
423
440
 
424
441
  return TRUE;
451
468
  if (SymFromAddr_(proc, stack_frame.AddrPC.Offset, &func_disp, pIHS))
452
469
    {
453
470
      fprintf(log_file,
454
 
                    "#%d  0x%08I64x in %.200s(",
455
 
                    nr_of_frame, stack_frame.AddrPC.Offset, pIHS->Name);
 
471
                    "#%d  0x%08I64x in %.*s(",
 
472
                    nr_of_frame, stack_frame.AddrPC.Offset,
 
473
                    pIHS->NameLen > 200 ? 200 : (int)pIHS->NameLen,
 
474
                    pIHS->Name);
456
475
 
457
476
      /* restrict symbol enumeration to this frame only */
458
477
      ih_stack_frame.InstructionOffset = stack_frame.AddrPC.Offset;
724
743
    return EXCEPTION_CONTINUE_SEARCH;
725
744
 
726
745
  /* ... or if we can't create the log files ... */
727
 
  if (get_temp_filename(dmp_filename, LOGFILE_PREFIX, "dmp") == FALSE ||
728
 
      get_temp_filename(log_filename, LOGFILE_PREFIX, "log") == FALSE)
 
746
  if (!get_temp_filename(dmp_filename, LOGFILE_PREFIX, "dmp") ||
 
747
      !get_temp_filename(log_filename, LOGFILE_PREFIX, "log"))
729
748
    return EXCEPTION_CONTINUE_SEARCH;
730
749
 
731
750
  /* If we can't load a recent version of the dbghelp.dll, pass on this
732
751
     exception */
733
 
  if (load_dbghelp_dll() == FALSE)
 
752
  if (!load_dbghelp_dll())
734
753
    return EXCEPTION_CONTINUE_SEARCH;
735
754
 
736
755
  /* open log file */