Re: [cedet-semantic] semanticdb typecache error
Brought to you by:
zappo
|
From: Vyacheslav G. <yt...@gm...> - 2016-09-25 09:10:38
|
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 <yt...@gm...>
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
>>
>
>
|