Any ways of reading the register values while debugging . for example if i would like to put an condition like 'if(eax == 100)' in the below code before Nop function.
Thanks
For the first question, kind of. If you mean to actually use a debugger, then check this post out; https://docs.microsoft.com/en-us/visualstudio/debugger/how-to-use-the-registers-window?view=vs-2019
If, however you're talking about accessing these values from inside the program, you might look into inline assembly, or calling assembly functions from C++, plenty of good articles online for both. I prefer calling from an assembly file, but that's because I find inline assembly syntax strange and cumbersome. Push all the registers into ram and look up your system's calling conventions to then return a pointer to that data. It's hard to say what C++ is going to do at any one time with the available registers, even in pure assembly some of the registers are not guaranteed to maintain their values between function calls. Just by calling a function you are likely changing several registers' values. A debugger has the benefit of having an exterior perspective and probably runs the code virtually.
Pretty much no as far as the architecture question. The assembly calls you'd have to make will be different on arm from on x86_64. How these registers values get changed during a function call is different if you are on Windows VS Linux, and if it's compiled for 64 bit system or 32 bit systems. (Linux changed their calling conventions between the two). One of the key reasons that the C language was created is because assembly was so machine-dependent by its very nature.