Disassembling printf doesn't give much info:
(gdb) disas printf
Dump of assembler code for function printf:
0x00401b38 <printf+0>: jmp *0x405130
0x00401b3e <printf+6>: nop
0x00401b3f <printf+7>: nop
End of assembler dump.
(gdb) disas 0x405130
Dump of assembler code for function _imp__printf:
0x00405130 <_imp__printf+0>: je 0x405184 <_imp__vfprintf+76>
0x00405132 <_imp__printf+2>: add %al,(%eax)
How is it implemented under the hood?
Why disassembling doesn't help?
What does * mean before 0x405130?
#include <intrin.h>
The above will report:
intrin.h: No such file or directory
Which seems to be a MSVC header file,but I'm using eclipse cdt,how can I make it available?Is there some libraries needed?
Disassembling printf doesn't give much info:
(gdb) disas printf
Dump of assembler code for function printf:
0x00401b38 <printf+0>: jmp *0x405130
0x00401b3e <printf+6>: nop
0x00401b3f <printf+7>: nop
End of assembler dump.
How is it implemented under the hood?
The two statements have totally different performance:
mysql> explain select * from jobs where createIndexed=false;
+----+-------------+-------+------+----------------------+----------------------+---------+-------+------+-------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+------+----------------------+----------------------+---------+-------+------+-------+
| 1 | SIMPLE | jobs | ref | i_jobs_createIndexed | i_jobs_createIndexed | 1 | const | 1 | |
+----+-------------+-------+------+----------------------+----------------------+---------+-------+------+-------+
1 row in set (0.01 sec)
mysql> explain select * from jobs where !createIndexed;
+----+-------------+-------+------+---------------+------+---------+------+-------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+------+---------------+------+---------+------+-------+-------------+
| 1 | SIMPLE | jobs | ALL | NULL | NULL | NULL | NULL | 17996 | Using where |
+----+-------------+-------+------+---------------+------+---------+------+-------+-------------+
Column definition and related index for aiding analysis:
createIndexed tinyint(1) NOT NULL DEFAULT 0,
create index i_jobs_createIndexed on jobs(createIndexed);
There are 26 errors in 1 .c file in the Problems window,but all are not sorted.
The upmost error happens in the end of the file.
What's the matter with cdt?
gdb a.exe
(gdb) disassemble main
Dump of assembler code for function main:
0x004012d0 <main+0>: push %ebp
0x004012d1 <main+1>: mov %esp,%ebp
...
The above can only be used to show a specific part inside the executable,how to dump all functions?
typedef union YYSTYPE {
int64_t iConst; // constant value
float fConst; // constant value
int iAttrLocator; // attribute locator (rowitem for int/float; offset+size for bits)
int iFunc; // function id
int iNode; // node index
} YYSTYPE;
It looks valid to me,but the cdt reports the following for the line int64_t iConst;:
Multiple markers at this line:
- syntax error before "int64_t"
- no semicolon at the end of structure or union
There are two files that defines int64_t,one is within the project itself(sphinxstd.h),the other is the MinGW/include/stdint.h,is it caused by this conflict?
0x004012d0 <main+0>: push %ebp
0x004012d1 <main+1>: mov %esp,%ebp
0x004012d3 <main+3>: sub $0x28,%esp
If the address is not available,can we calculate it ourselves?
This is what it looks like on my laptop with less than 4G:
0x004012f1 <main+0>: push %ebp
0x004012f2 <main+1>: mov %esp,%ebp
0x004012f4 <main+3>: sub $0x18,%esp
0x004012f7 <main+6>: and $0xfffffff0,%esp
Can someone using RAM larger than 4G paste a dump?
I think it should be no longer like 0x004012f7 as its capacity is only 2^32=4G
void function(int a, int b, int c) {
char buffer1[5];
char buffer2[10];
}
We must remember that memory can only
be addressed in multiples of the word
size. A word in our case is 4 bytes,
or 32 bits. So our 5 byte buffer is
really going to take 8 bytes (2 words)
of memory, and our 10 byte buffer is
going to take 12 bytes (3 words) of
memory. That is why SP is being
subtracted by 20.
Why it's not ceil((5+10)/4)*4=16?
YYSTYPE yyvsa[YYINITDEPTH];
YYSTYPE *yyvs = yyvsa;
register YYSTYPE *yyvsp;
For the code above,it just reports:
Description Resource Path Location Type
syntax error before "yyvsa" yysphinxexpr.c /sp/src line 852 C/C++ Problem
Which is far from useful,is it for configuration reasons?
quoted from here:
_function:
push ebp ;store the old base pointer
mov ebp, esp ;make the base pointer point to the current
;stack location – at the top of the stack is the
;old ebp, followed by the return address and then
;the parameters.
sub esp, x ;x is the size, in bytes, of all
;"automatic variables" in the function
What's stored in esp in the above code snippet?
%# load a grayscale image
img = imread('coins.png');
%# display the image
figure
imshow(img,[]);
%# false-color
colormap('hot')
The above code is from here:
http://stackoverflow.com/questions/2592755/infrared-image-processing-in-matlab/2592793#2592793
But I don't understand how figure(What's the difference with/without it?) and colormap(How does it affect the already shown img?) work?
I used two different command x/w and disas at the same address 0x405130,get totally different output:
(gdb) x/w 0x405130
0x405130 <_imp__printf>: 0x77c1186a
(gdb) disas 0x405130
Dump of assembler code for function _imp__printf:
0x00405130 <_imp__printf+0>: push $0x18
0x00405132 <_imp__printf+2>: (bad)
0x00405133 <_imp__printf+3>: ja 0x405109 <_imp___iob+1>
End of assembler dump.
I don't understand why it's like this,can anyone explain it?
I'm using javascript to validate the form,
but can't handle the case when the form is submitted before DOM is ready
I tried :
<form method="POST" disabled="disabled">
<input type="submit" />
</form>
But the form can still be submited.
int main() {
cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
system("pause");
return main();
}
The above works,but it hardcoded the main(),is there a magic variable to get the current running function?