I've just installed Slimv to maximize lisp hacking, and I can't get anything useful out of the debugger.
If I type in the REPL
(+ 1 a)
I get the following error, which is fine
EVAL: variable A has no value
[Condition of type SYSTEM::SIMPLE-UNBOUND-VARIABLE]
...and it's accompanying insane backtrace
Backtrace:
0: [520] frame binding variables (~ = dynamically): | ~ SWANK::*SLDB-STEPPING-P* <--> NIL
No locals
1: [517] frame binding variables (~ = dynamically): | ~ SWANK::*SLDB-LEVEL* <--> 0
2: [514] frame binding variables (~ = dynamically): | ~ *PACKAGE* <--> #<PACKAGE COMMON-LISP-USER>
3: <1/507> #<COMPILED-FUNCTION SWANK::DEBUG-IN-EMACS>[506] frame binding variables (~ = dynamically): | ~ SWANK::*SLIME-INTERRUPTS-ENABLED* <--> T
4: <1/501> #<COMPILED-FUNCTION SWANK:INVOKE-SLIME-DEBUGGER>- #<COMPILED-FUNCTION SWANK::SWANK-DEBUGGER-HOOK-2-1>
5: <1/499> #<COMPILED-FUNCTION SWANK::SWANK-DEBUGGER-HOOK-2-1>- #<COMPILED-FUNCTION SWANK::SWANK-DEBUGGER-HOOK-2-1>
6: [498] frame binding variables (~ = dynamically): | ~ *DEBUGGER-HOOK* <--> NIL
7: <1/494> #<COMPILED-FUNCTION #:|877 882 (DEFINTERFACE CALL-WITH-DEBUGGER-HOOK (HOOK FUN) ...)-84-3-1|>- #<COMPILED-FUNCTION #:|877 882 (DEFINTERFACE CALL-WITH-DEBUGGER-HOOK (HOOK FUN) ...)-84-3-1|>
8: <1/489> #<COMPILED-FUNCTION SWANK-BACKEND:CALL-WITH-DEBUGGER-HOOK>- #<COMPILED-FUNCTION SWANK::SWANK-DEBUGGER-HOOK-2>
9: <1/486> #<COMPILED-FUNCTION SWANK::SWANK-DEBUGGER-HOOK-2>- #<COMPILED-FUNCTION SWANK::SWANK-DEBUGGER-HOOK-2>
10: [485] handler frame for conditions SWANK::INVOKE-DEFAULT-DEBUGGER
11: [479] compiled tagbody frame for #(NIL)
12: <1/473> #<COMPILED-FUNCTION SWANK:SWANK-DEBUGGER-HOOK>[471] frame binding variables (~ = dynamically): | ~ *DEBUGGER-HOOK* <--> #<COMPILED-FUNCTION SWANK:SWANK-DEBUGGER-HOOK>
13: <1/468> #<SYSTEM-FUNCTION INVOKE-DEBUGGER> 1[467] frame binding variables (~ = dynamically): | ~ SYSTEM::*PRIN-STREAM* <--> #<UNBOUND>
14: [464] frame binding variables (~ = dynamically): | ~ *PRINT-READABLY* <--> NIL
15: [461] frame binding variables (~ = dynamically): | ~ *PRINT-ESCAPE* <--> T
16: <1/458> #<SYSTEM-FUNCTION ERROR>[457] frame binding variables (~ = dynamically): | ~ SYSTEM::*ACTIVE-RESTARTS* <--> (#S(RESTART :NAME SWANK::RETRY :TEST #<COMPILED-FUNCTION SYSTEM::DEFAULT-RESTART..
17: [454] frame binding variables (~ = dynamically): | ~ SYSTEM::*CONDITION-RESTARTS* <--> NIL
18: [450] compiled block frame for SYSTEM::CHECK-VALUE
19: <1/445> #<COMPILED-FUNCTION SYSTEM::CHECK-VALUE>- NIL ~
So, what the heck is going on, and how can I fix it?
Well, this is working with the debugger then go to normal mode (press ESC)
and:
If you place the cursor on a numbered line in the Backtrace: section
and press Enter (in Normal mode) then the frame locals are displayed:
If you press Enter on a numbered line in the Restarts: section then
the corresponding restart is executed. The most frequently used
restarts have their own keyboard shortcuts: ,a selects the Abort, ,q
selects the Quit and ,n selects the contiNue restart. Let's choose
restart 1: [*ABORT] Return to SLIME's top level by pressing ,a:
you can learn more on it with the slimv tutorial
Related
So I have a simple eBPF code:
my.h:
#ifndef __MY_COMMON_H__
#define __MY_COMMON_H__
#include <linux/types.h>
struct foo {
int a;
int b;
int c;
int d;
};
#endif /* __MY_COMMON_H__ */
my_kern.c:
...
struct bpf_map_def SEC("maps") my_map = {
.type = BPF_MAP_TYPE_HASH,
.key_size = ...,
.value_size = ...,
.max_entries = MAX_ENTRIES,
};
struct foo my_foo = {
.a = 150000,
.b = 100,
.c = 10,
.d = 40,
};
SEC("sockops")
int my_bpf(struct bpf_sock_ops *sk_ops)
{
...
};
char _license[] SEC("license") = "GPL";
u32 _version SEC("version") = LINUX_VERSION_CODE;
I build the code with llvm-5.0, with no errors/warnings, however bpftool prog load ... fails:
libbpf: Program 'sockops' contains non-map related relo data pointing to section 6
Error: failed to load program
$ llvm-readelf-5.0 -s my_kern.o
There are 12 section headers, starting at offset 0xa90:
Section Headers:
[Nr] Name Type Address Off Size ES Flg Lk Inf Al
[ 0] NULL 0000000000000000 000000 000000 00 0 0 0
[ 1] .strtab STRTAB 0000000000000000 0009c0 0000cc 00 0 0 1
[ 2] .text PROGBITS 0000000000000000 000040 000000 00 AX 0 0 4
[ 3] sockops PROGBITS 0000000000000000 000040 0006e0 00 AX 0 0 8
[ 4] .relsockops REL 0000000000000000 000980 000040 10 11 3 8
[ 5] maps PROGBITS 0000000000000000 000720 00001c 00 WA 0 0 4
[ 6] .data PROGBITS 0000000000000000 00073c 00001c 00 WA 0 0 4
[ 7] .rodata.str1.16 PROGBITS 0000000000000000 000760 000093 01 AMS 0 0 16
[ 8] .rodata.str1.1 PROGBITS 0000000000000000 0007f3 00001d 01 AMS 0 0 1
[ 9] license PROGBITS 0000000000000000 000810 000004 00 WA 0 0 1
[10] version PROGBITS 0000000000000000 000814 000004 00 WA 0 0 4
[11] .symtab SYMTAB 0000000000000000 000818 000168 18 1 10 8
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings), l (large)
I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
O (extra OS processing required) o (OS specific), p (processor specific)
$
Section 6 contains my my_foo structure, I could dump its contents with llvm-objdump.
This error does not happen if I define my_foo inside main() function for instance. Does it mean such global declarations are not permitted by eBPF convention?
eBPF knows nothing about global variables. When bpftool sends your program to the kernel, it only sends one piece of bytecode instructions that is supposed to be “self-contained” (at least if you don't use eBPF function calls, but eBPF functions are not yet supported by libbpf and bpftool so I assume this is not the case).
Anyway: when bpftool calls libbpf to load your program from the ELF file, it expects to find the whole self-contained program in one ELF section. There is an exception for maps, for which some metadata is placed into a specific ELF section. Other than this, libbpf does not know how to get the definition of your global variable my_foo from the .data section and to move it into the main section. This is why it warns you about non-map related relo[cation] data in this .data section.
my_kern.o
+----------------------------+
| ELF header |
+----------------------------+
|sockops |
| |
| eBPF instructions |
| | |
| ->“get my_foo from .data” | <- libbpf: “What am I supposed to do with this??”
| |
+----------------------------+
| Other ELF sections… |
+----------------------------+
|.data | <- libbpf: “I don't care about this section”
| my_foo |
+----------------------------+
I'm a true artist, aren't I?
So the problem actually comes from how clang handles your global variable here. If you move the definition inside the main function, clang apparently does not move it to its own .data section in the object file it creates. I suppose you are trying to move the variable to a header file, possibly to share it with other source files; I don't know if this is possible to have this to compile correctly, there may exist some flags for clang or some preprocessing directives that would help you, but this is beyond my knowledge.
Seems like static global variable relocation works now (kernel 5.4, Clang 10, Ubuntu 20.04). In my code the value of variable test persists between runs of BPF prog.
static __u64 test = 0;
SEC("cgroup_skb/egress")
int cb_pkt(struct __sk_buff *skb)
{
bpf_printk("Packet with size: %d\n", test);
test = skb->len;
return 1;
}
Could you please help me how to set own name for each test case into Data Driven to make report more readable.
REAL REPORT EXAMPLE:
Status: FAIL (critical)
Message: Several failures occurred:
1) ******************************
FAIL: Wrong value received. Expected: 0 . Actual: 3
2) ******************************
FAIL: Wrong value received. Expected: 0 . Actual: 3
3) ******************************
FAIL: Wrong value received. Expected: 0 . Actual: 3
But it is not clear from the output about details. And I would like to have some details instead of ***************,
THAT I NEED :
Status: FAIL (critical)
Message: Several failures occurred:
1) if param is empty
FAIL: Wrong value received. Expected: 0 . Actual: 3
2) if param is out of range
FAIL: Wrong value received. Expected: 0 . Actual: 3
3) if param is something more
FAIL: Wrong value received. Expected: 0 . Actual: 3
I have these detail as ${comment} for each table line into data driven. Could you please help me how to assign it for each test case inside data driven to have more understandable report.
DATA DRIVEN TEST EXAMPLE
st_ddt_test_example
[Template] st_ddt_test_example_keyword
# comment # # value setup # # value expected #
if param is empty 0 0
if param is out of range 100 0
if param is something more -8 0
Your keyword controls the error that is displayed, so it just needs to include the name as part of the error message.
Here is an example:
*** Keywords ***
Example
[Arguments] ${comment} ${1} ${2}
should be equal ${1} ${2}
... ${comment}: '${1}' != '${2}'
... False
*** Test Cases ***
Test 1
[Template] example
Test 1.0 a b
Test 1.1 b c
Test 1.2 c d
When run, the test yields the following results:
Test 1 | FAIL |
Several failures occurred:
1) Test 1.0: 'a' != 'b'
2) Test 1.1: 'b' != 'c'
3) Test 1.2: 'c' != 'd'
I'm using SQLite on Windows UWP (10).
This is what I am doing:
Open connection
Begin Transaction
Update row
Commit Transaction
Close connection
And yet, the value in the database is not actually written to the table. When I reload the record (after disconnecting and reconnecting, or not disconnecting) the value remains from before I called the update.
Is there something extra I need to do? In DB Browser for SQLite, there is a menu item called "Write Changes". What does that do? Just a normal commit? In the browser, the changes are only committed if I click on this menu item.
Also, I put a trace on the connection, and this is what came up:
Executing: begin transaction
Executing: UPDATE
'TaskManagement.TaskInfo'
SET
StatusKey = #StatusKey, ProbAddDttm = #ProbAddDttm, ProbCode = #ProbCode, ProbPriority = #ProbPriority, ProbGroup = #ProbGroup, ProbInsp = #ProbInsp, Activity = #Activity, UpdateDttm = #UpdateDttm, Asset = #Asset, Address = #Address, TaskStartDttm = #TaskStartDttm, MaintenanceScheduleSetup = #MaintenanceScheduleSetup, MaintenanceScheduleBatch = #MaintenanceScheduleBatch, ProbZone = #ProbZone, ProbContractor = #ProbContractor, ProbNotes = #ProbNotes, JobCompleted = #JobCompleted, Resolution = #Resolution, Result = #Result, ActType = #ActType, Complaint = #Complaint, BudgetNo = #BudgetNo, Contractor = #Contractor, MapLocCorrect = #MapLocCorrect, FollowUpWorkRequired = #FollowUpWorkRequired, Condition = #Condition, ActPriority = #ActPriority, ExpectedVersion = #ExpectedVersion, EmailProbOriginator = #EmailProbOriginator, IsBug = #IsBug, IsCompletePendingCheckIn = #IsCompletePendingCheckIn
WHERE
TaskInfoKey = #PrimaryKey
0: 63711ec4-57d0-4a23-8595-0022b757af44
1: 6
2: 2013-06-03 08:56:39:117
3: 13
4: 2
5: 17
6: 24
7:
8: 2015-11-10 04:05:09:502
9:
10:
11: 2013-06-03 08:56:39:117
12:
13:
14:
15:
16: Test this mofo!
17: 2013-08-15 12:13:24:620
18:
19:
20:
21:
22:
23: 4
24: False
25: False
26:
27:
28: 3
29: False
30: False
31: False
Executing: Commit
So, in the end, the problem was that I was not passing the parameters in to the library correctly. The connection's CreateCommand method only allows you to pass in the command text, and an array of objects. This is incorrect because that means you can't name the parameters. So, I consider this a piece of missing functionality in this particular implementation of SQLite for UWP.
Secondly, this should have errored! None of the parameter names I mentioned above were passed in to the command, and yet when I ran it, no exception was thrown. So, I consider this to be the second bug in the implementation.
I fixed it like this:
var command = _Connection.CreateCommand(commandText, new object[0]);
if (parameters != null)
{
foreach (var parameter in parameters)
{
if (parameter.ParameterValue is DateTime)
{
parameter.ParameterValue = ((DateTime)parameter.ParameterValue).ToString("yyyy-MM-dd hh:mm:ss:fff");
}
command.Bind(parameter.ParameterName, parameter.ParameterValue);
}
}
return command;
I'm trying to figure out what is stored at a certain place on the stack with GDB. I have a statement:
cmpl $0x176,-0x10(%ebp)
In this function I'm comparing 0x176 to the -0x10(%ebp) and I am wondering if there is a way to see what is stored at -0x10(%ebp).
I am wondering if there is a way to see what is stored at -0x10(%ebp).
Assuming you have compiled with debug info, info locals will tell you about all the local variables in current frame. After that, print (char*)&a_local - (char*)$ebp will tell you the offset from start of a_local to %ebp, and you can usually find out what local is close to 0x176.
Also, if your locals have initializers, you can do info line NN to figure out which assembly instruction range corresponds to initialization of a given local, then disas ADDR0,ADDR1 to see the disassembly, and again understand which local is located at what offset.
Another alternative is to readelf -w a.out, and look for entries like this:
int foo(int x) { int a = x; int b = x + 1; return b - a; }
<1><25>: Abbrev Number: 2 (DW_TAG_subprogram)
<26> DW_AT_external : 1
<27> DW_AT_name : foo
<2b> DW_AT_decl_file : 1
<2c> DW_AT_decl_line : 1
<2d> DW_AT_prototyped : 1
<2e> DW_AT_type : <0x67>
<32> DW_AT_low_pc : 0x0
<36> DW_AT_high_pc : 0x23
<3a> DW_AT_frame_base : 0x0 (location list)
<3e> DW_AT_sibling : <0x67>
<2><42>: Abbrev Number: 3 (DW_TAG_formal_parameter)
<43> DW_AT_name : x
<45> DW_AT_decl_file : 1
<46> DW_AT_decl_line : 1
<47> DW_AT_type : <0x67>
<4b> DW_AT_location : 2 byte block: 91 0 (DW_OP_fbreg: 0)
<2><4e>: Abbrev Number: 4 (DW_TAG_variable)
<4f> DW_AT_name : a
<51> DW_AT_decl_file : 1
<52> DW_AT_decl_line : 1
<53> DW_AT_type : <0x67>
<57> DW_AT_location : 2 byte block: 91 74 (DW_OP_fbreg: -12)
<2><5a>: Abbrev Number: 4 (DW_TAG_variable)
<5b> DW_AT_name : b
<5d> DW_AT_decl_file : 1
<5e> DW_AT_decl_line : 1
<5f> DW_AT_type : <0x67>
<63> DW_AT_location : 2 byte block: 91 70 (DW_OP_fbreg: -16)
This tells you that x is stored at fbreg+0, a at fbreg-12, and b at fbreg-16. Now you just need to examine location list to figure out how to derive fbreg from %ebp. The list for above code looks like this:
Contents of the .debug_loc section:
Offset Begin End Expression
00000000 00000000 00000001 (DW_OP_breg4: 4)
00000000 00000001 00000003 (DW_OP_breg4: 8)
00000000 00000003 00000023 (DW_OP_breg5: 8)
00000000 <End of list>
So for most of the body, fbreg is %ebp+8, which means that a is at %ebp-4. Disassembly confirms:
00000000 <foo>:
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 83 ec 10 sub $0x10,%esp
6: 8b 45 08 mov 0x8(%ebp),%eax # 'x' => %eax
9: 89 45 fc mov %eax,-0x4(%ebp) # '%eax' => 'a'
...
I need to get the data for each row in an advanceddatagrid where the nodes are open.
For example, my ADG looks like this:
+ Science
- Math
- Passed
John Doe | A+ | Section C
Amy Rourke | B- | Section B
- Failed
Jane Doe | F | Section D
Mike Cones | F | Section D
- English
+ Passed
+ Failed
- History
+ Passed
- Failed
Lori Pea | F | Section C
I tried using the following code to get the open nodes:
var o:Object = new Object();
o = IHierarchicalCollectionView(myADG.dataProvider).openNodes;
But doing the following code to inspect the object:
Alert.show(ObjectUtil.toString(o), 'object inpsection');
Gives me:
(Object)#0
Math (2)
children = (mx.collections::ArrayCollection)#2
filterFunction = (null)
length = 2
list = (mx.collections::ArrayList)#3
length = 2
source = (Array)#4
[0] (Object)#5
children = (mx.collections::ArrayCollection)#6
filterFunction = (null)
length = 2
list = (mx.collections::ArrayList)#7
length = 2
source = (Array)#8
[0] <Table>
<Name>John Doe</Name>
<Grade>A+</Grade>
<Section>Section C</Section>
</Table>
[1] <Table>
<Name>Amy Rourke</Name>
<Grade>B-</Grade>
<Section>Section B</Section>
....
...
..
Basically, I just need to create an object or array or xmllist that would give me:
Math | Passed | John Doe | A+ | Section C
Math | Passed | Amy Rourke | B- | Section B
Math | Failed | Jane Doe | F | Section D
Math | Failed | Mike Cones | F | Section D
History | Failed | Lori Pea | F | Section C
Any suggestion would be highly appreciated. Thanks
You should be able to iterate across the openNodes object's properties and for each one grab the collection and concat the values onto a new array then use that as the source of another type of collection if necessary. Something like this:
var newArray:Array = [];
for(var property:String in o)
{
newArray = newArray.concat(o[property][0].source); //Passed, property is subject as in Math
newArray = newArray.concat(o[property][1].source); //Failed property is subject as in Math
}
The only real problem with this is you're trying to also keep the Math and passed or failed in the objects, otherwise the above should work. To get this other part working I think you need to break each of the statements above into it's own loop that iterates across the source of the openNodes object and puts the right values into a new Value Object you make up that has the subject and the pass or fail set on it. Then you could store these values as well, also notice I'm assuming the pass fail is always organized this way in the original data structure where in each subject you'll have two arrays and the first will be pass followed by fail.