Re: semanticdb typecache error
Vyacheslav Gonakhchyan <[email protected]> Sun, 25 Sep 2016 12:10:31 +0300
| Newsgroups | gmane.emacs.semantic |
|---|---|
| Message-ID | <CAJ654bvHc2vW2ywySZqN8co99Wube03a8x9yxeyVSR=Y2UEvnQ@mail.gmail.com> |
--===============8558602006734713725==
Content-Type: multipart/alternative; boundary=001a114216fe22025b053d51625e
--001a114216fe22025b053d51625e
Content-Type: text/plain; charset=UTF-8
Found a minimal way to reliably reproduce.
1. Create file ~/tmp/emacstest/a.h
typedef struct A {
int a;
} A;
typedef A B;
2. Create file ~/tmp/emacstest/a.c
It includes one existing header and one missing header. And most
importantly stdlib.h.
#include <stdlib.h>
#include "a.h"
#include "b.h"
int main(int numArgs, char **args) {
A a;
a.a = 1;
A a1;
a1.a = 5;
B b;
b.a = 3;
return 0;
}
3. Close emacs. Clear semanticdb cache ~/.emacs.d/semanticdb/
4. Open Emacs. Visit ~/tmp/emacstest/a.h (it's important to visit header
first)
5. Visit ~/tmp/emacstest/a.c It does some parsing which probably depends on
my config. So I included my cedet config.
6. Execute semantic-debug-idle-work-function
Achieved Result: Debugger entered--Lisp error: (wrong-type-argument stringp
(((0) (0) "div_t"))
Sometimes emacs segfaults! I don't have debug symbols so no stacktrace.
This is from stdlib.h!
Cedet config:
;;CEDET
(load-file "/usr/share/emacs/site-lisp/cedet/cedet-devel-load.el")
(semantic-load-enable-gaudy-code-helpers)
(global-ede-mode 1)
;;(global-srecode-minor-mode 1) conflict?
(defvar ede-locate-setup-options '(ede-locate-global ede-locate-base))
(semanticdb-enable-gnu-global-databases 'c-mode)
;;project culling
(defvar proj-culling "/home/pusheax/proj/culling")
(defvar semantic-lex-c-preprocessor-symbol-file '())
(semantic-add-system-include "/usr/include")
(add-to-list 'semantic-lex-c-preprocessor-symbol-file (concat proj-culling
"/include/geom.h") (concat proj-culling "/include/list.h") (concat
proj-culling "/include/octree.h"))
(add-hook 'c-mode-hook (lambda ()
(setq flycheck-clang-include-path
(list (concat proj-culling "/include/")))))
;;=Speedbar=
(defvar speedbar-sort-tags t)
;;flycheck
(global-flycheck-mode)
;;GDB many windows
(defvar gdb-many-windows t)
(defvar gdb-delete-out-of-scope nil)
(defvar gdb-show-main t)
On Sun, Sep 25, 2016 at 10:57 AM, Vyacheslav Gonakhchyan <[email protected]>
wrote:
> Hi. Updated emacs to 25.1. Cleared semanticdb dir. Still getting typecache
> errors.
>
> To reproduce save this file in any dir. Run semantic-debug-idle-work-function
> at least two times. And you will get something like (wrong-type-argument
> stringp (((0) (0) "Bool"))).
>
> #include <check.h>
> #include <stdlib.h>
> #include "platform.h"
> #include "bb.c"
> #include "bvh.c"
> #include "error.c"
> #include "list.c"
> #include "geom.c"
> #include "octree.c"
> #include "frustum.c"
> #include "my_math.c"
> #include "check_suite.c"
>
> START_TEST(bvhCreateOctree) {
> //create instances array
> const s32 numInstances = 2;
> const r32 half = 1/2.0f;
> AssetInstance i[numInstances];
> BoundingBox bb0 = { {half, half, 0}, {half, half, 0} };
> BoundingBox bb1 = { {1+half, 1+half, 0}, {half, half, 0} };
> i[0].bb = bb0;
> i[1].bb = bb1;
>
> //create octree and add instances
> BoundingBox sceneBB = { {1,1,0}, {1,1,0} };
> r32 minLeafSize = octr_get_min_leaf_size(&sceneBB, i, numInstances,
> 1);
> printf("minLeafSize = %.2f\n", minLeafSize);
> OctreeNode *octrRoot = octr_create_node(&sceneBB, minLeafSize);
> octr_add_item(octrRoot, i, minLeafSize, 0);
> octr_add_item(octrRoot, i+1, minLeafSize, 0);
>
> //sort by left edge
> bvh_sort_instances(numInstances, i, Axis_X);
>
> //create bvh
> BV r;
> r.bb = sceneBB;
> bvh_create(&r, numInstances, i, octrRoot, Axis_X);
>
> //check left has one inst, right has one inst
> ck_assert_int_eq(list_get_num_items(r.left->instances), 1);
> ck_assert_int_eq(list_get_num_items(r.right->instances), 1);
> }
> END_TEST
>
> int main(int numArgs, char **args) {
> return run_suite(create_suite("bvh", "core", 1, bvhCreateOctree));
> }
>
> Vyacheslav
>
>
>
> On 14.09.2016 02:26, Eric Ludlam wrote:
>
>> On 09/03/2016 03:56 AM, Vyacheslav Gonakhchyan wrote:
>>
>>> typedef PRInt64 PRTime;
>>>
>>
>> I tried this in a short .hpp file in /tmp, and looked in the cache file.
>> It looks like it saved correctly for me. Not sure what might transform it
>> into the bad case.
>>
>> The error case you displayed:
>>
>> > ((((0) (0) "PRTime")) type (:superclasses ("PRInt64" type (:type
>> "class") nil nil) :type "typedef") nil [3439 3462])
>>
>> is vaguely similar to how the preprocessor handles some named symbols,
>> though that system usually expands correctly, unless you have something
>> special.
>>
>> It is also possible there is a nugget of code somewhere editing the raw
>> table structures without doing a copy of the tags. Something like this has
>> occasionally popped up, but no one was ever able to reproduce after
>> flushing the cache file. There is a small bit in the 'save' section that
>> identifies one bad case in preprocessor table and refuses to save. It might
>> be possible to do something similar here, but then your save file would
>> just have missing data, instead of bad data.
>>
>> Can you reproduce?
>>
>> You can run 'semantic-sanity-check' in a buffer to make sure that buffer
>> is ok.
>>
>> If you load semantic/db-debug.el, you can run
>> `semanticdb-database-sanity-check' to see if everything is in order. If
>> this function successfully flags your error (I don't recall the full set of
>> checks it does) and if one or the other isn't to slow, we could augment
>> some operation to identify when the problem shows up. Otherwise, not sure
>> how else I can help.
>>
>> Eric
>>
>
>
--001a114216fe22025b053d51625e
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div><div><div><div><div><div><div><div><div>Found a minim=
al way to reliably reproduce.<br></div>1. Create file ~/tmp/emacstest/a.h<b=
r><br>typedef struct A {<br>=C2=A0=C2=A0=C2=A0 int a;<br>} A;<br><br>typede=
f A B;<br><br></div>2. Create file ~/tmp/emacstest/a.c<br></div><div>It inc=
ludes one existing header and one missing header. And most importantly stdl=
ib.h.<br></div><div><br>#include <stdlib.h><br>#include "a.h&quo=
t;<br>#include "b.h"<br><br>int main(int numArgs, char **args) {<=
br>=C2=A0=C2=A0=C2=A0 A a;<br>=C2=A0=C2=A0=C2=A0 a.a =3D 1;<br><br>=C2=A0=
=C2=A0=C2=A0 A a1;<br>=C2=A0=C2=A0=C2=A0 a1.a =3D 5;<br><br>=C2=A0=C2=A0=C2=
=A0 B b;<br>=C2=A0=C2=A0=C2=A0 b.a =3D 3;<br>=C2=A0=C2=A0=C2=A0 <br>=C2=A0=
=C2=A0=C2=A0 return 0;<br>}<br><br></div>3. Close emacs. Clear semanticdb c=
ache ~/.emacs.d/semanticdb/<br></div>4. Open Emacs. Visit ~/tmp/emacstest/a=
.h (it's important to visit header first)<br></div>5. Visit ~/tmp/emacs=
test/a.c It does some parsing which probably depends on my config. So I inc=
luded my cedet config.<br></div>6. Execute semantic-debug-idle-work-funct<w=
br>ion<br></div>Achieved Result: Debugger entered--Lisp error: (wrong-type-=
argument stringp (((0) (0) "div_t"))<br></div><div>Sometimes emac=
s segfaults! I don't have debug symbols so no stacktrace.<br></div>This=
is from stdlib.h! <br><br></div>Cedet config:<br>;;CEDET<br>(load-file &qu=
ot;/usr/share/emacs/site-lisp/cedet/cedet-devel-load.el")<br>(semantic=
-load-enable-gaudy-code-helpers)<br>(global-ede-mode 1)<br>;;(global-srecod=
e-minor-mode 1) conflict?<br>(defvar ede-locate-setup-options '(ede-loc=
ate-global ede-locate-base))<br>(semanticdb-enable-gnu-global-databases =
9;c-mode)<br><br>;;project culling<br>(defvar proj-culling "/home/push=
eax/proj/culling")<br>(defvar semantic-lex-c-preprocessor-symbol-file =
'())<br>(semantic-add-system-include "/usr/include")<br>(add-=
to-list 'semantic-lex-c-preprocessor-symbol-file (concat proj-culling &=
quot;/include/geom.h") (concat proj-culling "/include/list.h"=
;) (concat proj-culling "/include/octree.h"))<br><br>(add-hook &#=
39;c-mode-hook (lambda ()<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=
=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=
=A0(setq flycheck-clang-include-path<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=
=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=
=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 (list (concat proj-culling "/in=
clude/")))))<br><br>;;=3DSpeedbar=3D<br>(defvar speedbar-sort-tags t)<=
br><br>;;flycheck<br>(global-flycheck-mode)<br><br>;;GDB many windows<br>(d=
efvar gdb-many-windows t)<br>(defvar gdb-delete-out-of-scope nil)<br>(defva=
r gdb-show-main t)<br></div><div class=3D"gmail_extra"><br><div class=3D"gm=
ail_quote">On Sun, Sep 25, 2016 at 10:57 AM, Vyacheslav Gonakhchyan <span d=
ir=3D"ltr"><<a href=3D"mailto:[email protected]" target=3D"_blank">ytrif=
[email protected]</a>></span> wrote:<br><blockquote class=3D"gmail_quote" sty=
le=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi. Up=
dated emacs to 25.1. Cleared semanticdb dir. Still getting typecache errors=
.<br>
<br>
To reproduce save this file in any dir. Run semantic-debug-idle-work-funct<=
wbr>ion at least two times. And you will get something like (wrong-type-arg=
ument stringp (((0) (0) "Bool"))).<br>
<br>
#include <check.h><br>
#include <stdlib.h><br>
#include "platform.h"<br>
#include "bb.c"<br>
#include "bvh.c"<br>
#include "error.c"<br>
#include "list.c"<br>
#include "geom.c"<br>
#include "octree.c"<br>
#include "frustum.c"<br>
#include "my_math.c"<br>
#include "check_suite.c"<br>
<br>
START_TEST(bvhCreateOctree) {<br>
=C2=A0 =C2=A0 //create instances array<br>
=C2=A0 =C2=A0 const s32 numInstances =3D 2;<br>
=C2=A0 =C2=A0 const r32 half =3D 1/2.0f;<br>
=C2=A0 =C2=A0 AssetInstance i[numInstances];<br>
=C2=A0 =C2=A0 BoundingBox bb0 =3D { {half,=C2=A0 =C2=A0half,=C2=A0 =C2=A00}=
, {half, half, 0} };<br>
=C2=A0 =C2=A0 BoundingBox bb1 =3D { {1+half, 1+half, 0}, {half, half, 0} };=
<br>
=C2=A0 =C2=A0 i[0].bb =3D bb0;<br>
=C2=A0 =C2=A0 i[1].bb =3D bb1;<br>
<br>
=C2=A0 =C2=A0 //create octree and add instances<br>
=C2=A0 =C2=A0 BoundingBox sceneBB =3D { {1,1,0}, {1,1,0} };<br>
=C2=A0 =C2=A0 r32 minLeafSize =3D octr_get_min_leaf_size(&sceneB<wbr>B,=
i, numInstances, 1);<br>
=C2=A0 =C2=A0 printf("minLeafSize =3D %.2f\n", minLeafSize);<br>
=C2=A0 =C2=A0 OctreeNode *octrRoot =3D octr_create_node(&sceneBB, minLe=
afSize);<br>
=C2=A0 =C2=A0 octr_add_item(octrRoot, i, minLeafSize, 0);<br>
=C2=A0 =C2=A0 octr_add_item(octrRoot, i+1, minLeafSize, 0);<br>
<br>
=C2=A0 =C2=A0 //sort by left edge<br>
=C2=A0 =C2=A0 bvh_sort_instances(numInstance<wbr>s, i, Axis_X);<br>
<br>
=C2=A0 =C2=A0 //create bvh<br>
=C2=A0 =C2=A0 BV r;<br>
=C2=A0 =C2=A0 <a href=3D"http://r.bb" rel=3D"noreferrer" target=3D"_blank">=
r.bb</a> =3D sceneBB;<br>
=C2=A0 =C2=A0 bvh_create(&r, numInstances, i, octrRoot, Axis_X);<br>
<br>
=C2=A0 =C2=A0 //check left has one inst, right has one inst<br>
=C2=A0 =C2=A0 ck_assert_int_eq(list_get_num_<wbr>items(r.left->instances=
), 1);<br>
=C2=A0 =C2=A0 ck_assert_int_eq(list_get_num_<wbr>items(r.right->instance=
s), 1);<br>
}<br>
END_TEST<br>
<br>
int main(int numArgs, char **args) {<br>
=C2=A0 =C2=A0 return run_suite(create_suite("bvh", "core&quo=
t;, 1, bvhCreateOctree));<br>
}<span class=3D"HOEnZb"><font color=3D"#888888"><br>
<br>
Vyacheslav</font></span><div class=3D"HOEnZb"><div class=3D"h5"><br>
<br>
<br>
On 14.09.2016 02:26, Eric Ludlam wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">
On 09/03/2016 03:56 AM, Vyacheslav Gonakhchyan wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">
typedef PRInt64 PRTime;<br>
</blockquote>
<br>
I tried this in a short .hpp file in /tmp, and looked in the cache file.=C2=
=A0 It looks like it saved correctly for me.=C2=A0 Not sure what might tran=
sform it into the bad case.<br>
<br>
The error case you displayed:<br>
<br>
> ((((0) (0) "PRTime")) type (:superclasses ("PRInt64&quo=
t; type (:type<br>
"class") nil nil) :type "typedef") nil [3439 3462])<br>
<br>
is vaguely similar to how the preprocessor handles some named symbols, thou=
gh that system usually expands correctly, unless you have something special=
.<br>
<br>
It is also possible there is a nugget of code somewhere editing the raw tab=
le structures without doing a copy of the tags. Something like this has occ=
asionally popped up, but no one was ever able to reproduce after flushing t=
he cache file.=C2=A0 There is a small bit in the 'save' section tha=
t identifies one bad case in preprocessor table and refuses to save. It mig=
ht be possible to do something similar here, but then your save file would =
just have missing data, instead of bad data.<br>
<br>
Can you reproduce?<br>
<br>
You can run 'semantic-sanity-check' in a buffer to make sure that b=
uffer is ok.<br>
<br>
If you load semantic/db-debug.el, you can run `semanticdb-database-sanity-c=
h<wbr>eck' to see if everything is in order.=C2=A0 If this function suc=
cessfully flags your error (I don't recall the full set of checks it do=
es) and if one or the other isn't to slow, we could augment some operat=
ion to identify when the problem shows up. Otherwise, not sure how else I c=
an help.<br>
<br>
Eric<br>
</blockquote>
<br>
</div></div></blockquote></div><br></div>
--001a114216fe22025b053d51625e--
--===============8558602006734713725==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
------------------------------------------------------------------------------
--===============8558602006734713725==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
cedet-semantic mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cedet-semantic
--===============8558602006734713725==--