view user/anatofuz/note/2021/01/23.md @ 31:38ca0355d32c

backup 2021-01-24
author autobackup
date Sun, 24 Jan 2021 00:10:03 +0900
parents
children
line wrap: on
line source

```shell
(gdb) p phils0
$1 = (Phils *) 0x7fff2f7f1d60
(gdb) p phils0->phils
$2 = (union Data *) 0x7fff2f7f1db0
(gdb) p (struct PhilsImpl*)phils0->phils
$3 = (struct PhilsImpl *) 0x7fff2f7f1db0
(gdb) p *(struct PhilsImpl*)phils0->phils
$4 = {self = 0, Leftfork = 0x7fff2f7f1b50, Rightfork = 0x7fff2f7f1acc, next = C_checkAndSetAtomicReference}
```


```c
(gdb) p phils0
$1 = (Phils *) 0x7fff2f7f1d60
(gdb) p phils0->phils
$2 = (union Data *) 0x7fff2f7f1db0
(gdb) p (struct PhilsImpl*)phils0->phils
$3 = (struct PhilsImpl *) 0x7fff2f7f1db0
(gdb) p *(struct PhilsImpl*)phils0->phils
$4 = {self = 0, Leftfork = 0x7fff2f7f1b50, Rightfork = 0x7fff2f7f1acc, next = C_checkAndSetAtomicReference}
(gdb) n
60          Phils* phils4 = createPhilsImpl(context,4,fork4,fork0); // model checking : phils4
(gdb) n
63                          context->task = NEW(struct Context);
(gdb) n
64                          initContext(context->task);
(gdb) n
65                          context->task->next = phils0->thinking;
(gdb) n
66                          context->task->idgCount = 0;
(gdb) n
67                          context->task->idg = context->task->dataNum;
(gdb) n
68                          context->task->maxIdg = context->task->idg + 0;
(gdb) n
69                          context->task->odg = context->task->maxIdg;
(gdb) n
70                          context->task->maxOdg = context->task->odg + 0;
(gdb) n
71          GET_META(phils0)->wait = createSynchronizedQueue(context);
(gdb) n
72          GeareTaskData(context, Phils) = (union Data*)phils0;
(gdb) n
73          Gearef(context->task, Phils)->phils = (union Data*) phils0;
(gdb) n
74          Gearef(context->task, Phils)->next = C_exit_code;
(gdb) n
75                          element = &ALLOCATE(context, Element)->Element;
(gdb) n
76                          element->data = (union Data*)context->task;
(gdb) n
77                          element->next = context->taskList;
(gdb) p context->task[Phils]
A syntax error in expression, near `]'.
(gdb) p context->task[D_Phils]
$5 = {next = C_checkAndSetAtomicReference, worker = 0x0, taskManager = 0x0, codeNum = 0, code = 0x0, data = 0x0, metaDataStart = 0x0, metaData = 0x0, heapStart = 0x0,
  heap = 0x0, heapLimit = 0, dataNum = 0, idgCount = 0, idg = 0, maxIdg = 0, odg = 0, maxOdg = 0, gpu = 0, task = 0x0, taskList = 0x0, iterate = 0, iterator = 0x0}
(gdb) p context->task->data[D_Phils]
$6 = (union Data *) 0x7fff2f7f1d60
(gdb) p context->task->data[D_Phils]->phils
There is no member named phils.
(gdb) p context->task->data[D_Phils]
$7 = (union Data *) 0x7fff2f7f1d60
(gdb) p (struct Phils*)context->task->data[D_Phils]
$8 = (struct Phils *) 0x7fff2f7f1d60
(gdb) p *(struct Phils*)context->task->data[D_Phils]
$9 = {phils = 0x7fff2f7f1d60, putdown_lfork = C_putdown_lforkPhilsImpl, putdown_rfork = C_putdown_rforkPhilsImpl, thinking = C_thinkingPhilsImpl,
  pickup_rfork = C_pickup_rforkPhilsImpl, pickup_lfork = C_pickup_lforkPhilsImpl, eating = C_eatingPhilsImpl, next = C_exit_code}
(gdb) p *(struct Phils*)context->task->data[D_Phils]->phils
There is no member named phils.
(gdb) p (struct Phils*)context->task->data[D_Phils]->phils
There is no member named phils.
(gdb) p ((struct Phils*)context->task->data[D_Phils])->phils
$10 = (union Data *) 0x7fff2f7f1d60
(gdb) p *(struct PhilsImpl*)((struct Phils*)context->task->data[D_Phils])->phils
$11 = {self = 796859744, Leftfork = 0x1f0000001e, Rightfork = 0x1900000036, next = C_pickup_lforkPhilsImpl}
(gdb) p phils0->phils
$12 = (union Data *) 0x7fff2f7f1d60
(gdb) p *(struct PhilsImpl*) phils0->phils
$13 = {self = 796859744, Leftfork = 0x1f0000001e, Rightfork = 0x1900000036, next = C_pickup_lforkPhilsImpl}
(gdb) p *(struct PhilsImpl*)phils0->phils
$14 = {self = 796859744, Leftfork = 0x1f0000001e, Rightfork = 0x1900000036, next = C_pickup_lforkPhilsImpl}
```


```
  DB<30> p $line
"    AtomicT<int>* fork0 = createAtomicTImpl(contex,-1); // model checking : fork0
"
"    AtomicT<int>* fork0 = createAtomicTImpl(contex,-1); // model checking : fork0
"

  DB<31> p $type
"AtomicT"
"AtomicT"

  DB<32> n
main::convertGenerics(generate_context.pl:566):
566:              if ($repimpl) {
  DB<32> p $line
"    AtomicT_int* fork0 = createAtomicT_intImpl(contex,-1); // model checking : fork0
"
"    AtomicT_int* fork0 = createAtomicT_intImpl(contex,-1); // model checking : fork0
"

  DB<33> p $repimpl
1
1

  DB<34> n
main::convertGenerics(generate_context.pl:567):
567:                $line =~ s/$impl(<.*>)?/$replaceImpls/g;
  DB<34> p $impl
"AtomicTImpl"
"AtomicTImpl"

  DB<35>
```

```perl
+kajika+anatofuz$ perl generate_stub.pl SingleLinkedQueue.cbc
\ {
    queue               {
        clear     "C_clearSingleLinkedQueue",
        isEmpty   "C_isEmptySingleLinkedQueue",
        put       "C_putSingleLinkedQueue",
        take      "C_takeSingleLinkedQueue"
    },
    singleLinkedQueue   {
        last   "singleLinkedQueue",
        top    "new"
    }
}
```