Re: [BUGS] Bus error in formatting.c NUM_numpart_to_char (9.4.12, 9.6.3, sparc)

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [BUGS] Bus error in formatting.c NUM_numpart_to_char (9.4.12, 9.6.3, sparc)
Дата
Msg-id 24675.1498141318@sss.pgh.pa.us
обсуждение исходный текст
Ответ на [BUGS] Bus error in formatting.c NUM_numpart_to_char (9.4.12, 9.6.3, sparc)  ("Tom Turelinckx" <tom@turelinckx.be>)
Ответы Re: [BUGS] Bus error in formatting.c NUM_numpart_to_char (9.4.12, 9.6.3, sparc)  ("Tom Turelinckx" <tom@turelinckx.be>)
Список pgsql-bugs
"Tom Turelinckx" <tom@turelinckx.be> writes:
> But I need more information / pointers to documentation on how to find and provide the information you need, as I
haveno experience with looking at assembly code. 

The way to get an assembly code file is to substitute -S for -c in the
compile command, and also remove any "-o file" option.  So on my machine,
in an already built PG tree, I check what switches we're using:

$ cd src/backend/utils/adt
$ rm formatting.o
$ make formatting.o
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute
-Wformat-security-fno-strict-aliasing -fwrapv -g -O2 -I../../../../src/include -D_GNU_SOURCE    -c -o formatting.o
formatting.c

Now I copy-and-paste all the switches except -c and -o:

$ gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels
-Wmissing-format-attribute-Wformat-security -fno-strict-aliasing -fwrapv -g -O2 -I../../../../src/include -D_GNU_SOURCE
-Sformatting.c 

Note it's important that -g be one of the switches, else you don't get
line number annotations in the assembly.

Now I have a formatting.s file with contents like

.L275:
.LBE196:
.LBB197:
.LBB193:.loc 1 2320 0leal    -1(%rcx), %edicmpl    $1, %edijbe    .L278.loc 1 2322 0cmpl    $3, %ecx.p2align 4,,2je
.L279
.LVL216:
.L246:.loc 1 2325 0movq    (%rdx), %raxtestq    %rax, %raxje    .L244.loc 1 2331 0leaq    1(%r14), %rdimovq    %r14,
48(%rsp)movq   %rbx, 64(%rsp).loc 1 2325 0xorl    %r10d, %r10d.loc 1 2331 0movq    %rdx, %rbx 

The important part of this for your purposes is the ".loc" annotations,
which indicate the source line number the following code was generated
from.  Notice that's not unusual for the compiler to rearrange code so
that instructions from different lines are interspersed --- here we
can see that lines 2325 and 2331 got mingled together.  So there might
not be only one .loc annotation for the line where the crash is being
reported.  Anyway, find those annotation(s) and send us all the text
for that area and maybe a few dozen lines on either side.
        regards, tom lane


--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

В списке pgsql-bugs по дате отправления:

Предыдущее
От: "Tom Turelinckx"
Дата:
Сообщение: Re: [BUGS] Bus error in formatting.c NUM_numpart_to_char (9.4.12, 9.6.3, sparc)
Следующее
От: "Tom Turelinckx"
Дата:
Сообщение: Re: [BUGS] Bus error in formatting.c NUM_numpart_to_char (9.4.12, 9.6.3, sparc)