Skip to content

Conversation

@yamt
Copy link
Contributor

@yamt yamt commented Sep 5, 2022

Use an empty string instead of stack garbage.

if (!wasm_debug_instance_get_current_object_name(
(WASMDebugInstance *)server->thread->debug_instance, objname,
128)) {
objname[0] = 0; /* use an empty string */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about zero initialize the buffer at L110: char objname[128] = { 0 };

And how about set to nobody.wasm if get object name failed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about zero initialize the buffer at L110: char objname[128] = { 0 };

i don't like it because it assumes more about the implementation of wasm_debug_instance_get_current_object_name.

And how about set to nobody.wasm if get object name failed?

why? it looks like an ordinary name. does lldb handle it specially?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't like it because it assumes more about the implementation of wasm_debug_instance_get_current_object_name.

Ok, agree with you.

why? it looks like an ordinary name. does lldb handle it specially?

No, lldb doesn't handle it specially. Just because we use this string for LIBC_BUILTIN mode.
Empty string also OK to me.

@xujuntwt95329
Copy link
Collaborator

LGTM

@wenyongh wenyongh merged commit 0ca2718 into bytecodealliance:main Sep 5, 2022
vickiegpt pushed a commit to vickiegpt/wamr-aot-gc-checkpoint-restore that referenced this pull request May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants