|
Thanks for your response. I was asking more about using the service as a debugger and having it attach to a user process.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Hi,
Can some one help me?. I need to make a window with multiple viewports like in 3DS MAX with c++, Each viewport must be rendered with OpenGL with separate mouse actions
|
|
|
|
|
I suggest you read this[^] and then edit your post to provide more detail
|
|
|
|
|
|
Is it possible in the Visual Studio native debugger to navigate to a symbol's location (in disassembly view) by using the name of the symbol?
For instance, going to the start of the GetLastError() function by entering the name of it?
If so, how does one do this?
EDIT: If VS can't do this, can KDebug do it?
SOLUTION: On the Visual Studio DEBUG menu, choose New Breakpoint => Function Breakpoint and then enter the name of the DLL and the function name as such:
ws2_32.dll!socket It will place a breakpoint at the beginning of the function!
The difficult we do right away...
...the impossible takes slightly longer.
modified 2-Jul-21 22:03pm.
|
|
|
|
|
I just tried getting the address in the debug window but could not find any way to do it. But if you add a call to GetLastError and set a breakpoint at that address, the debugger will stop at the call. I am not sure what you would gain by it even if you could find the address, since you cannot step into most Window functions.
|
|
|
|
|
Richard MacCutchan wrote: I am not sure what you would gain by it even if you could find the address I must debug an executable for which I do not have the source, and I need to determine which Winsock mode it's using, overlapped I/O, completion ports, select event, etc. I figured I would do this by placing breakpoints at all of the various Winsock functions and examining the arguments being passed.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Without the source you will not be able to see very much. The debugger only works with the debug information created by the compiler and linker, and built into the PDB file. Without that and the source files you will most likely not be able to find anything.
|
|
|
|
|
How do I verify application executable after "sudo apt install..."
I understand that
sudo apt install installs "package" and not an executable.
I am unable to start the installed application since during "install" and I have no indication where it is being installed.
|
|
|
|
|
Since we have no idea what you installed it is difficult to give an answer. You should check the output from the install to see what happened. You can also use the list sub-command to check what has been installed.
|
|
|
|
|
Further to what Richard has said, you can check which files were installed with dpgk -L <package> Unless you've installed a doc or lib package, you've almost certainly got an executable somewhere.
Keep Calm and Carry On
|
|
|
|
|
My doubt is about the basic theory of "or logical operator". Especifically, logical OR returns true only if either one operand is true.
For instance, in this OR expression (x<O || x> 8) using x=5 when I evalute the 2 operands, I interpret it as both of them are false.
But I have an example that does not fit wiht it rule. On the contrary the expression works as range between 0 and 8, both included. Following the code:
#include <stdio.h>
int main(void)
{
int x ;
do
{
printf("Imput a figure between 1 y 8: ");
scanf("%i", &x);
}
while ( x < 1 || x > 8 );
{
printf("Your imput was ::: %d ",x);
printf("\n");
}
printf("\n");
}
I really appreciate any helpo in order to clarify my doubt
In advance, thank you very much. Otto
|
|
|
|
|
You might be confused by a pair of spurious braces
#include <stdio.h>
int main(void)
{
int x ;
do
{
printf("Imput a figure between 1 y 8: ");
scanf("%i", &x);
}
while ( x < 1 || x > 8 );
{
printf("Your imput was ::: %d ",x);
printf("\n");
}
printf("\n");
}
What the program does is to repeat the scanf statement until x is between 1 and 8.
Antoher way to explain it: the loop repeats until the condition is false. !( (x<1) || (x>8) ) is equivalent to !(x<1) && !(x>8) (see De Morgan's laws[^]), or (x>=1) && (x<=8) .
Mircea
|
|
|
|
|
Hi Mrice, very interesting your contibutions. I am just beginning and exploring basics of programming. And understand it is like a puzzle for me. Also Morgan's law is good reference. Something abstract, but for sure I am going to review it deeply.
I really apreciate all your time you took for answer me-
Otto Medina
|
|
|
|
|
How does logical OR work?
"Logical or," not to be confused with "bitwise or," is a short-circuiting operator that evaluates to an integer, either 0 or 1.
Because it is short-circuiting, the second operand will not be evaluated if the first operand determines the result. In the case of OR, that means if the first operand is non-zero. (In the case of logical AND, the evaluation short-circuits if the first operand IS zero, since that determines the result.)
Finally, if the second operand is evaluated, there is guaranteed to be a sequence point before evaluation of the second operand. This means it is "safe" to use things that require sequence points, like the operators that have side-effects (++, --).
Consider this code:
int first(int x) {
puts("first");
return x;
}
int second(int x) {
puts("second");
return x;
}
void test(int x) {
if (first(x) || second(x)) {
puts("logical or returns true");
}
else {
puts("logical or returns false");
}
}
If I call test(0) what will happen?
The test function will call first(0) which will print its message and return 0. Because 0 is "false", the result of the logical or is not determined, so the second operand is evaluated. This calls second(0) which will print its message and return 0. Since both sides evaluate to 0 (false), the OR also evaluates to 0 and the if fails, so the else clause is invoked.
The output is something like:
second
logical or returns false
Now, if I call test(1) what happens?
The first operand is first(1) which prints its message and returns 1. 1 is truthy, so the result of the logical OR is determined and there is no need to evaluate the second operand. The call to second is skipped and the if succeeds and prints its message. The output looks like:
logical or returns true
How does the looping code work?
The code in question is:
{
printf("Imput a figure between 1 y 8: ");
scanf("%i", &x);
}
while ( x < 1 || x > 8 );
A do/while statement first invokes the body, then evaluates the condition. If the condition is true, the body is repeated and the condition re-evaluated until such time as the condition becomes untrue.
This statement is designed for tasks like input validation, where the body is used to collect input, then the condition is used to determine if the input is invalid. Because the body is always executed, it forces the input to be collected at least once, as compared with the "while (condition) {body}" loop form, where a premature condition could prevent the body from executing.
So in the code example, we have a prompt for input, then a scanf statement for collecting input (Note: see here: http://sekrit.de/webdocs/c/beginners-guide-away-from-scanf.html). This "prompt / input" body is surrounded by a do/while loop so the input will be collected at least once before the input variables are checked.
The input validation is to repeat the input while (x < 1 || x > 8) . This means that either of those conditions is NOT acceptable. If x is less than 1, repeat the prompt and input. Or, if x is greater than 8, repeat the prompt and input. Only when the logical or fails and both conditions are false will the input loop be stopped and the input considered acceptable.
This means that the valid range for the input is [1, 8]. Anything eise just gets the prompt again.
|
|
|
|
|
Hi Aghast
Thanks for your time.
I have red your answer at least about 10 times, and I feel that I am close to understand the logic of the determined range in this do while expression.
I really appreciate all your pacient in this excellent explanation.
Otto
|
|
|
|
|
I have limited access to the object , but I can retrieve data of interest - in this case dimensions of one of the GUI objects.
Form_Widget *FW = new Form_Widget(); // object
QRect dimensions = FW->geometry(); // returns dimensions of specific part of the object
int start_X = dimensions.x2; //can't do, QRect / dimensions are private
|
|
|
|
|
Try dimensions.height() or dimensions.width()
Mircea
|
|
|
|
|
Well, that works but does not answer the question .
I guess height and width are QRect public variables derived from "private" data.
QRect doc should confirm that.
I think I need to read-up on "friend" - that semms to be the real OOP ticket.
|
|
|
|
|
Member 14968771 wrote: I think I need to read-up on "friend" - that semms to be the real OOP ticket
On the contrary: that might take you into a non-OOP design.
The idea of using public member functions is to make your code independent of internal implementation details of other classes. In your case, a class representing a rectangle might keep a corner of the rectangle and its dimensions. Another one might keep two opposite corners or some other combination. If you try to access private members of the class your code will need to change when or if the implementation of the rectangle changes. If you stick to using only public interface, the internal details of the rectangle class may change but your code will remain the same.
You cannot "buy" your way inside a class using a friend declaration. Just like in real life, the friendship is not a symmetrical relation. If you put a friend QRect declaration inside your class that doesn't give you any special access rights. It gives access rights to QRect to your class but obviously QRect is not going to use those rights. You would need to modify the QRect header file to insert a friend declaration mentioning your class. This is very intrusive and basically defeats the purpose of OOP design.
I cannot make an OOP design course here, but there are some pretty good references available.
Mircea
|
|
|
|
|
Member 14968771 wrote: I guess height and width are QRect public variables derived from "private" data. No, they are public methods that give you read-only access to private members.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
So my initial problem is I was accessing the private variable directly and not thru QRect.
I am not sure I am saying it right.
I'll take a look at QRect class.
Thanks
|
|
|
|
|
|
One of the steps I invariably do, when debugging, is comment-out private blocks ... essentially rendering all statements public. Now that I get typing ... and that's just for starters.
Without the essential error code (warning?) accompanying a successful compilation/link/running blank form ... there's little more time expendable for me, especially if you're already running debugger and just don't care to get descriptive enough with words and include a code.
So, I'll just cut to the chase.
|
|
|
|
|
Hacking it.
"In testa che avete, Signor di Ceprano?"
-- Rigoletto
|
|
|
|