pastebin - collaborative debugging tool
rovema.kpaste.net RSS


drmemory mingw test1
Posted by Anonymous on Sat 28th Oct 2023 06:05
raw | new post
modification of post by Anonymous (view diff)

  1. /*
  2.  * DrMemory test x1.c
  3.  *
  4.  * Compile with:
  5.  * $ x86_64-w64-mingw32-gcc -g -gdwarf-2 x1.c
  6.  *
  7.  * Test with:
  8.  * $ drmemory -batch -check_uninitialized -gen_suppress_syms -preload_symbols -- ./a
  9.  */
  10. #include <stdlib.h>
  11. #include <string.h>
  12. #include <stdio.h>
  13.  
  14. const int ar[] = { 5, 4, 3, 2, 1, 0 };
  15.  
  16. int main(int ac, char *av[])
  17. {
  18.         puts("#start");
  19.        
  20.         int *ar2 = malloc(sizeof(int)*6);
  21.         memcpy(ar2, ar, sizeof(int)*6);
  22.        
  23.         int i;
  24.         int j;
  25.         for (i=0 ; i < 16 ; i++) {
  26.                 j = ar2[i];
  27.  
  28.                 printf("i=");
  29.                 printf("%d\n", j);
  30.                 fflush(stdout);
  31.         }
  32.         puts("#end");
  33.         return 0;
  34. }
  35.  
  36. /*
  37. output:
  38. $ drmemory -batch -check_uninitialized -gen_suppress_syms -preload_symbols -- ./a
  39. ~~Dr.M~~ Dr. Memory version 2.6.0
  40. ~~Dr.M~~ Running "./a"
  41. ~~Dr.M~~ Using system call file C:\Users\roland.mainz\AppData\Roaming\Dr. Memory\symcache\syscalls_x64.txt
  42. ~~Dr.M~~
  43. ~~Dr.M~~ Error #1: UNADDRESSABLE ACCESS beyond top of stack: reading 0x000000a0191ff7e0-0x000000a0191ff7e8 8 byte(s)
  44. ~~Dr.M~~ # 0 .text                                   [/home/roland.mainz/work/drmemory_test1/x1.c:25]
  45. ~~Dr.M~~ # 1 _pei386_runtime_relocator               [/home/roland.mainz/work/drmemory_test1/x1.c:25]
  46. ~~Dr.M~~ # 2 __tmainCRTStartup
  47. ~~Dr.M~~ # 3 .l_start
  48. ~~Dr.M~~ # 4 KERNEL32.dll!BaseThreadInitThunk
  49. ~~Dr.M~~ Note: @0:00:00.222 in thread 16552
  50. ~~Dr.M~~ Note: 0x000000a0191ff7e0 refers to 824 byte(s) beyond the top of the stack 0x000000a0191ffb18
  51. ~~Dr.M~~ Note: instruction: or     $0x0000000000000000 (%rcx) -> (%rcx)
  52. #start
  53. i=~~Dr.M~~
  54. ~~Dr.M~~ Error #2: UNADDRESSABLE ACCESS beyond top of stack: reading 0x000000a0191ff950-0x000000a0191ff958 8 byte(s)
  55. ~~Dr.M~~ # 0 .text                              [/home/roland.mainz/work/drmemory_test1/x1.c:25]
  56. ~~Dr.M~~ # 1 __pformat_int.isra.0               [/home/roland.mainz/work/drmemory_test1/x1.c:25]
  57. ~~Dr.M~~ # 2 __mingw_pformat                    [/home/roland.mainz/work/drmemory_test1/x1.c:25]
  58. ~~Dr.M~~ # 3 __mingw_vfprintf                   [/home/roland.mainz/work/drmemory_test1/x1.c:25]
  59. ~~Dr.M~~ # 4 printf                             [/usr/x86_64-w64-mingw32/sys-root/mingw/include/stdio.h:375]
  60. ~~Dr.M~~ # 5 main                               [/home/roland.mainz/work/drmemory_test1/x1.c:20]
  61. ~~Dr.M~~ Note: @0:00:00.263 in thread 16552
  62. ~~Dr.M~~ Note: 0x000000a0191ff950 refers to 8 byte(s) beyond the top of the stack 0x000000a0191ff958
  63. ~~Dr.M~~ Note: instruction: or     $0x0000000000000000 (%rcx) -> (%rcx)
  64. 5
  65. i=4
  66. i=3
  67. i=2
  68. i=1
  69. i=0
  70. ~~Dr.M~~
  71. ~~Dr.M~~ Error #3: UNADDRESSABLE ACCESS beyond heap bounds: reading 0x00000294074b1298-0x00000294074b129c 4 byte(s)
  72. ~~Dr.M~~ # 0 main               [/home/roland.mainz/work/drmemory_test1/x1.c:17]
  73. ~~Dr.M~~ Note: @0:00:00.284 in thread 16552
  74. ~~Dr.M~~ Note: refers to 0 byte(s) beyond last valid byte in prior malloc
  75. ~~Dr.M~~ Note: prev lower malloc:  0x00000294074b1280-0x00000294074b1298
  76. ~~Dr.M~~ Note: instruction: mov    (%rax) -> %eax
  77. i=0
  78. i=0
  79. i=0
  80. i=0
  81. i=0
  82. i=0
  83. i=0
  84. i=0
  85. i=0
  86. i=0
  87. #end
  88. ~~Dr.M~~
  89. ~~Dr.M~~ Error #4: LEAK 24 direct bytes 0x00000294074b1280-0x00000294074b1298 + 0 indirect bytes
  90. ~~Dr.M~~ # 0 replace_malloc               [D:\a\drmemory\drmemory\common\alloc_replace.c:2580]
  91. ~~Dr.M~~ # 1 main                         [/home/roland.mainz/work/drmemory_test1/x1.c:11]
  92. ~~Dr.M~~
  93. ~~Dr.M~~ ERRORS FOUND:
  94. ~~Dr.M~~       3 unique,    44 total unaddressable access(es)
  95. ~~Dr.M~~       0 unique,     0 total uninitialized access(es)
  96. ~~Dr.M~~       0 unique,     0 total invalid heap argument(s)
  97. ~~Dr.M~~       0 unique,     0 total GDI usage error(s)
  98. ~~Dr.M~~       0 unique,     0 total handle leak(s)
  99. ~~Dr.M~~       0 unique,     0 total warning(s)
  100. ~~Dr.M~~       1 unique,     1 total,     24 byte(s) of leak(s)
  101. ~~Dr.M~~       0 unique,     0 total,      0 byte(s) of possible leak(s)
  102. ~~Dr.M~~ ERRORS IGNORED:
  103. ~~Dr.M~~       4 unique,     4 total,   4136 byte(s) of still-reachable allocation(s)
  104. ~~Dr.M~~          (re-run with "-show_reachable" for details)
  105. ~~Dr.M~~ Details: C:\Users\roland.mainz\AppData\Roaming\Dr. Memory\DrMemory-a.exe.15568.000\results.txt
  106. */

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at