Комментарии:
dude wtf are you talking about? you just ramble all video. You didn't explain anything
ОтветитьGreat explanation, keep up the good work!
ОтветитьI am wondering how does OS knows how much memory it must be allocated for the program. I assume that Stack Overflow occurs when Stack memory addreses intersecs with Heap memory addresses?
ОтветитьSo... when you're reading it normally like you would in a disassembled/hex editor or whatever the stack actually grows upwards? I get confused by everyone putting the high addresses in their examples at the top of the diagram. And with frame pointer you meant the base pointer and not the stack pointer, right?
edit: oooh yeah so the stack pointer would in this case point to the address of the "return" variable on the stack, probably? Like...
0x0 | ...
0x4 | "return" var
0x8 | old base pointer
0xC | return address
0x10 | "counter" arg
...
Frame pointer = 0x8
Stack pointer = 0x4
This is the best video I found to refresh my memory on basic program execution I could find after working on higher level languages for so long. So many people put up videos that are apparent word salad with no real comprehension... As if they are trying to remember how it works while explaining it. Thank you Jacob.
ОтветитьThis was so good!
Ответитьhey jacob,
about the address from the main function when we printed : &i , __builtin_frame_address
the difference between the integer storage i and the SP was 4 bytes all seems good, but when we called myfunc() the difference between : &i , __builtin_frame_address turned to be 8 bytes
i didn't get that behavior, and could u send the link related to this video -of using these commands-.
ALL I CAN SAY IS THANK YOUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU.
Ответитьgreat video!
ОтветитьI did not understand how stack frames work, how stack, base and instruction pointers work until I looked at the assembly and then wrote a couple of functions in assembly myself. I was then surprised to find out that first two arguments of a function in my windows PC go into ecx and edx registers while on my Ubuntu they go to esi and edi registers. Both my Ubuntu and my windows compiler put the return value into eax register though. Ubuntu compiler doesn't decrease the stack pointer if it is a leaf function which uses less than 128 bytes (I then found out that these 128 bytes for a leaf function was called the red zone).
My Windows PC doesn't seem to have this red zone, but windows compiler sometimes puts a local variable on the other side of the base pointer (positive ofset from base pointer instead of negative offset) which never happens on my Ubuntu PC. When I write assembly I always decrease the stack pointer and put local variables in the negative offset, both when I am on Ubuntu and when I am on Windows).
Even these little things that I learned about how functions work on my Ubuntu I wouldn't know without looking at the assembly. And the reason why I learned this is because it bugged me that I didn't understand how function calls work under the hood.
Good, video was complicated for me, you made it easy.💕
ОтветитьDude ! You are an amazing instructor !! Have you already created a video where you walk the stack to find the stack trace ? If no, humbly requesting you to :)
Ответить666 base stack memory 667 neighbor of the beast stack overflow by 1
ОтветитьIn the illustration of the stack and the heap an so on, there is a little gap above the stack. Whats that?
ОтветитьNo, a stack over flow is a website where people tell you someone already asked that question
ОтветитьHow to count the number of stack frames in Stack RAM just looking at stack RAM values?
ОтветитьI really liked seeing you using lldb, that was insightful!
ОтветитьAwesome, video. Love when you matter-of-factly state the hex addresses are going up and down. Not everyone reads hex bro 😂. Still, hyper useful tutorial.
ОтветитьWow what an amazing video , super helpful channel !!
ОтветитьRuntime stacktrace library please.
ОтветитьGreat video
ОтветитьDo you think you could make one on setjmp.h? I recently found some code with it, and was really confused about how it worked and what it was doing. Thanks
ОтветитьThere's a difference between knowing a subject and understanding it and Jacob, even though his name isn't spelled with 'k', understands what he's talking about. That makes such big difference; that's why I've learned more about C programming watching his stuff for two days than other stuff for two months. Subscriber (since two days) !
ОтветитьCan you please explain " search.h " header file in c programming.
ОтветитьHE'S ALIVE!
Ответитьit worrying how much you look like and talk like Matthew McConaughey
ОтветитьHello Jacob. Very interesting material as usual. Go ahead and make material about "Calling Conventions" as it is next interesting topic in my opinion.
ОтветитьYour channel is exceptional. Please keep up the good work!
ОтветитьDear Jacob,
Thanks a lot for the tutorial.
1 What happens in the process (or in firmware) before main() launches?
2 Who determines the order of initialization of global variables (in case of int g_val=foo();)?
3 What code copies the return address onto the stack frame?
4 Can a C function at runtime determine whether it has been called recursively just by exploring values in RAM stack?
Regards,
AB
great video as always!
question: I know that there's a 'randomize memory' option for the virtual memory of the process, how does it mesh with stack addresses and stuff?
Awesome video! I really like how you explain these concepts. Question: do you ever discuss how things, like stack overflows, stack 'crushing', or buffer overflows can be used for hacking purposes? I don't mean from a "here's how you do it" perspective but from a "how it can be exploited" perspective? Or maybe even that might be too close to "how to do it". lol Anyway, thanks for posting!
ОтветитьYour videos are amazing. What kind of environment are you using for your C project?
ОтветитьHi Jacob, Why the frame address can be in the middle sometimes?
Ответитьthank you so much making videos like this and i am getting 100% fruitful from your videos!!!
Ответитьaah another thing
that you always says "that is topic for another video" or "i will talk about in future" some time you talk but most videos i anticipating are not shared
if you can please can you make videos about in-depth usage about gdb. i mean how to use gdb more efficiently and advance feature from the beginning.
ОтветитьI once had an actual stack overflow problem and went to try and google about it but kept finding unrelated results on Stack Overflow : (
ОтветитьVery interesting. Thank you for the lesson. Thanks to you I've been writing a lot more examples in C lately, you motivated to go back and write some data structures from scratch and actually understand them better than just calling a new List<T> for literally every need.
ОтветитьNow this is oddly convenient. I have been trying to implement a way to manually create stack frames all day. Those pesky segmentation faults and bus errors just keep on coming.
ОтветитьI haven't coded in a long time. Got let go when the pandemic started then developed a movement disorder. Your videos will be nice as a quick refresher.
ОтветитьI'm glad to get a tutor like you.
You are a great tutor I ever seen.
You make complex concept easy to understand.
🙏 Thank you so much 🙏
Hello Jacob Sorber, do you think Rust will kill c/c++? Even if c/c++ used in many important software and IoT devices, I see many comments about Rust is going to replace c/c++ in the future because of its memory-safety. There are other memory-safe languages like go/java/D but they are slower than c/c++. However, It's said Rust is as fast as C/C++ and memory-safe, how is this possible? Other languages lose their speed for security but Rust doesn't, can you make a video about these topics
ОтветитьIt's been a long time since the last video... Happy to see another one :)
ОтветитьComing in clutch, jacob! I started researching the call stack in more depth recently and you just uploaded this. Thanks so much man! Wishing you a great christmas and a happy new year
Ответить